Bug 1456234: [mozharness] Process EXTRA_MOZHARNESS_CONFIG even if no files are specified; r=aki

This will allow mozharness configs to be specified exclusively in the taskgraph.

Differential Revision: https://phabricator.services.mozilla.com/D1017

--HG--
extra : rebase_source : a3a9b6cc9d1004c4bd396fccc3e4354a7316651d
extra : source : 10acd193df92b7c495789dc24157b85f116ade5e
This commit is contained in:
Tom Prince 2018-04-23 17:39:35 -06:00
Родитель 9acb0f48fc
Коммит 9203ed3c58
2 изменённых файлов: 33 добавлений и 31 удалений

Просмотреть файл

@ -53,7 +53,7 @@ fi
# test required parameters are supplied
if [[ -z ${MOZHARNESS_SCRIPT} ]]; then fail "MOZHARNESS_SCRIPT is not set"; fi
if [[ -z ${MOZHARNESS_CONFIG} ]]; then fail "MOZHARNESS_CONFIG is not set"; fi
if [[ -z "${MOZHARNESS_CONFIG}" && -z "${EXTRA_MOZHARNESS_CONFIG}" ]]; then fail "MOZHARNESS_CONFIG or EXTRA_MOZHARNESS_CONFIG is not set"; fi
# run XVfb in the background, if necessary
if $NEED_XVFB; then

Просмотреть файл

@ -285,8 +285,9 @@ class BaseConfig(object):
type="string", help="Specify additional paths to search for config files.",
)
self.config_parser.add_option(
"-c", "--config-file", "--cfg", action="extend", dest="config_files",
type="string", help="Specify a config file; can be repeated"
"-c", "--config-file", "--cfg", action="extend",
dest="config_files", default=[], type="string",
help="Specify a config file; can be repeated",
)
self.config_parser.add_option(
"-C", "--opt-config-file", "--opt-cfg", action="extend",
@ -489,35 +490,36 @@ class BaseConfig(object):
self.list_actions()
print("Required config file not set! (use --config-file option)")
raise SystemExit(-1)
# this is what get_cfgs_from_files returns. It will represent each
# config file name and its assoctiated dict
# eg ('builds/branch_specifics.py', {'foo': 'bar'})
# let's store this to self for things like --interpret-config-files
self.all_cfg_files_and_dicts.extend(self.get_cfgs_from_files(
# append opt_config to allow them to overwrite previous configs
options.config_files + options.opt_config_files, options=options
))
config = {}
if (self.append_env_variables_from_configs
or options.append_env_variables_from_configs):
# We only append values from various configs for the 'env' entry
# For everything else we follow the standard behaviour
for i, (c_file, c_dict) in enumerate(self.all_cfg_files_and_dicts):
for v in c_dict.keys():
if v == 'env' and v in config:
config[v].update(c_dict[v])
else:
config[v] = c_dict[v]
else:
# this is what get_cfgs_from_files returns. It will represent each
# config file name and its assoctiated dict
# eg ('builds/branch_specifics.py', {'foo': 'bar'})
# let's store this to self for things like --interpret-config-files
self.all_cfg_files_and_dicts.extend(self.get_cfgs_from_files(
# append opt_config to allow them to overwrite previous configs
options.config_files + options.opt_config_files, options=options
))
config = {}
if (self.append_env_variables_from_configs
or options.append_env_variables_from_configs):
# We only append values from various configs for the 'env' entry
# For everything else we follow the standard behaviour
for i, (c_file, c_dict) in enumerate(self.all_cfg_files_and_dicts):
for v in c_dict.keys():
if v == 'env' and v in config:
config[v].update(c_dict[v])
else:
config[v] = c_dict[v]
else:
for i, (c_file, c_dict) in enumerate(self.all_cfg_files_and_dicts):
config.update(c_dict)
# assign or update self._config depending on if it exists or not
# NOTE self._config will be passed to ReadOnlyConfig's init -- a
# dict subclass with immutable locking capabilities -- and serve
# as the keys/values that make up that instance. Ultimately,
# this becomes self.config during BaseScript's init
self.set_config(config)
for i, (c_file, c_dict) in enumerate(self.all_cfg_files_and_dicts):
config.update(c_dict)
# assign or update self._config depending on if it exists or not
# NOTE self._config will be passed to ReadOnlyConfig's init -- a
# dict subclass with immutable locking capabilities -- and serve
# as the keys/values that make up that instance. Ultimately,
# this becomes self.config during BaseScript's init
self.set_config(config)
for key in defaults.keys():
value = getattr(options, key)
if value is None: