CLI: add --verbose and --extra-args
The --extra-args argument allows passing arbitrary arguments to DIB. Change-Id: I26be362263c08ea5cfe3bd265372ff5ab406d85c
This commit is contained in:
parent
f6bf7b97d5
commit
07d27a573e
@ -12,6 +12,7 @@
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
@ -50,6 +51,10 @@ def main():
|
||||
parser.add_argument("-b", "--branch",
|
||||
help="If set, override the branch that is used for "
|
||||
"ironic-python-agent and requirements")
|
||||
parser.add_argument("-v", "--verbose", action='store_true',
|
||||
help="Enable verbose logging in diskimage-builder")
|
||||
parser.add_argument("--extra-args",
|
||||
help="Extra arguments to pass to diskimage-builder")
|
||||
# TODO(dtantsur): handle distribution == tinyipa
|
||||
os.environ['ELEMENTS_PATH'] = find_elements_path()
|
||||
if not os.environ.get('DIB_INSTALLTYPE_pip_and_virtualenv'):
|
||||
@ -63,10 +68,13 @@ def main():
|
||||
if args.branch:
|
||||
os.environ['DIB_REPOREF_ironic_python_agent'] = args.branch
|
||||
os.environ['DIB_REPOREF_requirements'] = args.branch
|
||||
extra_args = shlex.split(args.extra_args) if args.extra_args else []
|
||||
if args.verbose:
|
||||
extra_args.append("-x")
|
||||
try:
|
||||
subprocess.check_call(['disk-image-create', '-o', args.output,
|
||||
'ironic-python-agent-ramdisk',
|
||||
args.distribution] + args.element)
|
||||
args.distribution] + args.element + extra_args)
|
||||
except (EnvironmentError, subprocess.CalledProcessError) as exc:
|
||||
sys.exit(str(exc))
|
||||
except KeyboardInterrupt:
|
||||
|
@ -5,3 +5,4 @@ ipa_source_path: '{{ ansible_user_dir }}/src/opendev.org/openstack/ironic-python
|
||||
requirements_path: '{{ ansible_user_dir }}/src/opendev.org/openstack/requirements'
|
||||
ipa_raw_dir: '{{ ansible_user_dir }}/src/opendev.org/openstack/ironic-python-agent/UPLOAD_RAW'
|
||||
ipa_tar_dir: '{{ ansible_user_dir }}/src/opendev.org/openstack/ironic-python-agent/UPLOAD_TAR'
|
||||
dib_extra_args:
|
||||
|
@ -4,8 +4,9 @@
|
||||
|
||||
- name: Build a DIB image
|
||||
command: |
|
||||
ironic-python-agent-builder -o {{ image_name }} -b HEAD
|
||||
ironic-python-agent-builder -o {{ image_name }} -b HEAD -v
|
||||
{{ "-r {}".format(image_release) if image_release else '' }}
|
||||
{{ "--extra-args '{}'".format(dib_extra_args) if dib_extra_args else '' }}
|
||||
{{ image_distro }}
|
||||
environment:
|
||||
# Increase from the default value of 30
|
||||
|
Loading…
Reference in New Issue
Block a user