Add charm's directory to syspath

charmhelpers lives in the charm dir and it needs to be added to the
syspath to allow the openstack-upgrade action find it. This wasn't
needed until commit b45cd2ae removed the symlink that was left in the
hooks/ directory for backward compatibility purposes.

Change-Id: I7be5d16359aa6c78c9241990c3d3b8bab4910538
Closes-Bug: 1802182
(cherry picked from commit 41a046ba82)
This commit is contained in:
Felipe Reyes 2018-11-07 18:48:26 -03:00 committed by Ryan Beisner
parent a297f8afc1
commit 67c9cdf204
1 changed files with 12 additions and 0 deletions

View File

@ -31,6 +31,18 @@ _add_path(_parent)
_add_path(_hooks)
_path = os.path.dirname(os.path.realpath(__file__))
_parent = os.path.abspath(os.path.join(_path, ".."))
def _add_path(path):
if path not in sys.path:
sys.path.insert(1, path)
_add_path(_parent)
from charmhelpers.contrib.openstack.utils import (
do_action_openstack_upgrade,
)