From 58320a49b13778d87d217932aa5e11d4f70b05c0 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 20 Feb 2018 13:54:30 -0800 Subject: [PATCH] Correct hyphenation in host/group vars All Zuul attributes use '-' not '_'. Change-Id: I6e845195f0e347775db59f2c2d31782c39f3c0c0 --- doc/source/user/config.rst | 8 ++++---- zuul/configloader.py | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/source/user/config.rst b/doc/source/user/config.rst index 0932c5698b..36cd68c388 100644 --- a/doc/source/user/config.rst +++ b/doc/source/user/config.rst @@ -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" diff --git a/zuul/configloader.py b/zuul/configloader.py index 3511f96927..60c335c85a 100644 --- a/zuul/configloader.py +++ b/zuul/configloader.py @@ -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: