{"action":"created","comment":{"url":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/comments/83622778","pull_request_review_id":4453531,"id":83622778,"diff_hunk":"@@ -26,12 +26,33 @@\n - delete_old_deployments: path=/deployments/app/ keep_last=3\n '''\n \n+\n+def is_valid_version(version):\n+    parsed_version = parse_version(version)\n+    if type(parsed_version) == SetuptoolsVersion:\n+        return version\n+    else:\n+        return None\n+\n def exec_command(module, command, cwd=None):\n     rc, out, err = module.run_command(command, cwd=cwd, use_unsafe_shell=True)\n     if rc != 0:\n         module.fail_json(msg=\"Failed to issue command '%s' because stdout='%s' stderr='%s'\" % (command, out, err))\n     return out\n \n+def get_git_hash_dir(module, deployment_dir):\n+    command = \"find . -maxdepth 1 -type d -exec printf '{}\\n' \\; | awk 'length==42' | sed 's|./||'\"\n+    hash_dirs = exec_command(module, command, deployment_dir)\n+    hash_dirs = hash_dirs.split(\"\\n\")\n+    return hash_dirs\n+\n+def get_sem_ver_dir(module, deployment_dir):\n+    command = \"find . -maxdepth 1 -type d -exec printf '{}\\n' \\; | sed 's/.\\|.\\///'\"","path":"library/delete_old_deployments.py","position":34,"original_position":34,"commit_id":"015de2b3dc6215959af943bdc1639d82f14b2de9","original_commit_id":"015de2b3dc6215959af943bdc1639d82f14b2de9","user":{"login":"ahelal","id":4069495,"avatar_url":"https://avatars.githubusercontent.com/u/4069495?v=3","gravatar_id":"","url":"https://api.github.com/users/ahelal","html_url":"https://github.com/ahelal","followers_url":"https://api.github.com/users/ahelal/followers","following_url":"https://api.github.com/users/ahelal/following{/other_user}","gists_url":"https://api.github.com/users/ahelal/gists{/gist_id}","starred_url":"https://api.github.com/users/ahelal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahelal/subscriptions","organizations_url":"https://api.github.com/users/ahelal/orgs","repos_url":"https://api.github.com/users/ahelal/repos","events_url":"https://api.github.com/users/ahelal/events{/privacy}","received_events_url":"https://api.github.com/users/ahelal/received_events","type":"User","site_admin":false},"body":"@kieranajp that will not work for *1.2.0-rc.1* for example for more info http://semver.org/","created_at":"2016-10-17T11:19:17Z","updated_at":"2016-10-17T11:19:18Z","html_url":"https://github.com/hellofresh/ansible-deployment/pull/46#discussion_r83622778","pull_request_url":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/comments/83622778"},"html":{"href":"https://github.com/hellofresh/ansible-deployment/pull/46#discussion_r83622778"},"pull_request":{"href":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/46","id":89227318,"html_url":"https://github.com/hellofresh/ansible-deployment/pull/46","diff_url":"https://github.com/hellofresh/ansible-deployment/pull/46.diff","patch_url":"https://github.com/hellofresh/ansible-deployment/pull/46.patch","issue_url":"https://api.github.com/repos/hellofresh/ansible-deployment/issues/46","number":46,"state":"open","locked":false,"title":"Adds Semantic versioning - github releases","user":{"login":"robertke","id":8992903,"avatar_url":"https://avatars.githubusercontent.com/u/8992903?v=3","gravatar_id":"","url":"https://api.github.com/users/robertke","html_url":"https://github.com/robertke","followers_url":"https://api.github.com/users/robertke/followers","following_url":"https://api.github.com/users/robertke/following{/other_user}","gists_url":"https://api.github.com/users/robertke/gists{/gist_id}","starred_url":"https://api.github.com/users/robertke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertke/subscriptions","organizations_url":"https://api.github.com/users/robertke/orgs","repos_url":"https://api.github.com/users/robertke/repos","events_url":"https://api.github.com/users/robertke/events{/privacy}","received_events_url":"https://api.github.com/users/robertke/received_events","type":"User","site_admin":false},"body":"Need to find a way of using different library instead of installing on server SetuptoolsVersion pkg_resources import SetuptoolsVersion external library","created_at":"2016-10-13T15:36:13Z","updated_at":"2016-10-17T11:19:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"afd95137bd272da016d6229e678331e240eeb42a","assignee":{"login":"italolelis","id":1108049,"avatar_url":"https://avatars.githubusercontent.com/u/1108049?v=3","gravatar_id":"","url":"https://api.github.com/users/italolelis","html_url":"https://github.com/italolelis","followers_url":"https://api.github.com/users/italolelis/followers","following_url":"https://api.github.com/users/italolelis/following{/other_user}","gists_url":"https://api.github.com/users/italolelis/gists{/gist_id}","starred_url":"https://api.github.com/users/italolelis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/italolelis/subscriptions","organizations_url":"https://api.github.com/users/italolelis/orgs","repos_url":"https://api.github.com/users/italolelis/repos","events_url":"https://api.github.com/users/italolelis/events{/privacy}","received_events_url":"https://api.github.com/users/italolelis/received_events","type":"User","site_admin":false},"assignees":[{"login":"italolelis","id":1108049,"avatar_url":"https://avatars.githubusercontent.com/u/1108049?v=3","gravatar_id":"","url":"https://api.github.com/users/italolelis","html_url":"https://github.com/italolelis","followers_url":"https://api.github.com/users/italolelis/followers","following_url":"https://api.github.com/users/italolelis/following{/other_user}","gists_url":"https://api.github.com/users/italolelis/gists{/gist_id}","starred_url":"https://api.github.com/users/italolelis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/italolelis/subscriptions","organizations_url":"https://api.github.com/users/italolelis/orgs","repos_url":"https://api.github.com/users/italolelis/repos","events_url":"https://api.github.com/users/italolelis/events{/privacy}","received_events_url":"https://api.github.com/users/italolelis/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/46/commits","review_comments_url":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/46/comments","review_comment_url":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hellofresh/ansible-deployment/issues/46/comments","statuses_url":"https://api.github.com/repos/hellofresh/ansible-deployment/statuses/015de2b3dc6215959af943bdc1639d82f14b2de9","head":{"label":"hellofresh:semantic-versioning","ref":"semantic-versioning","sha":"015de2b3dc6215959af943bdc1639d82f14b2de9","user":{"login":"hellofresh","id":4430027,"avatar_url":"https://avatars.githubusercontent.com/u/4430027?v=3","gravatar_id":"","url":"https://api.github.com/users/hellofresh","html_url":"https://github.com/hellofresh","followers_url":"https://api.github.com/users/hellofresh/followers","following_url":"https://api.github.com/users/hellofresh/following{/other_user}","gists_url":"https://api.github.com/users/hellofresh/gists{/gist_id}","starred_url":"https://api.github.com/users/hellofresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellofresh/subscriptions","organizations_url":"https://api.github.com/users/hellofresh/orgs","repos_url":"https://api.github.com/users/hellofresh/repos","events_url":"https://api.github.com/users/hellofresh/events{/privacy}","received_events_url":"https://api.github.com/users/hellofresh/received_events","type":"Organization","site_admin":false},"repo":{"id":43754281,"name":"ansible-deployment","full_name":"hellofresh/ansible-deployment","owner":{"login":"hellofresh","id":4430027,"avatar_url":"https://avatars.githubusercontent.com/u/4430027?v=3","gravatar_id":"","url":"https://api.github.com/users/hellofresh","html_url":"https://github.com/hellofresh","followers_url":"https://api.github.com/users/hellofresh/followers","following_url":"https://api.github.com/users/hellofresh/following{/other_user}","gists_url":"https://api.github.com/users/hellofresh/gists{/gist_id}","starred_url":"https://api.github.com/users/hellofresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellofresh/subscriptions","organizations_url":"https://api.github.com/users/hellofresh/orgs","repos_url":"https://api.github.com/users/hellofresh/repos","events_url":"https://api.github.com/users/hellofresh/events{/privacy}","received_events_url":"https://api.github.com/users/hellofresh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hellofresh/ansible-deployment","description":"Ansible Deployment Role","fork":false,"url":"https://api.github.com/repos/hellofresh/ansible-deployment","forks_url":"https://api.github.com/repos/hellofresh/ansible-deployment/forks","keys_url":"https://api.github.com/repos/hellofresh/ansible-deployment/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hellofresh/ansible-deployment/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hellofresh/ansible-deployment/teams","hooks_url":"https://api.github.com/repos/hellofresh/ansible-deployment/hooks","issue_events_url":"https://api.github.com/repos/hellofresh/ansible-deployment/issues/events{/number}","events_url":"https://api.github.com/repos/hellofresh/ansible-deployment/events","assignees_url":"https://api.github.com/repos/hellofresh/ansible-deployment/assignees{/user}","branches_url":"https://api.github.com/repos/hellofresh/ansible-deployment/branches{/branch}","tags_url":"https://api.github.com/repos/hellofresh/ansible-deployment/tags","blobs_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/refs{/sha}","trees_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hellofresh/ansible-deployment/statuses/{sha}","languages_url":"https://api.github.com/repos/hellofresh/ansible-deployment/languages","stargazers_url":"https://api.github.com/repos/hellofresh/ansible-deployment/stargazers","contributors_url":"https://api.github.com/repos/hellofresh/ansible-deployment/contributors","subscribers_url":"https://api.github.com/repos/hellofresh/ansible-deployment/subscribers","subscription_url":"https://api.github.com/repos/hellofresh/ansible-deployment/subscription","commits_url":"https://api.github.com/repos/hellofresh/ansible-deployment/commits{/sha}","git_commits_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/commits{/sha}","comments_url":"https://api.github.com/repos/hellofresh/ansible-deployment/comments{/number}","issue_comment_url":"https://api.github.com/repos/hellofresh/ansible-deployment/issues/comments{/number}","contents_url":"https://api.github.com/repos/hellofresh/ansible-deployment/contents/{+path}","compare_url":"https://api.github.com/repos/hellofresh/ansible-deployment/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hellofresh/ansible-deployment/merges","archive_url":"https://api.github.com/repos/hellofresh/ansible-deployment/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hellofresh/ansible-deployment/downloads","issues_url":"https://api.github.com/repos/hellofresh/ansible-deployment/issues{/number}","pulls_url":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls{/number}","milestones_url":"https://api.github.com/repos/hellofresh/ansible-deployment/milestones{/number}","notifications_url":"https://api.github.com/repos/hellofresh/ansible-deployment/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hellofresh/ansible-deployment/labels{/name}","releases_url":"https://api.github.com/repos/hellofresh/ansible-deployment/releases{/id}","deployments_url":"https://api.github.com/repos/hellofresh/ansible-deployment/deployments","created_at":"2015-10-06T14:01:18Z","updated_at":"2016-09-22T20:41:48Z","pushed_at":"2016-10-13T15:36:14Z","git_url":"git://github.com/hellofresh/ansible-deployment.git","ssh_url":"git@github.com:hellofresh/ansible-deployment.git","clone_url":"https://github.com/hellofresh/ansible-deployment.git","svn_url":"https://github.com/hellofresh/ansible-deployment","homepage":null,"size":183,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"hellofresh:master","ref":"master","sha":"1e0ca7b96299e67496dfa37556092804ef2101ad","user":{"login":"hellofresh","id":4430027,"avatar_url":"https://avatars.githubusercontent.com/u/4430027?v=3","gravatar_id":"","url":"https://api.github.com/users/hellofresh","html_url":"https://github.com/hellofresh","followers_url":"https://api.github.com/users/hellofresh/followers","following_url":"https://api.github.com/users/hellofresh/following{/other_user}","gists_url":"https://api.github.com/users/hellofresh/gists{/gist_id}","starred_url":"https://api.github.com/users/hellofresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellofresh/subscriptions","organizations_url":"https://api.github.com/users/hellofresh/orgs","repos_url":"https://api.github.com/users/hellofresh/repos","events_url":"https://api.github.com/users/hellofresh/events{/privacy}","received_events_url":"https://api.github.com/users/hellofresh/received_events","type":"Organization","site_admin":false},"repo":{"id":43754281,"name":"ansible-deployment","full_name":"hellofresh/ansible-deployment","owner":{"login":"hellofresh","id":4430027,"avatar_url":"https://avatars.githubusercontent.com/u/4430027?v=3","gravatar_id":"","url":"https://api.github.com/users/hellofresh","html_url":"https://github.com/hellofresh","followers_url":"https://api.github.com/users/hellofresh/followers","following_url":"https://api.github.com/users/hellofresh/following{/other_user}","gists_url":"https://api.github.com/users/hellofresh/gists{/gist_id}","starred_url":"https://api.github.com/users/hellofresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellofresh/subscriptions","organizations_url":"https://api.github.com/users/hellofresh/orgs","repos_url":"https://api.github.com/users/hellofresh/repos","events_url":"https://api.github.com/users/hellofresh/events{/privacy}","received_events_url":"https://api.github.com/users/hellofresh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hellofresh/ansible-deployment","description":"Ansible Deployment Role","fork":false,"url":"https://api.github.com/repos/hellofresh/ansible-deployment","forks_url":"https://api.github.com/repos/hellofresh/ansible-deployment/forks","keys_url":"https://api.github.com/repos/hellofresh/ansible-deployment/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hellofresh/ansible-deployment/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hellofresh/ansible-deployment/teams","hooks_url":"https://api.github.com/repos/hellofresh/ansible-deployment/hooks","issue_events_url":"https://api.github.com/repos/hellofresh/ansible-deployment/issues/events{/number}","events_url":"https://api.github.com/repos/hellofresh/ansible-deployment/events","assignees_url":"https://api.github.com/repos/hellofresh/ansible-deployment/assignees{/user}","branches_url":"https://api.github.com/repos/hellofresh/ansible-deployment/branches{/branch}","tags_url":"https://api.github.com/repos/hellofresh/ansible-deployment/tags","blobs_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/refs{/sha}","trees_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hellofresh/ansible-deployment/statuses/{sha}","languages_url":"https://api.github.com/repos/hellofresh/ansible-deployment/languages","stargazers_url":"https://api.github.com/repos/hellofresh/ansible-deployment/stargazers","contributors_url":"https://api.github.com/repos/hellofresh/ansible-deployment/contributors","subscribers_url":"https://api.github.com/repos/hellofresh/ansible-deployment/subscribers","subscription_url":"https://api.github.com/repos/hellofresh/ansible-deployment/subscription","commits_url":"https://api.github.com/repos/hellofresh/ansible-deployment/commits{/sha}","git_commits_url":"https://api.github.com/repos/hellofresh/ansible-deployment/git/commits{/sha}","comments_url":"https://api.github.com/repos/hellofresh/ansible-deployment/comments{/number}","issue_comment_url":"https://api.github.com/repos/hellofresh/ansible-deployment/issues/comments{/number}","contents_url":"https://api.github.com/repos/hellofresh/ansible-deployment/contents/{+path}","compare_url":"https://api.github.com/repos/hellofresh/ansible-deployment/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hellofresh/ansible-deployment/merges","archive_url":"https://api.github.com/repos/hellofresh/ansible-deployment/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hellofresh/ansible-deployment/downloads","issues_url":"https://api.github.com/repos/hellofresh/ansible-deployment/issues{/number}","pulls_url":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls{/number}","milestones_url":"https://api.github.com/repos/hellofresh/ansible-deployment/milestones{/number}","notifications_url":"https://api.github.com/repos/hellofresh/ansible-deployment/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hellofresh/ansible-deployment/labels{/name}","releases_url":"https://api.github.com/repos/hellofresh/ansible-deployment/releases{/id}","deployments_url":"https://api.github.com/repos/hellofresh/ansible-deployment/deployments","created_at":"2015-10-06T14:01:18Z","updated_at":"2016-09-22T20:41:48Z","pushed_at":"2016-10-13T15:36:14Z","git_url":"git://github.com/hellofresh/ansible-deployment.git","ssh_url":"git@github.com:hellofresh/ansible-deployment.git","clone_url":"https://github.com/hellofresh/ansible-deployment.git","svn_url":"https://github.com/hellofresh/ansible-deployment","homepage":null,"size":183,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/46"},"html":{"href":"https://github.com/hellofresh/ansible-deployment/pull/46"},"issue":{"href":"https://api.github.com/repos/hellofresh/ansible-deployment/issues/46"},"comments":{"href":"https://api.github.com/repos/hellofresh/ansible-deployment/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hellofresh/ansible-deployment/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/hellofresh/ansible-deployment/statuses/015de2b3dc6215959af943bdc1639d82f14b2de9"}}}}
{"actor":{"display_login":"ahelal"}}