{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5504","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5504/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5504/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5504/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/5504","id":187537235,"number":5504,"title":"Git checkout: UnboundLocalError: local variable 'remote_head' referenced before assignment","user":{"login":"hsanjuan","id":1027022,"avatar_url":"https://avatars.githubusercontent.com/u/1027022?v=3","gravatar_id":"","url":"https://api.github.com/users/hsanjuan","html_url":"https://github.com/hsanjuan","followers_url":"https://api.github.com/users/hsanjuan/followers","following_url":"https://api.github.com/users/hsanjuan/following{/other_user}","gists_url":"https://api.github.com/users/hsanjuan/gists{/gist_id}","starred_url":"https://api.github.com/users/hsanjuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsanjuan/subscriptions","organizations_url":"https://api.github.com/users/hsanjuan/orgs","repos_url":"https://api.github.com/users/hsanjuan/repos","events_url":"https://api.github.com/users/hsanjuan/events{/privacy}","received_events_url":"https://api.github.com/users/hsanjuan/received_events","type":"User","site_admin":false},"labels":[{"id":437720380,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/affects_2.2","name":"affects_2.2","color":"5319e7","default":false},{"id":132571937,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/bug_report","name":"bug_report","color":"fbca04","default":false},{"id":414073372,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/waiting_on_maintainer","name":"waiting_on_maintainer","color":"d93f0b","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":32,"created_at":"2016-11-06T02:24:19Z","updated_at":"2016-12-05T16:22:54Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n\r\n##### COMPONENT NAME\r\ngit\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from “ansible --version” between quotes below -->\r\n```\r\nansible 2.2.0.0\r\n  config file = \r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\npipeline = True + related ControlPath etc\r\n\r\n##### OS / ENVIRONMENT\r\nLinux\r\n\r\n##### SUMMARY\r\nGit checkout fails randomly. Seems like a race condition.\r\n\r\n##### STEPS TO REPRODUCE\r\n\r\nHave a step:\r\n\r\n```\r\n- name: checkout\r\n  become: yes\r\n  git:\r\n    repo: https://github.com/hsanjuan/gallomatic.git\r\n    dest: /opt/gallomatic\r\n    force: yes\r\n    version: HEAD\r\n```\r\n\r\n\r\n##### EXPECTED RESULTS\r\nOK\r\n\r\n##### ACTUAL RESULTS\r\n\r\nRandomly get (about 50% of the time):\r\n\r\n```\r\nAn exception occurred during task execution. The full traceback is:\r\nTraceback (most recent call last):\r\n  File \"/tmp/ansible_T5rJsX/ansible_module_git.py\", line 1040, in <module>\r\n    main()\r\n  File \"/tmp/ansible_T5rJsX/ansible_module_git.py\", line 994, in main\r\n    result.update(changed=True, after=remote_head, msg='Local modifications exist')\r\nUnboundLocalError: local variable 'remote_head' referenced before assignment\r\n\r\nfatal: [myhost]: FAILED! => {\r\n    \"changed\": false, \r\n    \"failed\": true, \r\n    \"invocation\": {\r\n        \"module_name\": \"git\"\r\n    }, \r\n    \"module_stderr\": \"Traceback (most recent call last):\\n  File \\\"/tmp/ansible_T5rJsX/ansible_module_git.py\\\", line 1040, in <module>\\n    main()\\n  File \\\"/tmp/ansible_T5rJsX/ansible_module_git.py\\\", line 994, in main\\n    result.update(changed=True, after=remote_head, msg='Local modifications exist')\\nUnboundLocalError: local variable 'remote_head' referenced before assignment\\n\", \r\n    \"module_stdout\": \"\", \r\n    \"msg\": \"MODULE FAILURE\"\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/264899525","html_url":"https://github.com/ansible/ansible-modules-core/issues/5504#issuecomment-264899525","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5504","id":264899525,"user":{"login":"bwlz","id":10136541,"avatar_url":"https://avatars.githubusercontent.com/u/10136541?v=3","gravatar_id":"","url":"https://api.github.com/users/bwlz","html_url":"https://github.com/bwlz","followers_url":"https://api.github.com/users/bwlz/followers","following_url":"https://api.github.com/users/bwlz/following{/other_user}","gists_url":"https://api.github.com/users/bwlz/gists{/gist_id}","starred_url":"https://api.github.com/users/bwlz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwlz/subscriptions","organizations_url":"https://api.github.com/users/bwlz/orgs","repos_url":"https://api.github.com/users/bwlz/repos","events_url":"https://api.github.com/users/bwlz/events{/privacy}","received_events_url":"https://api.github.com/users/bwlz/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T16:22:54Z","updated_at":"2016-12-05T16:22:54Z","body":"Also seeing this, https://github.com/ansible/ansible-modules-core/issues/5504#issuecomment-259695443 seemed to fix it."}}
{"actor":{"display_login":"bwlz"}}