~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk

« back to all changes in this revision

Viewing changes to hooks/common.py

  • Committer: Cory Johns
  • Date: 2015-06-25 18:53:49 UTC
  • mto: This revision was merged to the branch mainline in revision 109.
  • Revision ID: cory.johns@canonical.com-20150625185349-koq8pht04dyncmxm
Use venv for plugin to avoid conflicts with parent charm

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
 
1
#!.venv/bin/python
2
2
# Licensed under the Apache License, Version 2.0 (the "License");
3
3
# you may not use this file except in compliance with the License.
4
4
# You may obtain a copy of the License at
14
14
Common implementation for all hooks.
15
15
"""
16
16
 
 
17
import os
17
18
import jujuresources
18
19
from charmhelpers.core import hookenv
19
20
from charmhelpers.core import unitdata
20
21
from charmhelpers.core import charmframework
21
22
 
22
23
 
 
24
# ensure that the venv is used for installing resources
 
25
# (venv is used to ensure library versions needed by plugin
 
26
# don't conflict with the charm the plugin is supporting)
 
27
os.environ['PATH'] = os.pathsep.join([
 
28
    os.path.join(hookenv.charm_dir(), '.venv/bin'),
 
29
    os.environ['PATH']])
 
30
 
 
31
 
23
32
def bootstrap_resources():
24
33
    """
25
34
    Install required resources defined in resources.yaml