# Pastebin RYLIM10X Hi, we are developing a plugin for Horizon to mange role access based policies. We have created a template panel and a backend in python and a front end using angularjs static files. The process to install the plugin might not be the best way to do so but we were able to create a bash file that does the following: 1. Check for existing pip package, dashboard enabled files and horizon static dashboard files and removes them. 1A. Check if a pip package already exists using the same name, if such a pip package is found it removes it using: python3 -m pip uninstall policy-ui. 1B. Check if horizon dashboard enabled files already exist with the same names (2 files _90_....py & _91_....py), if such files are found it removes them using the rm command. 1C. Check if static files already exist in the static/dashboard/policy, if they are found it will remove them. 1D. Checks if there is a .git folder in the plugin's inner directory (policy_ui), if found it will remove it. 1E. Checks if a package already exists in the dist directory in the plugin's inner directory (policy_ui), if found it will remove it. 1F. Checks if there is an egg-info directory in the plugin's inner directory (policy_ui), if found it will remove it. 2. Creates the plugin's install package. 2A. Initialize a repository in the plugin's inner directory (policy_ui) by calling: git init, git add . and git commit -m "temporary repo for installer packaging". 2B. Run the python setup by pointing it to the requirement file using the command: python3 -m pip install -r requirements.txt. 2C. Creates the plugin's install package using the command: python3 setup.py sdist. 2D. Installs the plugin using the created package in the previous step using the command: pip install policy-ui --no-index --find-links ./dist/. 2E. Clean up: removes the repo created for the packaging of the files for the installer, the created package in sdist and egg-info using: sudo rm -r .git/, sudo rm -r ./dist/ , sudo rm -r ./policy_ui.egg-info. 3. Add static and enabled files to Horizon dashboard. 3A. Copies the enabled files to: /opt/stack/horizon/openstack_dashboard/enabled/. 3B. Copies the static files to: /opt/stack/horizon/static/dashboard/policy/. 4. Restart apache2 and memcached services. 4A. Restarts Apache2 service by calling the command: sudo service apache2 restart. 4B. Restarts Memcached service by calling the command: sudo service memcached restart. At this point the Horizon dashboard is reloaded in the browser with bypassing the browser cache by pressing the keys: ctrl + F5. My questions are: Q1. Is this the best way to install the plugin? Is there a way to install the plugin without having to create a repository and then removing it just to make sure the pbr gets all the files? Q2. The reason this installation process deletes existing files and restarts the Apache2 and Memcached services is to ensure that the Horizon dashboard is loading the latest modifications made to the plugin and that nothing is cached somewhere which can cause errors to show about missing files after new changes are made to the plugin in the browser console. Is there anything else we can do to ensure that Horizon doesn't use any cached files from previous plugin installations that differ? Q3. using the command sudo cp -vrf ./policy_ui/static/dashboard/. /opt/stack/horizon/static/dashboard/ in the install.bash script makes ownership changes to /opt/stack/horizon/static/dashboard/policy/ directory which requires us to run the command: sudo chmod -vR 777 /opt/stack/horizon/static/dashboard/policy/ in order to modify them again. Why does this happen to the static files but not to the enabled files when they are copied using the command: sudo cp -vf ./policy_ui/enabled/_90_project_policy_panelgroup.py /opt/stack/horizon/openstack_dashboard/enabled/. Can this be dealt with without calling the chmod command in the install.bash script after the static files copy command? Q4. The current plugin structure in the repository is as such: horizon-policies-plugin/policy-ui/policy_ui/ * horizon-policies-plugin/: The project's root directory containing the git and readme files. * horizon-policies-plugin/policy-ui/: The plugin's root directory containing the plugin's setup.py, setup.conf, requirements.txt files for installing the plugin. * horizon-policies-plugin/policy-ui/policy_ui/: The plugin's files root directory containing the python panels, enabled and static files. The question is, is this structuring fine? or can the installation process be improved by making the policy-ui directory the project's root directory? The code of the install.bash script can be found here: https://github.com/nizos/horizon-policies-plugin/blob/master/policy-ui/install.bash The code for the plugin itself can be found here: https://github.com/nizos/horizon-policies-plugin Sorry for the wall of text and thank you for looking at this. Any and all feedback and tips are really appreciated. :)