prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  set_fact skipping
  The following code works under ansible 1.9 but fails on the latest devel checkout. It runs the same rules, but skips the set_fact command.
  
  ```
  - name: Set zookeeper ID facts
    gather_facts: True
    hosts: zookeeper
    user: username
    sudo: True
    tasks:
      - set_fact: zkid={{ item.0 | int + 1 }}
        when: hostvars[item.1]['ansible_hostname'] == ansible_hostname
        with_indexed_items: groups['zookeeper']
  ```
  
  This assigns a unique id to each zookeeper instance dynamically.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `lib/ansible/executor/task_result.py`
  Content:
  ```
  1 # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
  2 #
  3 # This file is part of Ansible
  4 #
  5 # Ansible is free software: you can redistribute it and/or modify
  6 # it under the terms of the GNU General Public License as published by
  7 # the Free Software Foundation, either version 3 of the License, or
  8 # (at your option) any later version.
  9 #
  10 # Ansible is distributed in the hope that it will be useful,
  11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 # GNU General Public License for more details.
  14 #
  15 # You should have received a copy of the GNU General Public License
  16 # along with Ansible.  If not, see <http://www.gnu.org/licenses/>.
  17 
  18 # Make coding more python3-ish
  19 from __future__ import (absolute_import, division, print_function)
  20 __metaclass__ = type
  21 
  22 from ansible.parsing import DataLoader
  23 
  24 class TaskResult:
  25     '''
  26     This class is responsible for interpretting the resulting data
  27     from an executed task, and provides helper methods for determining
  28     the result of a given task.
  29     '''
  30 
  31     def __init__(self, host, task, return_data):
  32         self._host = host
  33         self._task = task
  34         if isinstance(return_data, dict):
  35             self._result = return_data.copy()
  36         else:
  37             self._result = DataLoader().load(return_data)
  38 
  39     def is_changed(self):
  40         return self._check_key('changed')
  41 
  42     def is_skipped(self):
  43         return self._check_key('skipped')
  44 
  45     def is_failed(self):
  46         if 'failed_when_result' in self._result or \
  47            'results' in self._result and True in [True for x in self._result['results'] if 'failed_when_result' in x]:
  48             return self._check_key('failed_when_result')
  49         else:
  50             return self._check_key('failed') or self._result.get('rc', 0) != 0
  51 
  52     def is_unreachable(self):
  53         return self._check_key('unreachable')
  54 
  55     def _check_key(self, key):
  56         if 'results' in self._result:
  57             flag = False
  58             for res in self._result.get('results', []):
  59                 if isinstance(res, dict):
  60                     flag |= res.get(key, False)
  61             return flag
  62         else:
  63             return self._result.get(key, False)
  64
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/lib/ansible/executor/task_result.py b/lib/ansible/executor/task_result.py
  --- a/lib/ansible/executor/task_result.py
  +++ b/lib/ansible/executor/task_result.py
  @@ -40,7 +40,14 @@
           return self._check_key('changed')
   
       def is_skipped(self):
  -        return self._check_key('skipped')
  +        if 'results' in self._result:
  +            flag = True
  +            for res in self._result.get('results', []):
  +                if isinstance(res, dict):
  +                    flag &= res.get('skipped', False)
  +            return flag
  +        else:
  +            return self._result.get('skipped', False)
   
       def is_failed(self):
           if 'failed_when_result' in self._result or \
  
verification_info: {"golden_diff": "diff --git a/lib/ansible/executor/task_result.py b/lib/ansible/executor/task_result.py\n--- a/lib/ansible/executor/task_result.py\n+++ b/lib/ansible/executor/task_result.py\n@@ -40,7 +40,14 @@\n         return self._check_key('changed')\n \n     def is_skipped(self):\n-        return self._check_key('skipped')\n+        if 'results' in self._result:\n+            flag = True\n+            for res in self._result.get('results', []):\n+                if isinstance(res, dict):\n+                    flag &= res.get('skipped', False)\n+            return flag\n+        else:\n+            return self._result.get('skipped', False)\n \n     def is_failed(self):\n         if 'failed_when_result' in self._result or \\\n", "issue": "set_fact skipping\nThe following code works under ansible 1.9 but fails on the latest devel checkout. It runs the same rules, but skips the set_fact command.\n\n```\n- name: Set zookeeper ID facts\n  gather_facts: True\n  hosts: zookeeper\n  user: username\n  sudo: True\n  tasks:\n    - set_fact: zkid={{ item.0 | int + 1 }}\n      when: hostvars[item.1]['ansible_hostname'] == ansible_hostname\n      with_indexed_items: groups['zookeeper']\n```\n\nThis assigns a unique id to each zookeeper instance dynamically.\n\n", "before_files": [{"content": "# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# Ansible is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.\n\n# Make coding more python3-ish\nfrom __future__ import (absolute_import, division, print_function)\n__metaclass__ = type\n\nfrom ansible.parsing import DataLoader\n\nclass TaskResult:\n    '''\n    This class is responsible for interpretting the resulting data\n    from an executed task, and provides helper methods for determining\n    the result of a given task.\n    '''\n\n    def __init__(self, host, task, return_data):\n        self._host = host\n        self._task = task\n        if isinstance(return_data, dict):\n            self._result = return_data.copy()\n        else:\n            self._result = DataLoader().load(return_data)\n\n    def is_changed(self):\n        return self._check_key('changed')\n\n    def is_skipped(self):\n        return self._check_key('skipped')\n\n    def is_failed(self):\n        if 'failed_when_result' in self._result or \\\n           'results' in self._result and True in [True for x in self._result['results'] if 'failed_when_result' in x]:\n            return self._check_key('failed_when_result')\n        else:\n            return self._check_key('failed') or self._result.get('rc', 0) != 0\n\n    def is_unreachable(self):\n        return self._check_key('unreachable')\n\n    def _check_key(self, key):\n        if 'results' in self._result:\n            flag = False\n            for res in self._result.get('results', []):\n                if isinstance(res, dict):\n                    flag |= res.get(key, False)\n            return flag\n        else:\n            return self._result.get(key, False)\n", "path": "lib/ansible/executor/task_result.py"}], "after_files": [{"content": "# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# Ansible is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.\n\n# Make coding more python3-ish\nfrom __future__ import (absolute_import, division, print_function)\n__metaclass__ = type\n\nfrom ansible.parsing import DataLoader\n\nclass TaskResult:\n    '''\n    This class is responsible for interpretting the resulting data\n    from an executed task, and provides helper methods for determining\n    the result of a given task.\n    '''\n\n    def __init__(self, host, task, return_data):\n        self._host = host\n        self._task = task\n        if isinstance(return_data, dict):\n            self._result = return_data.copy()\n        else:\n            self._result = DataLoader().load(return_data)\n\n    def is_changed(self):\n        return self._check_key('changed')\n\n    def is_skipped(self):\n        if 'results' in self._result:\n            flag = True\n            for res in self._result.get('results', []):\n                if isinstance(res, dict):\n                    flag &= res.get('skipped', False)\n            return flag\n        else:\n            return self._result.get('skipped', False)\n\n    def is_failed(self):\n        if 'failed_when_result' in self._result or \\\n           'results' in self._result and True in [True for x in self._result['results'] if 'failed_when_result' in x]:\n            return self._check_key('failed_when_result')\n        else:\n            return self._check_key('failed') or self._result.get('rc', 0) != 0\n\n    def is_unreachable(self):\n        return self._check_key('unreachable')\n\n    def _check_key(self, key):\n        if 'results' in self._result:\n            flag = False\n            for res in self._result.get('results', []):\n                if isinstance(res, dict):\n                    flag |= res.get(key, False)\n            return flag\n        else:\n            return self._result.get(key, False)\n", "path": "lib/ansible/executor/task_result.py"}]}