{"action":"created","comment":{"url":"https://api.github.com/repos/mendersoftware/deployments/pulls/comments/105165199","pull_request_review_id":26030776,"id":105165199,"diff_hunk":"@@ -368,3 +396,33 @@ func (d *DeviceDeploymentsStorage) AbortDeviceDeployments(deploymentId string) e\n \n \treturn err\n }\n+\n+func (d *DeviceDeploymentsStorage) DecommissionDeviceDeployments(deviceId string) error {\n+\tif govalidator.IsNull(deviceId) {\n+\t\treturn ErrStorageInvalidID\n+\t}\n+\n+\tsession := d.session.Copy()\n+\tdefer session.Close()\n+\tselector := bson.M{\"$and\": []bson.M{\n+\t\tbson.M{StorageKeyDeviceDeploymentDeviceId: deviceId},\n+\t\tbson.M{\n+\t\t\t\"status\": bson.M{\n+\t\t\t\t\"$in\": deployments.ActiveDeploymentStatuses(),\n+\t\t\t}},\n+\t}}\n+\n+\tupdate := bson.M{\n+\t\t\"$set\": bson.M{\n+\t\t\t\"status\": deployments.DeviceDeploymentStatusDecommissioned,","path":"resources/deployments/mongo/device_deployments.go","position":null,"original_position":57,"commit_id":"089b9b7e12dba09333c27f82cea0163bc09890f0","original_commit_id":"541f2a71fd3312c298b809b86d726ad5a350a6ac","user":{"login":"kjaskiewiczz","id":9249567,"avatar_url":"https://avatars1.githubusercontent.com/u/9249567?v=3","gravatar_id":"","url":"https://api.github.com/users/kjaskiewiczz","html_url":"https://github.com/kjaskiewiczz","followers_url":"https://api.github.com/users/kjaskiewiczz/followers","following_url":"https://api.github.com/users/kjaskiewiczz/following{/other_user}","gists_url":"https://api.github.com/users/kjaskiewiczz/gists{/gist_id}","starred_url":"https://api.github.com/users/kjaskiewiczz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kjaskiewiczz/subscriptions","organizations_url":"https://api.github.com/users/kjaskiewiczz/orgs","repos_url":"https://api.github.com/users/kjaskiewiczz/repos","events_url":"https://api.github.com/users/kjaskiewiczz/events{/privacy}","received_events_url":"https://api.github.com/users/kjaskiewiczz/received_events","type":"User","site_admin":false},"body":"done","created_at":"2017-03-09T13:44:28Z","updated_at":"2017-03-09T13:44:28Z","html_url":"https://github.com/mendersoftware/deployments/pull/245#discussion_r105165199","pull_request_url":"https://api.github.com/repos/mendersoftware/deployments/pulls/245","_links":{"self":{"href":"https://api.github.com/repos/mendersoftware/deployments/pulls/comments/105165199"},"html":{"href":"https://github.com/mendersoftware/deployments/pull/245#discussion_r105165199"},"pull_request":{"href":"https://api.github.com/repos/mendersoftware/deployments/pulls/245"}}},"pull_request":{"url":"https://api.github.com/repos/mendersoftware/deployments/pulls/245","id":109492110,"html_url":"https://github.com/mendersoftware/deployments/pull/245","diff_url":"https://github.com/mendersoftware/deployments/pull/245.diff","patch_url":"https://github.com/mendersoftware/deployments/pull/245.patch","issue_url":"https://api.github.com/repos/mendersoftware/deployments/issues/245","number":245,"state":"open","locked":false,"title":"Device decommissioning.","user":{"login":"kjaskiewiczz","id":9249567,"avatar_url":"https://avatars1.githubusercontent.com/u/9249567?v=3","gravatar_id":"","url":"https://api.github.com/users/kjaskiewiczz","html_url":"https://github.com/kjaskiewiczz","followers_url":"https://api.github.com/users/kjaskiewiczz/followers","following_url":"https://api.github.com/users/kjaskiewiczz/following{/other_user}","gists_url":"https://api.github.com/users/kjaskiewiczz/gists{/gist_id}","starred_url":"https://api.github.com/users/kjaskiewiczz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kjaskiewiczz/subscriptions","organizations_url":"https://api.github.com/users/kjaskiewiczz/orgs","repos_url":"https://api.github.com/users/kjaskiewiczz/repos","events_url":"https://api.github.com/users/kjaskiewiczz/events{/privacy}","received_events_url":"https://api.github.com/users/kjaskiewiczz/received_events","type":"User","site_admin":false},"body":"Device decommissioning + test improvements.\r\n@bboozzoo @mchalski @maciejmrowiec ","created_at":"2017-03-07T14:36:24Z","updated_at":"2017-03-09T13:44:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2cd3ff97f48f95ae81f6510282cffcd3959f467","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mendersoftware/deployments/pulls/245/commits","review_comments_url":"https://api.github.com/repos/mendersoftware/deployments/pulls/245/comments","review_comment_url":"https://api.github.com/repos/mendersoftware/deployments/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mendersoftware/deployments/issues/245/comments","statuses_url":"https://api.github.com/repos/mendersoftware/deployments/statuses/089b9b7e12dba09333c27f82cea0163bc09890f0","head":{"label":"kjaskiewiczz:MEN-988","ref":"MEN-988","sha":"089b9b7e12dba09333c27f82cea0163bc09890f0","user":{"login":"kjaskiewiczz","id":9249567,"avatar_url":"https://avatars1.githubusercontent.com/u/9249567?v=3","gravatar_id":"","url":"https://api.github.com/users/kjaskiewiczz","html_url":"https://github.com/kjaskiewiczz","followers_url":"https://api.github.com/users/kjaskiewiczz/followers","following_url":"https://api.github.com/users/kjaskiewiczz/following{/other_user}","gists_url":"https://api.github.com/users/kjaskiewiczz/gists{/gist_id}","starred_url":"https://api.github.com/users/kjaskiewiczz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kjaskiewiczz/subscriptions","organizations_url":"https://api.github.com/users/kjaskiewiczz/orgs","repos_url":"https://api.github.com/users/kjaskiewiczz/repos","events_url":"https://api.github.com/users/kjaskiewiczz/events{/privacy}","received_events_url":"https://api.github.com/users/kjaskiewiczz/received_events","type":"User","site_admin":false},"repo":{"id":69966125,"name":"deployments","full_name":"kjaskiewiczz/deployments","owner":{"login":"kjaskiewiczz","id":9249567,"avatar_url":"https://avatars1.githubusercontent.com/u/9249567?v=3","gravatar_id":"","url":"https://api.github.com/users/kjaskiewiczz","html_url":"https://github.com/kjaskiewiczz","followers_url":"https://api.github.com/users/kjaskiewiczz/followers","following_url":"https://api.github.com/users/kjaskiewiczz/following{/other_user}","gists_url":"https://api.github.com/users/kjaskiewiczz/gists{/gist_id}","starred_url":"https://api.github.com/users/kjaskiewiczz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kjaskiewiczz/subscriptions","organizations_url":"https://api.github.com/users/kjaskiewiczz/orgs","repos_url":"https://api.github.com/users/kjaskiewiczz/repos","events_url":"https://api.github.com/users/kjaskiewiczz/events{/privacy}","received_events_url":"https://api.github.com/users/kjaskiewiczz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kjaskiewiczz/deployments","description":"Microservice for managing software deployments for IIoT devices within Mender ecosystem.","fork":true,"url":"https://api.github.com/repos/kjaskiewiczz/deployments","forks_url":"https://api.github.com/repos/kjaskiewiczz/deployments/forks","keys_url":"https://api.github.com/repos/kjaskiewiczz/deployments/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kjaskiewiczz/deployments/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kjaskiewiczz/deployments/teams","hooks_url":"https://api.github.com/repos/kjaskiewiczz/deployments/hooks","issue_events_url":"https://api.github.com/repos/kjaskiewiczz/deployments/issues/events{/number}","events_url":"https://api.github.com/repos/kjaskiewiczz/deployments/events","assignees_url":"https://api.github.com/repos/kjaskiewiczz/deployments/assignees{/user}","branches_url":"https://api.github.com/repos/kjaskiewiczz/deployments/branches{/branch}","tags_url":"https://api.github.com/repos/kjaskiewiczz/deployments/tags","blobs_url":"https://api.github.com/repos/kjaskiewiczz/deployments/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kjaskiewiczz/deployments/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kjaskiewiczz/deployments/git/refs{/sha}","trees_url":"https://api.github.com/repos/kjaskiewiczz/deployments/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kjaskiewiczz/deployments/statuses/{sha}","languages_url":"https://api.github.com/repos/kjaskiewiczz/deployments/languages","stargazers_url":"https://api.github.com/repos/kjaskiewiczz/deployments/stargazers","contributors_url":"https://api.github.com/repos/kjaskiewiczz/deployments/contributors","subscribers_url":"https://api.github.com/repos/kjaskiewiczz/deployments/subscribers","subscription_url":"https://api.github.com/repos/kjaskiewiczz/deployments/subscription","commits_url":"https://api.github.com/repos/kjaskiewiczz/deployments/commits{/sha}","git_commits_url":"https://api.github.com/repos/kjaskiewiczz/deployments/git/commits{/sha}","comments_url":"https://api.github.com/repos/kjaskiewiczz/deployments/comments{/number}","issue_comment_url":"https://api.github.com/repos/kjaskiewiczz/deployments/issues/comments{/number}","contents_url":"https://api.github.com/repos/kjaskiewiczz/deployments/contents/{+path}","compare_url":"https://api.github.com/repos/kjaskiewiczz/deployments/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kjaskiewiczz/deployments/merges","archive_url":"https://api.github.com/repos/kjaskiewiczz/deployments/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kjaskiewiczz/deployments/downloads","issues_url":"https://api.github.com/repos/kjaskiewiczz/deployments/issues{/number}","pulls_url":"https://api.github.com/repos/kjaskiewiczz/deployments/pulls{/number}","milestones_url":"https://api.github.com/repos/kjaskiewiczz/deployments/milestones{/number}","notifications_url":"https://api.github.com/repos/kjaskiewiczz/deployments/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kjaskiewiczz/deployments/labels{/name}","releases_url":"https://api.github.com/repos/kjaskiewiczz/deployments/releases{/id}","deployments_url":"https://api.github.com/repos/kjaskiewiczz/deployments/deployments","created_at":"2016-10-04T13:10:59Z","updated_at":"2016-10-04T13:11:00Z","pushed_at":"2017-03-09T13:43:55Z","git_url":"git://github.com/kjaskiewiczz/deployments.git","ssh_url":"git@github.com:kjaskiewiczz/deployments.git","clone_url":"https://github.com/kjaskiewiczz/deployments.git","svn_url":"https://github.com/kjaskiewiczz/deployments","homepage":"mender.io","size":6380,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"mendersoftware:master","ref":"master","sha":"ab35b4d2df9359e40c2fa964be14bc7e56db307e","user":{"login":"mendersoftware","id":15040539,"avatar_url":"https://avatars2.githubusercontent.com/u/15040539?v=3","gravatar_id":"","url":"https://api.github.com/users/mendersoftware","html_url":"https://github.com/mendersoftware","followers_url":"https://api.github.com/users/mendersoftware/followers","following_url":"https://api.github.com/users/mendersoftware/following{/other_user}","gists_url":"https://api.github.com/users/mendersoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/mendersoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mendersoftware/subscriptions","organizations_url":"https://api.github.com/users/mendersoftware/orgs","repos_url":"https://api.github.com/users/mendersoftware/repos","events_url":"https://api.github.com/users/mendersoftware/events{/privacy}","received_events_url":"https://api.github.com/users/mendersoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":46868944,"name":"deployments","full_name":"mendersoftware/deployments","owner":{"login":"mendersoftware","id":15040539,"avatar_url":"https://avatars2.githubusercontent.com/u/15040539?v=3","gravatar_id":"","url":"https://api.github.com/users/mendersoftware","html_url":"https://github.com/mendersoftware","followers_url":"https://api.github.com/users/mendersoftware/followers","following_url":"https://api.github.com/users/mendersoftware/following{/other_user}","gists_url":"https://api.github.com/users/mendersoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/mendersoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mendersoftware/subscriptions","organizations_url":"https://api.github.com/users/mendersoftware/orgs","repos_url":"https://api.github.com/users/mendersoftware/repos","events_url":"https://api.github.com/users/mendersoftware/events{/privacy}","received_events_url":"https://api.github.com/users/mendersoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mendersoftware/deployments","description":"Microservice for managing software deployments for IIoT devices within Mender ecosystem.","fork":false,"url":"https://api.github.com/repos/mendersoftware/deployments","forks_url":"https://api.github.com/repos/mendersoftware/deployments/forks","keys_url":"https://api.github.com/repos/mendersoftware/deployments/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mendersoftware/deployments/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mendersoftware/deployments/teams","hooks_url":"https://api.github.com/repos/mendersoftware/deployments/hooks","issue_events_url":"https://api.github.com/repos/mendersoftware/deployments/issues/events{/number}","events_url":"https://api.github.com/repos/mendersoftware/deployments/events","assignees_url":"https://api.github.com/repos/mendersoftware/deployments/assignees{/user}","branches_url":"https://api.github.com/repos/mendersoftware/deployments/branches{/branch}","tags_url":"https://api.github.com/repos/mendersoftware/deployments/tags","blobs_url":"https://api.github.com/repos/mendersoftware/deployments/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mendersoftware/deployments/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mendersoftware/deployments/git/refs{/sha}","trees_url":"https://api.github.com/repos/mendersoftware/deployments/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mendersoftware/deployments/statuses/{sha}","languages_url":"https://api.github.com/repos/mendersoftware/deployments/languages","stargazers_url":"https://api.github.com/repos/mendersoftware/deployments/stargazers","contributors_url":"https://api.github.com/repos/mendersoftware/deployments/contributors","subscribers_url":"https://api.github.com/repos/mendersoftware/deployments/subscribers","subscription_url":"https://api.github.com/repos/mendersoftware/deployments/subscription","commits_url":"https://api.github.com/repos/mendersoftware/deployments/commits{/sha}","git_commits_url":"https://api.github.com/repos/mendersoftware/deployments/git/commits{/sha}","comments_url":"https://api.github.com/repos/mendersoftware/deployments/comments{/number}","issue_comment_url":"https://api.github.com/repos/mendersoftware/deployments/issues/comments{/number}","contents_url":"https://api.github.com/repos/mendersoftware/deployments/contents/{+path}","compare_url":"https://api.github.com/repos/mendersoftware/deployments/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mendersoftware/deployments/merges","archive_url":"https://api.github.com/repos/mendersoftware/deployments/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mendersoftware/deployments/downloads","issues_url":"https://api.github.com/repos/mendersoftware/deployments/issues{/number}","pulls_url":"https://api.github.com/repos/mendersoftware/deployments/pulls{/number}","milestones_url":"https://api.github.com/repos/mendersoftware/deployments/milestones{/number}","notifications_url":"https://api.github.com/repos/mendersoftware/deployments/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mendersoftware/deployments/labels{/name}","releases_url":"https://api.github.com/repos/mendersoftware/deployments/releases{/id}","deployments_url":"https://api.github.com/repos/mendersoftware/deployments/deployments","created_at":"2015-11-25T15:09:38Z","updated_at":"2017-03-06T13:37:44Z","pushed_at":"2017-03-09T13:43:57Z","git_url":"git://github.com/mendersoftware/deployments.git","ssh_url":"git@github.com:mendersoftware/deployments.git","clone_url":"https://github.com/mendersoftware/deployments.git","svn_url":"https://github.com/mendersoftware/deployments","homepage":"mender.io","size":6357,"stargazers_count":6,"watchers_count":6,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":3,"forks":11,"open_issues":3,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mendersoftware/deployments/pulls/245"},"html":{"href":"https://github.com/mendersoftware/deployments/pull/245"},"issue":{"href":"https://api.github.com/repos/mendersoftware/deployments/issues/245"},"comments":{"href":"https://api.github.com/repos/mendersoftware/deployments/issues/245/comments"},"review_comments":{"href":"https://api.github.com/repos/mendersoftware/deployments/pulls/245/comments"},"review_comment":{"href":"https://api.github.com/repos/mendersoftware/deployments/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mendersoftware/deployments/pulls/245/commits"},"statuses":{"href":"https://api.github.com/repos/mendersoftware/deployments/statuses/089b9b7e12dba09333c27f82cea0163bc09890f0"}}}}
{"actor":{"display_login":"kjaskiewiczz"}}