{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/24409","labels_url":"https://api.github.com/repos/saltstack/salt/issues/24409/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/24409/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/24409/events","html_url":"https://github.com/saltstack/salt/issues/24409","id":85181810,"number":24409,"title":"'git' state fails to checkout from a tag","user":{"login":"dtoubelis","id":336503,"avatar_url":"https://avatars.githubusercontent.com/u/336503?v=3","gravatar_id":"","url":"https://api.github.com/users/dtoubelis","html_url":"https://github.com/dtoubelis","followers_url":"https://api.github.com/users/dtoubelis/followers","following_url":"https://api.github.com/users/dtoubelis/following{/other_user}","gists_url":"https://api.github.com/users/dtoubelis/gists{/gist_id}","starred_url":"https://api.github.com/users/dtoubelis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtoubelis/subscriptions","organizations_url":"https://api.github.com/users/dtoubelis/orgs","repos_url":"https://api.github.com/users/dtoubelis/repos","events_url":"https://api.github.com/users/dtoubelis/events{/privacy}","received_events_url":"https://api.github.com/users/dtoubelis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/High%20Severity","name":"High Severity","color":"ff9143"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P2","name":"P2","color":"155fb5"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Platform%20Mgmt","name":"Platform Mgmt","color":"006b75"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Regression","name":"Regression","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/State%20Module","name":"State Module","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","html_url":"https://github.com/saltstack/salt/milestones/Approved","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"open_issues":2331,"closed_issues":2129,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-06-10T17:23:09Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-06-04T16:50:21Z","updated_at":"2015-06-10T18:05:12Z","closed_at":null,"body":"Salt is running on Ubuntu 14.04 with the latest version from the PPA:\r\n\r\n```\r\n# salt --versions-report\r\n                  Salt: 2015.5.0\r\n                Python: 2.7.6 (default, Mar 22 2014, 22:59:56)\r\n                Jinja2: 2.7.2\r\n              M2Crypto: 0.21.1\r\n        msgpack-python: 0.3.0\r\n          msgpack-pure: Not Installed\r\n              pycrypto: 2.6.1\r\n               libnacl: Not Installed\r\n                PyYAML: 3.10\r\n                 ioflo: Not Installed\r\n                 PyZMQ: 14.0.1\r\n                  RAET: Not Installed\r\n                   ZMQ: 4.0.4\r\n                  Mako: 0.9.1\r\n Debian source package: 2015.5.0+ds-1trusty1\r\n```\r\n\r\nI'm getting intermittent errors with `git` state related to using tags and the most recent ones is this:\r\n\r\n```\r\n[INFO    ] Running state [git@bitbucket.org:mijem/web-client.git] at time 16:51:20.123462\r\n[INFO    ] Executing state git.latest for git@bitbucket.org:mijem/web-client.git\r\n[INFO    ] Executing command 'git rev-parse HEAD' as user 'mijem-web' in directory '/home/mijem-web/mijem-web'\r\n[INFO    ] Executing command 'git rev-parse --abbrev-ref HEAD' as user 'mijem-web' in directory '/home/mijem-web/mijem-web'\r\n[INFO    ] Executing command 'git remote show -n origin' as user 'mijem-web' in directory '/home/mijem-web/mijem-web'\r\n[INFO    ] Executing command 'git rev-parse v0.1.0^{commit}' as user 'mijem-web' in directory '/home/mijem-web/mijem-web'\r\n[ERROR   ] Command 'git rev-parse v0.1.0^{commit}' failed with return code: 128\r\n[ERROR   ] output: fatal: ambiguous argument 'v0.1.0^{commit}': unknown revision or path not in the working tree.\r\nUse '--' to separate paths from revisions, like this:\r\n'git <command> [<revision>...] -- [<file>...]'\r\nv0.1.0^{commit}\r\n[INFO    ] Executing command 'git fetch ' as user 'mijem-web' in directory '/home/mijem-web/mijem-web'\r\n[INFO    ] Executing command 'git checkout  -f v0.1.0 ' as user 'mijem-web' in directory '/home/mijem-web/mijem-web'\r\n[INFO    ] Executing command 'git config branch.v0.1.0.remote' as user 'mijem-web' in directory '/home/mijem-web/mijem-web'\r\n[ERROR   ] Command 'git config branch.v0.1.0.remote' failed with return code: 1\r\n[ERROR   ] retcode: 1\r\n[INFO    ] Executing command 'git branch v0.1.0 --set-upstream origin/v0.1.0' in directory '/home/mijem-web/mijem-web'\r\n[ERROR   ] Command 'git branch v0.1.0 --set-upstream origin/v0.1.0' failed with return code: 1\r\n[ERROR   ] stderr: The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to\r\nerror: the requested upstream branch 'origin/v0.1.0' does not exist\r\nhint:\r\nhint: If you are planning on basing your work on an upstream\r\nhint: branch that already exists at the remote, you may need to\r\nhint: run \"git fetch\" to retrieve it.\r\nhint:\r\nhint: If you are planning to push out a new local branch that\r\nhint: will track its remote counterpart, you may want to use\r\nhint: \"git push -u\" to set the upstream config as you push.\r\n[ERROR   ] retcode: 1\r\n[ERROR   ] Unexpected exception in git state\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python2.7/dist-packages/salt/states/git.py\", line 312, in latest\r\n    user=user)\r\n  File \"/usr/lib/python2.7/dist-packages/salt/modules/git.py\", line 791, in branch\r\n    _git_run(cmd, cwd=cwd, user=user)\r\n  File \"/usr/lib/python2.7/dist-packages/salt/modules/git.py\", line 82, in _git_run\r\n    result['stderr']))\r\nCommandExecutionError: Command 'git branch v0.1.0 --set-upstream origin/v0.1.0' failed. Stderr: 'The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to\\nerror: the requested upstream branch \\'origin/v0.1.0\\' does not exist\\nhint: \\nhint: If you are planning on basing your work on an upstream\\nhint: branch that already exists at the remote, you may need to\\nhint: run \"git fetch\" to retrieve it.\\nhint: \\nhint: If you are planning to push out a new local branch that\\nhint: will track its remote counterpart, you may want to use\\nhint: \"git push -u\" to set the upstream config as you push.'\r\n[ERROR   ] Command 'git branch v0.1.0 --set-upstream origin/v0.1.0' failed. Stderr: 'The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to\\nerror: the requested upstream branch \\'origin/v0.1.0\\' does not exist\\nhint: \\nhint: If you are planning on basing your work on an upstream\\nhint: branch that already exists at the remote, you may need to\\nhint: run \"git fetch\" to retrieve it.\\nhint: \\nhint: If you are planning to push out a new local branch that\\nhint: will track its remote counterpart, you may want to use\\nhint: \"git push -u\" to set the upstream config as you push.'\r\n\r\n```\r\n\r\nWhere `v0.1.0` is a tag in the remote git repository (not a branch). The state definition is as follows:\r\n\r\n```\r\n{{ sls_base_name }}-deploy:\r\n  git.latest:\r\n    - name: {{ adminserver.app_git_url }}\r\n    - rev: {{ adminserver.app_version }}\r\n    - target: {{ adminserver.user_home }}/{{ adminserver.app_dir_basename }}\r\n    - identity: {{ adminserver.user_home }}/.ssh/{{ adminserver.ssh_key_name }}.pem\r\n    - user: {{ adminserver.user_name }}\r\n    - force_checkout: True\r\n    - require:\r\n      - pkg: {{ sls_base_name }}-install-pkgs\r\n      - file: {{ sls_base_name }}-ssh-key\r\n```\r\n\r\nAlso this may or may not be important. The original version of this checkout was `master` and then it was replaced with a specific tag, so `git.latest` is executed in the directory with pre-existing checkout."},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/110858100","html_url":"https://github.com/saltstack/salt/issues/24409#issuecomment-110858100","issue_url":"https://api.github.com/repos/saltstack/salt/issues/24409","id":110858100,"user":{"login":"dtoubelis","id":336503,"avatar_url":"https://avatars.githubusercontent.com/u/336503?v=3","gravatar_id":"","url":"https://api.github.com/users/dtoubelis","html_url":"https://github.com/dtoubelis","followers_url":"https://api.github.com/users/dtoubelis/followers","following_url":"https://api.github.com/users/dtoubelis/following{/other_user}","gists_url":"https://api.github.com/users/dtoubelis/gists{/gist_id}","starred_url":"https://api.github.com/users/dtoubelis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtoubelis/subscriptions","organizations_url":"https://api.github.com/users/dtoubelis/orgs","repos_url":"https://api.github.com/users/dtoubelis/repos","events_url":"https://api.github.com/users/dtoubelis/events{/privacy}","received_events_url":"https://api.github.com/users/dtoubelis/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T18:05:12Z","updated_at":"2015-06-10T18:05:12Z","body":"```\r\n# dpkg -l | grep python-git\r\nii  python-git                          0.3.2~RC1-3                         all          Python library to interact with Git repositories\r\nii  python-gitdb                        0.5.4-1                             amd64        pure-Python git object database\r\n```\r\n```\r\n# pip list | grep git\r\nThe program 'pip' is currently not installed. You can install it by typing:\r\napt-get install python-pip\r\n```"}}