From e59b3646416942504c4392a3eaf4f8859d1187e8 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 24 Feb 2015 05:05:27 -0500 Subject: [PATCH 1/6] changed from hash_merge to combine vars which resets default to overwrite and not merge hashing --- lib/ansible/runner/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 79a167c5a0..7a693cc8d0 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -674,11 +674,11 @@ class Runner(object): # Then we selectively merge some variable dictionaries down to a # single dictionary, used to template the HostVars for this host temp_vars = self.inventory.get_variables(host, vault_password=self.vault_pass) - temp_vars = utils.merge_hash(temp_vars, inject['combined_cache']) - temp_vars = utils.merge_hash(temp_vars, self.play_vars) - temp_vars = utils.merge_hash(temp_vars, self.play_file_vars) - temp_vars = utils.merge_hash(temp_vars, self.extra_vars) - temp_vars = utils.merge_hash(temp_vars, {'groups': inject['groups']}) + temp_vars = utils.combine_vars(temp_vars, inject['combined_cache']) + temp_vars = utils.combine_vars(temp_vars, self.play_vars) + temp_vars = utils.combine_vars(temp_vars, self.play_file_vars) + temp_vars = utils.combine_vars(temp_vars, self.extra_vars) + temp_vars = utils.combine_vars(temp_vars, {'groups': inject['groups']}) hostvars = HostVars(temp_vars, self.inventory, vault_password=self.vault_pass) From ce764063f14fdd1a664002e2dad02c10eec24f59 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 24 Feb 2015 05:14:22 -0500 Subject: [PATCH 2/6] corrected merge vs combined in all pertinent sections --- lib/ansible/playbook/play.py | 10 +++++----- lib/ansible/runner/__init__.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 8d81424f09..47bfd79b0b 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -115,8 +115,8 @@ class Play(object): _tasks = ds.pop('tasks', []) _handlers = ds.pop('handlers', []) - temp_vars = utils.merge_hash(self.vars, self.vars_file_vars) - temp_vars = utils.merge_hash(temp_vars, self.playbook.extra_vars) + temp_vars = utils.combine_vars(self.vars, self.vars_file_vars) + temp_vars = utils.combine_vars(temp_vars, self.playbook.extra_vars) ds = template(basedir, ds, temp_vars) ds['tasks'] = _tasks @@ -632,9 +632,9 @@ class Play(object): dirname = os.path.dirname(original_file) # temp vars are used here to avoid trampling on the existing vars structures - temp_vars = utils.merge_hash(self.vars, self.vars_file_vars) - temp_vars = utils.merge_hash(temp_vars, mv) - temp_vars = utils.merge_hash(temp_vars, self.playbook.extra_vars) + temp_vars = utils.combine_vars(self.vars, self.vars_file_vars) + temp_vars = utils.combine_vars(temp_vars, mv) + temp_vars = utils.combine_Vars(temp_vars, self.playbook.extra_vars) include_file = template(dirname, tokens[0], temp_vars) include_filename = utils.path_dwim(dirname, include_file) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 7a693cc8d0..15845c6929 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -608,7 +608,7 @@ class Runner(object): def get_combined_cache(self): # merge the VARS and SETUP caches for this host combined_cache = self.setup_cache.copy() - return utils.merge_hash(combined_cache, self.vars_cache) + return utils.combine_vars(combined_cache, self.vars_cache) def get_inject_vars(self, host): host_variables = self.inventory.get_variables(host, vault_password=self.vault_pass) From 4fa51652b42854f7646f3f176486f676d7b78e7c Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 24 Feb 2015 05:26:41 -0500 Subject: [PATCH 3/6] fixed typoe in combined_Vars --- lib/ansible/playbook/play.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 47bfd79b0b..bb77506dd1 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -634,7 +634,7 @@ class Play(object): # temp vars are used here to avoid trampling on the existing vars structures temp_vars = utils.combine_vars(self.vars, self.vars_file_vars) temp_vars = utils.combine_vars(temp_vars, mv) - temp_vars = utils.combine_Vars(temp_vars, self.playbook.extra_vars) + temp_vars = utils.combine_vars(temp_vars, self.playbook.extra_vars) include_file = template(dirname, tokens[0], temp_vars) include_filename = utils.path_dwim(dirname, include_file) From 5453e2cbb8be6aa1f0036659d3e66cab54090532 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 9 Mar 2015 10:27:59 -0400 Subject: [PATCH 4/6] removed redundant inventory call, moved grousp to proper priority --- lib/ansible/runner/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 15845c6929..69c062e205 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -673,12 +673,11 @@ class Runner(object): # Then we selectively merge some variable dictionaries down to a # single dictionary, used to template the HostVars for this host - temp_vars = self.inventory.get_variables(host, vault_password=self.vault_pass) - temp_vars = utils.combine_vars(temp_vars, inject['combined_cache']) + temp_vars = inject['combined_cache'] + temp_vars = utils.combine_vars(temp_vars, {'groups': inject['groups']}) temp_vars = utils.combine_vars(temp_vars, self.play_vars) temp_vars = utils.combine_vars(temp_vars, self.play_file_vars) temp_vars = utils.combine_vars(temp_vars, self.extra_vars) - temp_vars = utils.combine_vars(temp_vars, {'groups': inject['groups']}) hostvars = HostVars(temp_vars, self.inventory, vault_password=self.vault_pass) From 642d9d6b563837ae5187720444c76abc152fb49c Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 9 Mar 2015 12:12:37 -0400 Subject: [PATCH 5/6] readded inventory vars to runner's vars --- lib/ansible/runner/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 69c062e205..c1f5b3683c 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -608,7 +608,7 @@ class Runner(object): def get_combined_cache(self): # merge the VARS and SETUP caches for this host combined_cache = self.setup_cache.copy() - return utils.combine_vars(combined_cache, self.vars_cache) + return utils.merge_hash(combined_cache, self.vars_cache) def get_inject_vars(self, host): host_variables = self.inventory.get_variables(host, vault_password=self.vault_pass) @@ -674,6 +674,7 @@ class Runner(object): # Then we selectively merge some variable dictionaries down to a # single dictionary, used to template the HostVars for this host temp_vars = inject['combined_cache'] + temp_vars = utils.combine_vars(temp_vars, inject['combined_cache'] ) temp_vars = utils.combine_vars(temp_vars, {'groups': inject['groups']}) temp_vars = utils.combine_vars(temp_vars, self.play_vars) temp_vars = utils.combine_vars(temp_vars, self.play_file_vars) From d244390064a037dd82a71ee5d98731893e4cd33e Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 9 Mar 2015 12:15:41 -0400 Subject: [PATCH 6/6] correclty added inventory this time --- lib/ansible/runner/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index c1f5b3683c..52e530ac65 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -673,7 +673,7 @@ class Runner(object): # Then we selectively merge some variable dictionaries down to a # single dictionary, used to template the HostVars for this host - temp_vars = inject['combined_cache'] + temp_vars = self.inventory.get_variables(host, vault_password=self.vault_pass) temp_vars = utils.combine_vars(temp_vars, inject['combined_cache'] ) temp_vars = utils.combine_vars(temp_vars, {'groups': inject['groups']}) temp_vars = utils.combine_vars(temp_vars, self.play_vars)