Load deployer input file automatically
This patch add the load of deployer-input automatically, if exists in default path (~/tempest-deployer-input.conf). It also add the option to not load it, with --no-default-deployer This will fix the cases that user miss to add --deployer-input and tempestconf miss some configuration due of that. Change-Id: I17ce46bac06158dd3cca298f33c6ea929051fb06
This commit is contained in:
parent
1e3caa063c
commit
42ba94a164
@ -21,6 +21,8 @@ LOG = logging.getLogger(__name__)
|
|||||||
# Get the current tempest workspace path
|
# Get the current tempest workspace path
|
||||||
TEMPEST_WORKSPACE = os.getcwd()
|
TEMPEST_WORKSPACE = os.getcwd()
|
||||||
|
|
||||||
|
DEPLOYER_INPUT = os.path.join(os.path.expanduser("~"),
|
||||||
|
"tempest-deployer-input.conf")
|
||||||
DEFAULTS_FILE = os.path.join(TEMPEST_WORKSPACE, "etc",
|
DEFAULTS_FILE = os.path.join(TEMPEST_WORKSPACE, "etc",
|
||||||
"default-overrides.conf")
|
"default-overrides.conf")
|
||||||
DEFAULT_IMAGE = ("http://download.cirros-cloud.net/0.3.5/"
|
DEFAULT_IMAGE = ("http://download.cirros-cloud.net/0.3.5/"
|
||||||
|
@ -123,13 +123,16 @@ def read_deployer_input(deployer_input_file, conf):
|
|||||||
|
|
||||||
|
|
||||||
def set_options(conf, deployer_input, non_admin, overrides=[],
|
def set_options(conf, deployer_input, non_admin, overrides=[],
|
||||||
test_accounts=None, cloud_creds=None):
|
test_accounts=None, cloud_creds=None,
|
||||||
|
no_default_deployer=False):
|
||||||
"""Set options in conf provided by different source.
|
"""Set options in conf provided by different source.
|
||||||
|
|
||||||
1. read the default values in default-overrides file
|
1. read the default values in default-overrides file
|
||||||
2. read a file provided by --deployer-input argument
|
2. read a file provided by --deployer-input argument
|
||||||
3. set values from client's config (os-client-config support) if provided
|
3. read default DEPLOYER_INPUT if --no-deployer-input is False and no
|
||||||
4. set overrides - may override values which were set in the steps above
|
deployer_input was passed
|
||||||
|
4. set values from client's config (os-client-config support) if provided
|
||||||
|
5. set overrides - may override values which were set in the steps above
|
||||||
|
|
||||||
:param conf: TempestConf object
|
:param conf: TempestConf object
|
||||||
:param deployer_input: Path to the deployer inut file
|
:param deployer_input: Path to the deployer inut file
|
||||||
@ -149,7 +152,13 @@ def set_options(conf, deployer_input, non_admin, overrides=[],
|
|||||||
load_basic_defaults(conf)
|
load_basic_defaults(conf)
|
||||||
|
|
||||||
if deployer_input and os.path.isfile(deployer_input):
|
if deployer_input and os.path.isfile(deployer_input):
|
||||||
|
LOG.info("Reading deployer input from file {}".format(
|
||||||
|
deployer_input))
|
||||||
read_deployer_input(deployer_input, conf)
|
read_deployer_input(deployer_input, conf)
|
||||||
|
elif os.path.isfile(C.DEPLOYER_INPUT) and not no_default_deployer:
|
||||||
|
LOG.info("Reading deployer input from file {}".format(
|
||||||
|
C.DEPLOYER_INPUT))
|
||||||
|
read_deployer_input(C.DEPLOYER_INPUT, conf)
|
||||||
|
|
||||||
if non_admin:
|
if non_admin:
|
||||||
# non admin, so delete auth admin values which were set
|
# non admin, so delete auth admin values which were set
|
||||||
@ -207,6 +216,11 @@ def get_arg_parser():
|
|||||||
key/value pairs they will be applied after the
|
key/value pairs they will be applied after the
|
||||||
deployer-input file.
|
deployer-input file.
|
||||||
""")
|
""")
|
||||||
|
parser.add_argument('--no-default-deployer', action='store_true',
|
||||||
|
default=False,
|
||||||
|
help="""Do not check for the default deployer input in
|
||||||
|
$home/tempest-deployer-input.conf
|
||||||
|
""")
|
||||||
parser.add_argument('overrides', nargs='*', default=[],
|
parser.add_argument('overrides', nargs='*', default=[],
|
||||||
help="""key value pairs to modify. The key is
|
help="""key value pairs to modify. The key is
|
||||||
section.key where section is a section header
|
section.key where section is a section header
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The deployer-input file will be loaded automatically if exists in the
|
||||||
|
default path, which is ~/tempest-deployer-input.conf.
|
||||||
|
This will fix the cases that user forgot to add --deployer-input and
|
||||||
|
python-tempestconf forgot some configuration due of that.
|
||||||
|
Also a new argument (--no-default-deployer) is added, which will make
|
||||||
|
python-tempestconf not to load the file automatically.
|
Loading…
x
Reference in New Issue
Block a user