Fix ELEMENTS_PATH environment variable being overwritten.
This change let user to explicitly set ELEMENTS_PATH to custom DIB elements while running the script or use already set as environment variable. It will prepend path to 'ironic-python-agent-builder' instead of overwriting it. Change-Id: I7ec6c222e9678d7dbb3f4f50c3a2de0a9c9a5793 Story: 2007309 Task: 38809
This commit is contained in:
parent
ca27668c00
commit
b072c155f5
@ -50,19 +50,27 @@ def main():
|
|||||||
help="Additional DIB element to use")
|
help="Additional DIB element to use")
|
||||||
parser.add_argument("-b", "--branch",
|
parser.add_argument("-b", "--branch",
|
||||||
help="If set, override the branch that is used for "
|
help="If set, override the branch that is used for "
|
||||||
"ironic-python-agent and requirements")
|
"ironic-python-agent and requirements")
|
||||||
parser.add_argument("-v", "--verbose", action='store_true',
|
parser.add_argument("-v", "--verbose", action='store_true',
|
||||||
help="Enable verbose logging in diskimage-builder")
|
help="Enable verbose logging in diskimage-builder")
|
||||||
parser.add_argument("--extra-args",
|
parser.add_argument("--extra-args",
|
||||||
help="Extra arguments to pass to diskimage-builder")
|
help="Extra arguments to pass to diskimage-builder")
|
||||||
|
parser.add_argument("--elements-path",
|
||||||
|
help="Path(s) to custom DIB elements separated by "
|
||||||
|
"a colon")
|
||||||
# TODO(dtantsur): handle distribution == tinyipa
|
# TODO(dtantsur): handle distribution == tinyipa
|
||||||
os.environ['ELEMENTS_PATH'] = find_elements_path()
|
args = parser.parse_args()
|
||||||
|
if args.elements_path:
|
||||||
|
os.environ['ELEMENTS_PATH'] = args.elements_path
|
||||||
|
if 'ELEMENTS_PATH' in os.environ:
|
||||||
|
os.environ['ELEMENTS_PATH'] += ":" + find_elements_path()
|
||||||
|
else:
|
||||||
|
os.environ['ELEMENTS_PATH'] = find_elements_path()
|
||||||
if not os.environ.get('DIB_INSTALLTYPE_pip_and_virtualenv'):
|
if not os.environ.get('DIB_INSTALLTYPE_pip_and_virtualenv'):
|
||||||
# DIB updates these to latest versions from source. However, we do the
|
# DIB updates these to latest versions from source. However, we do the
|
||||||
# same in our virtualenv, so it's not needed and just increases the
|
# same in our virtualenv, so it's not needed and just increases the
|
||||||
# size of the image.
|
# size of the image.
|
||||||
os.environ['DIB_INSTALLTYPE_pip_and_virtualenv'] = 'package'
|
os.environ['DIB_INSTALLTYPE_pip_and_virtualenv'] = 'package'
|
||||||
args = parser.parse_args()
|
|
||||||
if args.release:
|
if args.release:
|
||||||
os.environ['DIB_RELEASE'] = args.release
|
os.environ['DIB_RELEASE'] = args.release
|
||||||
if args.branch:
|
if args.branch:
|
||||||
|
Loading…
Reference in New Issue
Block a user