aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin André <m.andre@redhat.com>2016-09-02 09:56:56 +0200
committerMartin André <m.andre@redhat.com>2016-10-14 17:01:36 +0200
commit9660b5786484172bd42c7fac332aa500fdc1790f (patch)
tree90aa30492454c5830b7d12f2c7b7d968ed963ed2
parentb53988a08875309d531d1e17128e7a37fca3049a (diff)
downloadkolla-9660b5786484172bd42c7fac332aa500fdc1790f.tar.gz
kolla-9660b5786484172bd42c7fac332aa500fdc1790f.zip
Consistently set sys path when using local tools
Consistently set the search path to prefer PROJECT_ROOT as the source of packages to import if we are using local tools instead of pip installed kolla tools. TrivialFix Change-Id: Idd1d98bb82a8f1ddb32d1bdb23f346b461534b9f
-rwxr-xr-xkolla/cmd/build.py3
-rwxr-xr-xkolla/cmd/genpwd.py9
-rw-r--r--kolla/image/build.py8
-rwxr-xr-xtools/version-check.py7
4 files changed, 18 insertions, 9 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py
index d0d6ab7d9..4674de762 100755
--- a/kolla/cmd/build.py
+++ b/kolla/cmd/build.py
@@ -15,6 +15,9 @@
import os
import sys
+# NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source
+# of packages to import if we are using local tools instead of
+# pip installed kolla tools
PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), '../..'))
if PROJECT_ROOT not in sys.path:
diff --git a/kolla/cmd/genpwd.py b/kolla/cmd/genpwd.py
index 288b35036..e548b9ab4 100755
--- a/kolla/cmd/genpwd.py
+++ b/kolla/cmd/genpwd.py
@@ -16,11 +16,20 @@ import argparse
import os
import random
import string
+import sys
import uuid
import yaml
from Crypto.PublicKey import RSA
+# NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source
+# of packages to import if we are using local tools instead of
+# pip installed kolla tools
+PROJECT_ROOT = os.path.abspath(os.path.join(
+ os.path.dirname(os.path.realpath(__file__)), '../..'))
+if PROJECT_ROOT not in sys.path:
+ sys.path.insert(0, PROJECT_ROOT)
+
def generate_RSA(bits=4096):
new_key = RSA.generate(bits, os.urandom)
diff --git a/kolla/image/build.py b/kolla/image/build.py
index 6c8aa857e..8b2a1943d 100644
--- a/kolla/image/build.py
+++ b/kolla/image/build.py
@@ -38,13 +38,11 @@ from oslo_config import cfg
from requests import exceptions as requests_exc
import six
-
+# NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source
+# of packages to import if we are using local tools instead of
+# pip installed kolla tools
PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), '../..'))
-
-# NOTE(SamYaple): Update the search patch to prefer PROJECT_ROOT as the source
-# of packages to import if we are using local tools/build.py
-# instead of pip installed kolla-build tool
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
diff --git a/tools/version-check.py b/tools/version-check.py
index 9477762b0..58aa03e6e 100755
--- a/tools/version-check.py
+++ b/tools/version-check.py
@@ -24,12 +24,11 @@ import pkg_resources
import prettytable
import requests
+# NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source
+# of packages to import if we are using local tools instead of
+# pip installed kolla tools
PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), '..'))
-
-# NOTE(SamYaple): Update the search patch to prefer PROJECT_ROOT as the source
-# of packages to import if we are using local tools/build.py
-# instead of pip installed kolla-build tool
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)