{"action":"created","comment":{"url":"https://api.github.com/repos/doximity/capistrano-asg/pulls/comments/231221221","pull_request_review_id":172143183,"id":231221221,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTIyMTIyMQ==","diff_hunk":"@@ -38,22 +39,43 @@ def autoscale(groupname, *args)\n   (regions[region] ||= []) << groupname\n   set :regions, regions\n \n+  # Create an array of role names to be distributed across the ASG\n+  partial_queue = []\n+  if args.key?(:partial_roles)\n+    args[:partial_roles].each do |partial|\n+      instances = partial.key?(:instances) ? partial[:instances] : 1\n+      instances.times { partial_queue << partial[:name].to_s }\n+    end\n+    args.delete(:partial_roles)\n+  end\n+\n   asg_instances.each do |asg_instance|\n     if asg_instance.health_status != 'Healthy'\n       puts \"Autoscaling: Skipping unhealthy instance #{asg_instance.id}\"\n     else\n-      ec2_instance = ec2_resource.instance(asg_instance.id)\n-      hostname = ec2_instance.private_ip_address\n-      puts \"Autoscaling: Adding server #{hostname}\"\n-      server(hostname, *args)\n+      with_retry do\n+        ec2_instance = ec2_resource.instance(asg_instance.id)\n+        hostname = ec2_instance.private_ip_address\n+        puts \"Autoscaling: Adding server #{hostname}\"\n+        # create a complete temp copy of the array contents instead of just copying the references\n+        host_args = Marshal.load(Marshal.dump(args))","path":"lib/capistrano/asg.rb","position":40,"original_position":40,"commit_id":"f9def030bf9b10402fdfc7d45d77b8621558aaa0","original_commit_id":"f9def030bf9b10402fdfc7d45d77b8621558aaa0","user":{"login":"genehand","id":1693883,"node_id":"MDQ6VXNlcjE2OTM4ODM=","avatar_url":"https://avatars2.githubusercontent.com/u/1693883?v=4","gravatar_id":"","url":"https://api.github.com/users/genehand","html_url":"https://github.com/genehand","followers_url":"https://api.github.com/users/genehand/followers","following_url":"https://api.github.com/users/genehand/following{/other_user}","gists_url":"https://api.github.com/users/genehand/gists{/gist_id}","starred_url":"https://api.github.com/users/genehand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genehand/subscriptions","organizations_url":"https://api.github.com/users/genehand/orgs","repos_url":"https://api.github.com/users/genehand/repos","events_url":"https://api.github.com/users/genehand/events{/privacy}","received_events_url":"https://api.github.com/users/genehand/received_events","type":"User","site_admin":false},"body":"What I ran into when trying to make a copy of the `args` array is that it was copying references, so when I updated the temp `host_args` it also updated the values in the original array.  Looks like there are some gems out there to accomplish this - https://stackoverflow.com/questions/8206523/how-to-create-a-deep-copy-of-an-object-in-ruby\r\n\r\nWhat do you suggest?","created_at":"2018-11-06T17:37:39Z","updated_at":"2018-11-06T17:37:39Z","html_url":"https://github.com/doximity/capistrano-asg/pull/1#discussion_r231221221","pull_request_url":"https://api.github.com/repos/doximity/capistrano-asg/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/doximity/capistrano-asg/pulls/comments/231221221"},"html":{"href":"https://github.com/doximity/capistrano-asg/pull/1#discussion_r231221221"},"pull_request":{"href":"https://api.github.com/repos/doximity/capistrano-asg/pulls/1"}},"in_reply_to_id":231213777},"pull_request":{"url":"https://api.github.com/repos/doximity/capistrano-asg/pulls/1","id":228539985,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4NTM5OTg1","html_url":"https://github.com/doximity/capistrano-asg/pull/1","diff_url":"https://github.com/doximity/capistrano-asg/pull/1.diff","patch_url":"https://github.com/doximity/capistrano-asg/pull/1.patch","issue_url":"https://api.github.com/repos/doximity/capistrano-asg/issues/1","number":1,"state":"open","locked":false,"title":"Add :partial_roles and wrap EC2 calls with retries","user":{"login":"genehand","id":1693883,"node_id":"MDQ6VXNlcjE2OTM4ODM=","avatar_url":"https://avatars2.githubusercontent.com/u/1693883?v=4","gravatar_id":"","url":"https://api.github.com/users/genehand","html_url":"https://github.com/genehand","followers_url":"https://api.github.com/users/genehand/followers","following_url":"https://api.github.com/users/genehand/following{/other_user}","gists_url":"https://api.github.com/users/genehand/gists{/gist_id}","starred_url":"https://api.github.com/users/genehand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genehand/subscriptions","organizations_url":"https://api.github.com/users/genehand/orgs","repos_url":"https://api.github.com/users/genehand/repos","events_url":"https://api.github.com/users/genehand/events{/privacy}","received_events_url":"https://api.github.com/users/genehand/received_events","type":"User","site_admin":false},"body":"https://www.pivotaltracker.com/story/show/161725819\r\n\r\nWrap EC2 calls with retries in case we hit API rate limits.  Also includes :partial_roles to only run on a subset of instances in the ASG\r\n\r\nNote that we've been using version 0.6.1 of capistrano-asg and this is based off 0.7.0 that uses the aws-sdk v3 (may require additional Gemfile updates in the apps)","created_at":"2018-11-06T00:42:54Z","updated_at":"2018-11-06T17:37:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b9f3cc4cb8c4731b599169752c8890a675df4e2d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/doximity/capistrano-asg/pulls/1/commits","review_comments_url":"https://api.github.com/repos/doximity/capistrano-asg/pulls/1/comments","review_comment_url":"https://api.github.com/repos/doximity/capistrano-asg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/doximity/capistrano-asg/issues/1/comments","statuses_url":"https://api.github.com/repos/doximity/capistrano-asg/statuses/f9def030bf9b10402fdfc7d45d77b8621558aaa0","head":{"label":"doximity:partial-and-retry","ref":"partial-and-retry","sha":"f9def030bf9b10402fdfc7d45d77b8621558aaa0","user":{"login":"doximity","id":181836,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4MTgzNg==","avatar_url":"https://avatars2.githubusercontent.com/u/181836?v=4","gravatar_id":"","url":"https://api.github.com/users/doximity","html_url":"https://github.com/doximity","followers_url":"https://api.github.com/users/doximity/followers","following_url":"https://api.github.com/users/doximity/following{/other_user}","gists_url":"https://api.github.com/users/doximity/gists{/gist_id}","starred_url":"https://api.github.com/users/doximity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doximity/subscriptions","organizations_url":"https://api.github.com/users/doximity/orgs","repos_url":"https://api.github.com/users/doximity/repos","events_url":"https://api.github.com/users/doximity/events{/privacy}","received_events_url":"https://api.github.com/users/doximity/received_events","type":"Organization","site_admin":false},"repo":{"id":156297827,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYyOTc4Mjc=","name":"capistrano-asg","full_name":"doximity/capistrano-asg","private":false,"owner":{"login":"doximity","id":181836,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4MTgzNg==","avatar_url":"https://avatars2.githubusercontent.com/u/181836?v=4","gravatar_id":"","url":"https://api.github.com/users/doximity","html_url":"https://github.com/doximity","followers_url":"https://api.github.com/users/doximity/followers","following_url":"https://api.github.com/users/doximity/following{/other_user}","gists_url":"https://api.github.com/users/doximity/gists{/gist_id}","starred_url":"https://api.github.com/users/doximity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doximity/subscriptions","organizations_url":"https://api.github.com/users/doximity/orgs","repos_url":"https://api.github.com/users/doximity/repos","events_url":"https://api.github.com/users/doximity/events{/privacy}","received_events_url":"https://api.github.com/users/doximity/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/doximity/capistrano-asg","description":"Automatically create new AMIs when deploying with capistrano","fork":true,"url":"https://api.github.com/repos/doximity/capistrano-asg","forks_url":"https://api.github.com/repos/doximity/capistrano-asg/forks","keys_url":"https://api.github.com/repos/doximity/capistrano-asg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/doximity/capistrano-asg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/doximity/capistrano-asg/teams","hooks_url":"https://api.github.com/repos/doximity/capistrano-asg/hooks","issue_events_url":"https://api.github.com/repos/doximity/capistrano-asg/issues/events{/number}","events_url":"https://api.github.com/repos/doximity/capistrano-asg/events","assignees_url":"https://api.github.com/repos/doximity/capistrano-asg/assignees{/user}","branches_url":"https://api.github.com/repos/doximity/capistrano-asg/branches{/branch}","tags_url":"https://api.github.com/repos/doximity/capistrano-asg/tags","blobs_url":"https://api.github.com/repos/doximity/capistrano-asg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/doximity/capistrano-asg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/doximity/capistrano-asg/git/refs{/sha}","trees_url":"https://api.github.com/repos/doximity/capistrano-asg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/doximity/capistrano-asg/statuses/{sha}","languages_url":"https://api.github.com/repos/doximity/capistrano-asg/languages","stargazers_url":"https://api.github.com/repos/doximity/capistrano-asg/stargazers","contributors_url":"https://api.github.com/repos/doximity/capistrano-asg/contributors","subscribers_url":"https://api.github.com/repos/doximity/capistrano-asg/subscribers","subscription_url":"https://api.github.com/repos/doximity/capistrano-asg/subscription","commits_url":"https://api.github.com/repos/doximity/capistrano-asg/commits{/sha}","git_commits_url":"https://api.github.com/repos/doximity/capistrano-asg/git/commits{/sha}","comments_url":"https://api.github.com/repos/doximity/capistrano-asg/comments{/number}","issue_comment_url":"https://api.github.com/repos/doximity/capistrano-asg/issues/comments{/number}","contents_url":"https://api.github.com/repos/doximity/capistrano-asg/contents/{+path}","compare_url":"https://api.github.com/repos/doximity/capistrano-asg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/doximity/capistrano-asg/merges","archive_url":"https://api.github.com/repos/doximity/capistrano-asg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/doximity/capistrano-asg/downloads","issues_url":"https://api.github.com/repos/doximity/capistrano-asg/issues{/number}","pulls_url":"https://api.github.com/repos/doximity/capistrano-asg/pulls{/number}","milestones_url":"https://api.github.com/repos/doximity/capistrano-asg/milestones{/number}","notifications_url":"https://api.github.com/repos/doximity/capistrano-asg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/doximity/capistrano-asg/labels{/name}","releases_url":"https://api.github.com/repos/doximity/capistrano-asg/releases{/id}","deployments_url":"https://api.github.com/repos/doximity/capistrano-asg/deployments","created_at":"2018-11-05T23:33:34Z","updated_at":"2018-11-05T23:33:36Z","pushed_at":"2018-11-06T00:42:54Z","git_url":"git://github.com/doximity/capistrano-asg.git","ssh_url":"git@github.com:doximity/capistrano-asg.git","clone_url":"https://github.com/doximity/capistrano-asg.git","svn_url":"https://github.com/doximity/capistrano-asg","homepage":null,"size":89,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"doximity:master","ref":"master","sha":"147bbbc9753feba80d6ea2a74a6eb40ccb174076","user":{"login":"doximity","id":181836,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4MTgzNg==","avatar_url":"https://avatars2.githubusercontent.com/u/181836?v=4","gravatar_id":"","url":"https://api.github.com/users/doximity","html_url":"https://github.com/doximity","followers_url":"https://api.github.com/users/doximity/followers","following_url":"https://api.github.com/users/doximity/following{/other_user}","gists_url":"https://api.github.com/users/doximity/gists{/gist_id}","starred_url":"https://api.github.com/users/doximity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doximity/subscriptions","organizations_url":"https://api.github.com/users/doximity/orgs","repos_url":"https://api.github.com/users/doximity/repos","events_url":"https://api.github.com/users/doximity/events{/privacy}","received_events_url":"https://api.github.com/users/doximity/received_events","type":"Organization","site_admin":false},"repo":{"id":156297827,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYyOTc4Mjc=","name":"capistrano-asg","full_name":"doximity/capistrano-asg","private":false,"owner":{"login":"doximity","id":181836,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4MTgzNg==","avatar_url":"https://avatars2.githubusercontent.com/u/181836?v=4","gravatar_id":"","url":"https://api.github.com/users/doximity","html_url":"https://github.com/doximity","followers_url":"https://api.github.com/users/doximity/followers","following_url":"https://api.github.com/users/doximity/following{/other_user}","gists_url":"https://api.github.com/users/doximity/gists{/gist_id}","starred_url":"https://api.github.com/users/doximity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doximity/subscriptions","organizations_url":"https://api.github.com/users/doximity/orgs","repos_url":"https://api.github.com/users/doximity/repos","events_url":"https://api.github.com/users/doximity/events{/privacy}","received_events_url":"https://api.github.com/users/doximity/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/doximity/capistrano-asg","description":"Automatically create new AMIs when deploying with capistrano","fork":true,"url":"https://api.github.com/repos/doximity/capistrano-asg","forks_url":"https://api.github.com/repos/doximity/capistrano-asg/forks","keys_url":"https://api.github.com/repos/doximity/capistrano-asg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/doximity/capistrano-asg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/doximity/capistrano-asg/teams","hooks_url":"https://api.github.com/repos/doximity/capistrano-asg/hooks","issue_events_url":"https://api.github.com/repos/doximity/capistrano-asg/issues/events{/number}","events_url":"https://api.github.com/repos/doximity/capistrano-asg/events","assignees_url":"https://api.github.com/repos/doximity/capistrano-asg/assignees{/user}","branches_url":"https://api.github.com/repos/doximity/capistrano-asg/branches{/branch}","tags_url":"https://api.github.com/repos/doximity/capistrano-asg/tags","blobs_url":"https://api.github.com/repos/doximity/capistrano-asg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/doximity/capistrano-asg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/doximity/capistrano-asg/git/refs{/sha}","trees_url":"https://api.github.com/repos/doximity/capistrano-asg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/doximity/capistrano-asg/statuses/{sha}","languages_url":"https://api.github.com/repos/doximity/capistrano-asg/languages","stargazers_url":"https://api.github.com/repos/doximity/capistrano-asg/stargazers","contributors_url":"https://api.github.com/repos/doximity/capistrano-asg/contributors","subscribers_url":"https://api.github.com/repos/doximity/capistrano-asg/subscribers","subscription_url":"https://api.github.com/repos/doximity/capistrano-asg/subscription","commits_url":"https://api.github.com/repos/doximity/capistrano-asg/commits{/sha}","git_commits_url":"https://api.github.com/repos/doximity/capistrano-asg/git/commits{/sha}","comments_url":"https://api.github.com/repos/doximity/capistrano-asg/comments{/number}","issue_comment_url":"https://api.github.com/repos/doximity/capistrano-asg/issues/comments{/number}","contents_url":"https://api.github.com/repos/doximity/capistrano-asg/contents/{+path}","compare_url":"https://api.github.com/repos/doximity/capistrano-asg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/doximity/capistrano-asg/merges","archive_url":"https://api.github.com/repos/doximity/capistrano-asg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/doximity/capistrano-asg/downloads","issues_url":"https://api.github.com/repos/doximity/capistrano-asg/issues{/number}","pulls_url":"https://api.github.com/repos/doximity/capistrano-asg/pulls{/number}","milestones_url":"https://api.github.com/repos/doximity/capistrano-asg/milestones{/number}","notifications_url":"https://api.github.com/repos/doximity/capistrano-asg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/doximity/capistrano-asg/labels{/name}","releases_url":"https://api.github.com/repos/doximity/capistrano-asg/releases{/id}","deployments_url":"https://api.github.com/repos/doximity/capistrano-asg/deployments","created_at":"2018-11-05T23:33:34Z","updated_at":"2018-11-05T23:33:36Z","pushed_at":"2018-11-06T00:42:54Z","git_url":"git://github.com/doximity/capistrano-asg.git","ssh_url":"git@github.com:doximity/capistrano-asg.git","clone_url":"https://github.com/doximity/capistrano-asg.git","svn_url":"https://github.com/doximity/capistrano-asg","homepage":null,"size":89,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/doximity/capistrano-asg/pulls/1"},"html":{"href":"https://github.com/doximity/capistrano-asg/pull/1"},"issue":{"href":"https://api.github.com/repos/doximity/capistrano-asg/issues/1"},"comments":{"href":"https://api.github.com/repos/doximity/capistrano-asg/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/doximity/capistrano-asg/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/doximity/capistrano-asg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/doximity/capistrano-asg/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/doximity/capistrano-asg/statuses/f9def030bf9b10402fdfc7d45d77b8621558aaa0"}},"author_association":"NONE"}}
{"actor":{"display_login":"genehand"}}