{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/82698034","pull_request_review_id":3587602,"id":82698034,"diff_hunk":"@@ -91,9 +91,18 @@ def self.create_tag(name, value, category_tag)\n       entry_name = Classification.sanitize_name(value)\n       description = value\n     end\n-    entry = category.add_entry(:name => entry_name, :description => description)\n-    entry.save!\n-    entry.tag\n+    upsert_tag(category, entry_name, description)\n   end\n   private_class_method :create_tag\n+\n+  def upsert_tag(category, name, description)\n+    entry = category.add_entry(:name => name, :description => description)\n+    if entry.valid?","path":"app/models/container_label_tag_mapping.rb","position":13,"original_position":13,"commit_id":"a9c5b3531ebf95c57ebe870143b53d219cb004f4","original_commit_id":"a9c5b3531ebf95c57ebe870143b53d219cb004f4","user":{"login":"cben","id":273688,"avatar_url":"https://avatars.githubusercontent.com/u/273688?v=3","gravatar_id":"","url":"https://api.github.com/users/cben","html_url":"https://github.com/cben","followers_url":"https://api.github.com/users/cben/followers","following_url":"https://api.github.com/users/cben/following{/other_user}","gists_url":"https://api.github.com/users/cben/gists{/gist_id}","starred_url":"https://api.github.com/users/cben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cben/subscriptions","organizations_url":"https://api.github.com/users/cben/orgs","repos_url":"https://api.github.com/users/cben/repos","events_url":"https://api.github.com/users/cben/events{/privacy}","received_events_url":"https://api.github.com/users/cben/received_events","type":"User","site_admin":false},"body":"Yes it is.  DIscussion moved to https://github.com/ManageIQ/manageiq/pull/11806/files#r82697923 which is similarly racy.","created_at":"2016-10-10T22:55:26Z","updated_at":"2016-10-10T22:55:27Z","html_url":"https://github.com/ManageIQ/manageiq/pull/11796#discussion_r82698034","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11796","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/82698034"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/11796#discussion_r82698034"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11796"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11796","id":88684065,"html_url":"https://github.com/ManageIQ/manageiq/pull/11796","diff_url":"https://github.com/ManageIQ/manageiq/pull/11796.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/11796.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/11796","number":11796,"state":"open","locked":false,"title":"Avoid creating child classification if already exists.","user":{"login":"moolitayer","id":3010449,"avatar_url":"https://avatars.githubusercontent.com/u/3010449?v=3","gravatar_id":"","url":"https://api.github.com/users/moolitayer","html_url":"https://github.com/moolitayer","followers_url":"https://api.github.com/users/moolitayer/followers","following_url":"https://api.github.com/users/moolitayer/following{/other_user}","gists_url":"https://api.github.com/users/moolitayer/gists{/gist_id}","starred_url":"https://api.github.com/users/moolitayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moolitayer/subscriptions","organizations_url":"https://api.github.com/users/moolitayer/orgs","repos_url":"https://api.github.com/users/moolitayer/repos","events_url":"https://api.github.com/users/moolitayer/events{/privacy}","received_events_url":"https://api.github.com/users/moolitayer/received_events","type":"User","site_admin":false},"body":"Number of reasons for a classification entry (+tag) only if not exists:\r\n\r\n- when a different refresh already created the same classification but it is not in our cache \r\n- cases were several values with different case/accent are mapped to the same tag \r\n\r\nBug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1382347","created_at":"2016-10-10T15:34:01Z","updated_at":"2016-10-10T22:55:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e044e162f5fcbef7f1dad710546cbee9a4a85995","assignee":{"login":"simon3z","id":130393,"avatar_url":"https://avatars.githubusercontent.com/u/130393?v=3","gravatar_id":"","url":"https://api.github.com/users/simon3z","html_url":"https://github.com/simon3z","followers_url":"https://api.github.com/users/simon3z/followers","following_url":"https://api.github.com/users/simon3z/following{/other_user}","gists_url":"https://api.github.com/users/simon3z/gists{/gist_id}","starred_url":"https://api.github.com/users/simon3z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simon3z/subscriptions","organizations_url":"https://api.github.com/users/simon3z/orgs","repos_url":"https://api.github.com/users/simon3z/repos","events_url":"https://api.github.com/users/simon3z/events{/privacy}","received_events_url":"https://api.github.com/users/simon3z/received_events","type":"User","site_admin":false},"assignees":[{"login":"simon3z","id":130393,"avatar_url":"https://avatars.githubusercontent.com/u/130393?v=3","gravatar_id":"","url":"https://api.github.com/users/simon3z","html_url":"https://github.com/simon3z","followers_url":"https://api.github.com/users/simon3z/followers","following_url":"https://api.github.com/users/simon3z/following{/other_user}","gists_url":"https://api.github.com/users/simon3z/gists{/gist_id}","starred_url":"https://api.github.com/users/simon3z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simon3z/subscriptions","organizations_url":"https://api.github.com/users/simon3z/orgs","repos_url":"https://api.github.com/users/simon3z/repos","events_url":"https://api.github.com/users/simon3z/events{/privacy}","received_events_url":"https://api.github.com/users/simon3z/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11796/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11796/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/11796/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/a9c5b3531ebf95c57ebe870143b53d219cb004f4","head":{"label":"moolitayer:upsert_tag","ref":"upsert_tag","sha":"a9c5b3531ebf95c57ebe870143b53d219cb004f4","user":{"login":"moolitayer","id":3010449,"avatar_url":"https://avatars.githubusercontent.com/u/3010449?v=3","gravatar_id":"","url":"https://api.github.com/users/moolitayer","html_url":"https://github.com/moolitayer","followers_url":"https://api.github.com/users/moolitayer/followers","following_url":"https://api.github.com/users/moolitayer/following{/other_user}","gists_url":"https://api.github.com/users/moolitayer/gists{/gist_id}","starred_url":"https://api.github.com/users/moolitayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moolitayer/subscriptions","organizations_url":"https://api.github.com/users/moolitayer/orgs","repos_url":"https://api.github.com/users/moolitayer/repos","events_url":"https://api.github.com/users/moolitayer/events{/privacy}","received_events_url":"https://api.github.com/users/moolitayer/received_events","type":"User","site_admin":false},"repo":{"id":35763260,"name":"manageiq","full_name":"moolitayer/manageiq","owner":{"login":"moolitayer","id":3010449,"avatar_url":"https://avatars.githubusercontent.com/u/3010449?v=3","gravatar_id":"","url":"https://api.github.com/users/moolitayer","html_url":"https://github.com/moolitayer","followers_url":"https://api.github.com/users/moolitayer/followers","following_url":"https://api.github.com/users/moolitayer/following{/other_user}","gists_url":"https://api.github.com/users/moolitayer/gists{/gist_id}","starred_url":"https://api.github.com/users/moolitayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moolitayer/subscriptions","organizations_url":"https://api.github.com/users/moolitayer/orgs","repos_url":"https://api.github.com/users/moolitayer/repos","events_url":"https://api.github.com/users/moolitayer/events{/privacy}","received_events_url":"https://api.github.com/users/moolitayer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/moolitayer/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/moolitayer/manageiq","forks_url":"https://api.github.com/repos/moolitayer/manageiq/forks","keys_url":"https://api.github.com/repos/moolitayer/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moolitayer/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moolitayer/manageiq/teams","hooks_url":"https://api.github.com/repos/moolitayer/manageiq/hooks","issue_events_url":"https://api.github.com/repos/moolitayer/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/moolitayer/manageiq/events","assignees_url":"https://api.github.com/repos/moolitayer/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/moolitayer/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/moolitayer/manageiq/tags","blobs_url":"https://api.github.com/repos/moolitayer/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moolitayer/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moolitayer/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/moolitayer/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moolitayer/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/moolitayer/manageiq/languages","stargazers_url":"https://api.github.com/repos/moolitayer/manageiq/stargazers","contributors_url":"https://api.github.com/repos/moolitayer/manageiq/contributors","subscribers_url":"https://api.github.com/repos/moolitayer/manageiq/subscribers","subscription_url":"https://api.github.com/repos/moolitayer/manageiq/subscription","commits_url":"https://api.github.com/repos/moolitayer/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/moolitayer/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/moolitayer/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/moolitayer/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/moolitayer/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/moolitayer/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moolitayer/manageiq/merges","archive_url":"https://api.github.com/repos/moolitayer/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moolitayer/manageiq/downloads","issues_url":"https://api.github.com/repos/moolitayer/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/moolitayer/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/moolitayer/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/moolitayer/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moolitayer/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/moolitayer/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/moolitayer/manageiq/deployments","created_at":"2015-05-17T11:18:34Z","updated_at":"2015-05-17T11:18:51Z","pushed_at":"2016-10-10T15:34:43Z","git_url":"git://github.com/moolitayer/manageiq.git","ssh_url":"git@github.com:moolitayer/manageiq.git","clone_url":"https://github.com/moolitayer/manageiq.git","svn_url":"https://github.com/moolitayer/manageiq","homepage":"manageiq.org","size":161522,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"b59ae93a0276099c2a04fc968f345648eaeb3cd5","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":20789757,"name":"manageiq","full_name":"ManageIQ/manageiq","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/manageiq","description":"ManageIQ Open-Source Management Platform","fork":false,"url":"https://api.github.com/repos/ManageIQ/manageiq","forks_url":"https://api.github.com/repos/ManageIQ/manageiq/forks","keys_url":"https://api.github.com/repos/ManageIQ/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/manageiq/teams","hooks_url":"https://api.github.com/repos/ManageIQ/manageiq/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/manageiq/events","assignees_url":"https://api.github.com/repos/ManageIQ/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/manageiq/tags","blobs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/manageiq/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/manageiq/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/manageiq/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/manageiq/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/manageiq/subscription","commits_url":"https://api.github.com/repos/ManageIQ/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/manageiq/merges","archive_url":"https://api.github.com/repos/ManageIQ/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/manageiq/downloads","issues_url":"https://api.github.com/repos/ManageIQ/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/ManageIQ/manageiq/deployments","created_at":"2014-06-13T02:31:26Z","updated_at":"2016-10-07T20:22:27Z","pushed_at":"2016-10-10T22:37:39Z","git_url":"git://github.com/ManageIQ/manageiq.git","ssh_url":"git@github.com:ManageIQ/manageiq.git","clone_url":"https://github.com/ManageIQ/manageiq.git","svn_url":"https://github.com/ManageIQ/manageiq","homepage":"manageiq.org","size":210246,"stargazers_count":335,"watchers_count":335,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":361,"mirror_url":null,"open_issues_count":833,"forks":361,"open_issues":833,"watchers":335,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11796"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/11796"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/11796"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/11796/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11796/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11796/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/a9c5b3531ebf95c57ebe870143b53d219cb004f4"}}}}
{"actor":{"display_login":"cben"}}