Revert commits related to delegated facts changes (#70272)

* Revert "Fix storing delegate_to facts (#70231)"

This reverts commit 88bb76f248.

* Revert "Fix storing local task_vars facts for the retry (#70171)"

This reverts commit eaf6086eea.
This commit is contained in:
Sam Doran 2020-06-24 15:36:51 -04:00 committed by GitHub
parent 2531d54880
commit a3c1ea886f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 33 deletions

View file

@ -1,2 +0,0 @@
bugfixes:
- "Fix ``delegate_facts: true`` when ``ansible_python_interpreter`` is not set. (https://github.com/ansible/ansible/issues/70168)"

View file

@ -160,7 +160,7 @@ class ActionBase(with_metaclass(ABCMeta, object)):
'''
if task_vars is None:
task_vars = {}
use_vars = dict()
if self._task.delegate_to:
use_vars = task_vars.get('ansible_delegated_vars')[self._task.delegate_to]
@ -242,22 +242,18 @@ class ActionBase(with_metaclass(ABCMeta, object)):
# we'll propagate back to the controller in the task result
discovered_key = 'discovered_interpreter_%s' % idre.interpreter_name
# update the local vars copy for the retry
if use_vars.get('ansible_facts') is None:
use_vars['ansible_facts'] = {}
use_vars['ansible_facts'][discovered_key] = self._discovered_interpreter
# TODO: this condition prevents 'wrong host' from being updated
# but in future we would want to be able to update 'delegated host facts'
# irrespective of task settings
if not self._task.delegate_to or self._task.delegate_facts:
# store in local task_vars facts collection for the retry and any other usages in this worker
if task_vars.get('ansible_facts') is None:
if use_vars.get('ansible_facts') is None:
task_vars['ansible_facts'] = {}
task_vars['ansible_facts'][discovered_key] = self._discovered_interpreter
# preserve this so _execute_module can propagate back to controller as a fact
self._discovered_interpreter_key = discovered_key
else:
task_vars['ansible_delegated_vars'][self._task.delegate_to]
if task_vars['ansible_delegated_vars'][self._task.delegate_to].get('ansible_facts') is None:
task_vars['ansible_delegated_vars'][self._task.delegate_to]['ansible_facts'] = {}
task_vars['ansible_delegated_vars'][self._task.delegate_to]['ansible_facts'][discovered_key] = self._discovered_interpreter

View file

@ -2,4 +2,3 @@ shippable/posix/group3
needs/ssh
needs/root # only on macOS and FreeBSD to configure network interfaces
skip/aix
non_local # workaround to allow override of ansible_python_interpreter; disables coverage on this integration target

View file

@ -70,8 +70,3 @@ ln -s python secondpython
)
ansible-playbook verify_interpreter.yml -i inventory_interpreters -v "$@"
ansible-playbook discovery_applied.yml -i inventory -v "$@"
# https://github.com/ansible/ansible/issues/70168
ansible-playbook verify_interpreter_delegate_facts.yml -i inventory -v "$@"
ansible-playbook verify_interpreter_auto_delegate_to.yml -i inventory -v "$@"

View file

@ -1,7 +0,0 @@
- hosts: testhost
gather_facts: no
tasks:
- detect_interpreter:
delegate_to: testhost3
vars:
ansible_python_interpreter: auto

View file

@ -1,11 +0,0 @@
- hosts: testhost
gather_facts: yes
tasks:
- detect_interpreter:
delegate_to: "{{ item }}"
delegate_facts: yes
vars:
ansible_python_interpreter: auto
loop:
- testhost3
- testhost4