sahara-dashboard/tools/clean_enabled_files.py
David Lyle 6c5898813c Excising Sahara content from Horizon
This plugin moves the current content from the horizon repo to this
plugin repo. The code has been tested in a devstack install using the
following steps:

    1. packaging the plugin: "python setup.cfg sdist"
    2. pip installing the tar.gz in the resulting dist directory
    3.  a. (temporary step) remove existing sahara enabled files from
            horizon
            "rm openstack_dashboard/enabled/_18*.py"
        b. finding the install location and changing to it
            "cp sahara_dashboard/enabled/* /opt/stack/horizon/local/enabled"
    4. in /opt/stack/horizon
        a. python manage.py collectstatic
        b. python manage.py compress
    5. restarting the horizon server

Additionally, you can run the unit tests by:
    ./run_tests.sh

    Note: added script to programmatically remove the old configuration
    files from the targeted horizon install, either in venv or system
    install.

Known issues:
  1. running tests locally emits missing neutron service messages.
  2. plugin code for devstack needs to be added
  3. README is inadequate
  4. integration tests are still in horizon repo
  5. local copy of run_tests is heavy weight, but a better solution is
     not available currently.
  6. localization tooling and strings

Change-Id: Icdce2d3e945e612d368556dd5cea1930194c7b67
2015-11-30 16:40:44 -07:00

46 lines
1.6 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# This file is temporarily needed to allow the conversion from integrated
# Sahara content in Horizon to plugin based content. Horizon currently defines
# the same module name data_processing and imports it by default. This utility
# removes the configuration files that are responsible for importing the old
# version of the module. Only Sahara content configuration files are effected
# in Horizon.
import os
from openstack_dashboard import enabled as local_enabled
from sahara_dashboard import enabled
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
WITH_VENV = os.path.join(ROOT, 'tools', 'with_venv.sh')
def main():
src_path = os.path.dirname(enabled.__file__)
dest_path = os.path.dirname(local_enabled.__file__)
src_files = os.listdir(src_path)
for file in src_files:
# skip the __init__.py or bad things happen
if file == "__init__.py":
continue
file_path = os.path.join(dest_path, file)
if os.path.isfile(file_path):
print ("removing ", file_path)
os.remove(file_path)
if __name__ == '__main__':
main()