From 0353df7e28a5b2eb76098d7b3d3467ca5be40089 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Thu, 8 Nov 2018 10:43:42 +0000 Subject: [PATCH] Remove redundant path change and fix relative path change Although this charm is rooted in 'hooks' (which is probably an error), the actions were still using relative to root sys.path changes. This makes them absolute, which helps to tidy the path. The charm should be change to be rooted in the charm dir, and that requires more significant changes to the unit tests. Change-Id: I972f0a72a31ef313828a785ae1e30e0ecad427a6 --- actions/actions.py | 2 -- actions/openstack_upgrade.py | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/actions/actions.py b/actions/actions.py index 91bc06bc..ad491cb4 100755 --- a/actions/actions.py +++ b/actions/actions.py @@ -33,8 +33,6 @@ _add_path(_hooks) from charmhelpers.core.hookenv import action_fail -sys.path.append('hooks/') - from glance_utils import ( pause_unit_helper, resume_unit_helper, diff --git a/actions/openstack_upgrade.py b/actions/openstack_upgrade.py index fc155d18..599146bd 100755 --- a/actions/openstack_upgrade.py +++ b/actions/openstack_upgrade.py @@ -19,6 +19,7 @@ import sys _path = os.path.dirname(os.path.realpath(__file__)) _parent = os.path.abspath(os.path.join(_path, "..")) +_hooks = os.path.abspath(os.path.join(_parent, "hooks")) def _add_path(path): @@ -27,14 +28,13 @@ def _add_path(path): _add_path(_parent) +_add_path(_hooks) from charmhelpers.contrib.openstack.utils import ( do_action_openstack_upgrade, ) -sys.path.append('hooks/') - from glance_relations import ( config_changed, CONFIGS