Fix hooks path for all actions
Insert the hooks directory at the beginning of sys.path in order to make it take precedence over other entries, e.g. in the face of conflicting charmhelpers packages. Change-Id: I11e870fff3d590d2ac491292f3f2c68d84a67181 Closes-Bug: 1834254
This commit is contained in:
parent
2169de6fcd
commit
4a4908160d
@ -14,9 +14,19 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
_path = os.path.dirname(os.path.realpath(__file__))
|
||||
_hooks = os.path.abspath(os.path.join(_path, '../hooks'))
|
||||
|
||||
|
||||
def _add_path(path):
|
||||
if path not in sys.path:
|
||||
sys.path.insert(1, path)
|
||||
|
||||
_add_path(_hooks)
|
||||
|
||||
|
||||
import subprocess
|
||||
from charmhelpers.core import hookenv
|
||||
|
@ -14,9 +14,20 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks/')
|
||||
|
||||
_path = os.path.dirname(os.path.realpath(__file__))
|
||||
_hooks = os.path.abspath(os.path.join(_path, '../hooks'))
|
||||
|
||||
|
||||
def _add_path(path):
|
||||
if path not in sys.path:
|
||||
sys.path.insert(1, path)
|
||||
|
||||
_add_path(_hooks)
|
||||
|
||||
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
do_action_openstack_upgrade,
|
||||
|
@ -17,7 +17,16 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
_path = os.path.dirname(os.path.realpath(__file__))
|
||||
_hooks = os.path.abspath(os.path.join(_path, '../hooks'))
|
||||
|
||||
|
||||
def _add_path(path):
|
||||
if path not in sys.path:
|
||||
sys.path.insert(1, path)
|
||||
|
||||
_add_path(_hooks)
|
||||
|
||||
|
||||
from charmhelpers.core.hookenv import action_fail
|
||||
from nova_compute_utils import (
|
||||
|
@ -17,7 +17,17 @@ import configparser
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
_path = os.path.dirname(os.path.realpath(__file__))
|
||||
_hooks = os.path.abspath(os.path.join(_path, '../hooks'))
|
||||
|
||||
|
||||
def _add_path(path):
|
||||
if path not in sys.path:
|
||||
sys.path.insert(1, path)
|
||||
|
||||
_add_path(_hooks)
|
||||
|
||||
|
||||
import charmhelpers.contrib.openstack.audits as audits
|
||||
from charmhelpers.contrib.openstack.audits import (
|
||||
|
Loading…
x
Reference in New Issue
Block a user