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
This commit is contained in:
Felipe Reyes 2018-11-07 18:48:26 -03:00
parent 245a55fd12
commit 41a046ba82
1 changed files with 13 additions and 0 deletions

View File

@ -14,8 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
_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,
)