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
This commit is contained in:
parent
b53988a088
commit
9660b57864
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user