Correct hyphenation in host/group vars

All Zuul attributes use '-' not '_'.

Change-Id: I6e845195f0e347775db59f2c2d31782c39f3c0c0
This commit is contained in:
James E. Blair 2018-02-20 13:54:30 -08:00
parent 3fd13bf78d
commit 58320a49b1
2 changed files with 8 additions and 6 deletions

View File

@ -877,14 +877,14 @@ Here is an example of two job definitions:
same name will override a previously defined variable, but new
variable names will be added to the set of defined variables.
.. attr:: host_vars
.. attr:: host-vars
A dictionary of host variables to supply to Ansible. The keys
of this dictionary are node names as defined in a
:ref:`nodeset`, and the values are dictionaries of variables,
just as in :attr:`job.vars`.
.. attr:: group_vars
.. attr:: group-vars
A dictionary of group variables to supply to Ansible. The keys
of this dictionary are node groups as defined in a
@ -912,10 +912,10 @@ Here is an example of two job definitions:
- api2
vars:
foo: "this variable is visible to all nodes"
host_vars:
host-vars:
controller:
bar: "this variable is visible only on the controller node"
group_vars:
group-vars:
api:
baz: "this variable is visible on api1 and api2"

View File

@ -514,6 +514,8 @@ class JobParser(object):
'vars': dict,
'host_vars': {str: dict},
'group_vars': {str: dict},
'host-vars': {str: dict},
'group-vars': {str: dict},
'dependencies': to_list(str),
'allowed-projects': to_list(str),
'override-branch': str,
@ -748,14 +750,14 @@ class JobParser(object):
raise Exception("Variables named 'zuul' or 'nodepool' "
"are not allowed.")
job.variables = variables
host_variables = conf.get('host_vars', None)
host_variables = conf.get('host-vars', conf.get('host_vars', None))
if host_variables:
for host, hvars in host_variables.items():
if 'zuul' in hvars or 'nodepool' in hvars:
raise Exception("Variables named 'zuul' or 'nodepool' "
"are not allowed.")
job.host_variables = host_variables
group_variables = conf.get('group_vars', None)
group_variables = conf.get('group-vars', conf.get('group_vars', None))
if group_variables:
for group, gvars in group_variables.items():
if 'zuul' in group_variables or 'nodepool' in gvars: