{"action":"created","comment":{"url":"https://api.github.com/repos/remind101/stacker/pulls/comments/50555812","id":50555812,"diff_hunk":"@@ -0,0 +1,146 @@\n+import logging\n+\n+from .. import exceptions\n+from ..plan import COMPLETE, SKIPPED, Plan\n+from . import build\n+import difflib\n+import json\n+import sys\n+\n+logger = logging.getLogger(__name__)\n+\n+\n+class Action(build.Action):\n+    \"\"\" Responsible for diff'ing CF stacks in AWS and on disk\n+\n+    Generates the build plan based on stack dependencies (these dependencies\n+    are determined automatically based on references to output values from\n+    other stacks).\n+\n+    The plan is then used to pull the current CloudFormation template from\n+    AWS and compare it to the generated templated based on the current\n+    config.\n+    \"\"\"\n+\n+    def _diff_parameters(self, old_params, new_params):\n+        \"\"\"Compares the old vs. new parameters and returns a 'diff'\n+\n+        Args:\n+            old_params(dict): old paramters\n+            new_params(dict): new parameters\n+\n+        Returns:\n+            int: number of changed entries\n+            string: \"diff\" of all parameters and how they changed\n+        \"\"\"\n+        output = []\n+        count = 0\n+        for k, v in old_params.iteritems():\n+            new_val = new_params.get(k, \"_Undef_\")\n+            if str(v) != str(new_val):\n+                output.append(\"CHANGED   %s: %s => %s\\n\" % (k, v, new_val))\n+                count += 1\n+            else:\n+                output.append(\"NO CHANGE %s: %s\\n\" % (k, v))\n+\n+        for k, v in new_params.iteritems():\n+            if not k in old_params:\n+                output.append(\"NEW       %s: %s\\n\" % (k, v))\n+                count += 1\n+\n+        return [count, \"\".join(output)]","path":"stacker/actions/diff.py","position":51,"original_position":51,"commit_id":"2f11809a73d041f973197a54011452885dd28dbe","original_commit_id":"2f11809a73d041f973197a54011452885dd28dbe","user":{"login":"mhahn","id":704593,"avatar_url":"https://avatars.githubusercontent.com/u/704593?v=3","gravatar_id":"","url":"https://api.github.com/users/mhahn","html_url":"https://github.com/mhahn","followers_url":"https://api.github.com/users/mhahn/followers","following_url":"https://api.github.com/users/mhahn/following{/other_user}","gists_url":"https://api.github.com/users/mhahn/gists{/gist_id}","starred_url":"https://api.github.com/users/mhahn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhahn/subscriptions","organizations_url":"https://api.github.com/users/mhahn/orgs","repos_url":"https://api.github.com/users/mhahn/repos","events_url":"https://api.github.com/users/mhahn/events{/privacy}","received_events_url":"https://api.github.com/users/mhahn/received_events","type":"User","site_admin":false},"body":"yea, i would break up the \"determine whats changed\" vs. \"format a message to the user\"","created_at":"2016-01-22T16:18:01Z","updated_at":"2016-01-22T16:18:01Z","html_url":"https://github.com/remind101/stacker/pull/133#discussion_r50555812","pull_request_url":"https://api.github.com/repos/remind101/stacker/pulls/133","_links":{"self":{"href":"https://api.github.com/repos/remind101/stacker/pulls/comments/50555812"},"html":{"href":"https://github.com/remind101/stacker/pull/133#discussion_r50555812"},"pull_request":{"href":"https://api.github.com/repos/remind101/stacker/pulls/133"}}},"pull_request":{"url":"https://api.github.com/repos/remind101/stacker/pulls/133","id":55983868,"html_url":"https://github.com/remind101/stacker/pull/133","diff_url":"https://github.com/remind101/stacker/pull/133.diff","patch_url":"https://github.com/remind101/stacker/pull/133.patch","issue_url":"https://api.github.com/repos/remind101/stacker/issues/133","number":133,"state":"open","locked":false,"title":"Add support for diffing existing vs. modified CF templates (redux)","user":{"login":"synfinatic","id":1075352,"avatar_url":"https://avatars.githubusercontent.com/u/1075352?v=3","gravatar_id":"","url":"https://api.github.com/users/synfinatic","html_url":"https://github.com/synfinatic","followers_url":"https://api.github.com/users/synfinatic/followers","following_url":"https://api.github.com/users/synfinatic/following{/other_user}","gists_url":"https://api.github.com/users/synfinatic/gists{/gist_id}","starred_url":"https://api.github.com/users/synfinatic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synfinatic/subscriptions","organizations_url":"https://api.github.com/users/synfinatic/orgs","repos_url":"https://api.github.com/users/synfinatic/repos","events_url":"https://api.github.com/users/synfinatic/events{/privacy}","received_events_url":"https://api.github.com/users/synfinatic/received_events","type":"User","site_admin":false},"body":"Sometimes it's hard to figure out what is different between your\r\nexisting CloudFormation deployment and the template changes you've made.\r\n\r\nNow you can specify the 'stacker diff' command to see\r\nwhat has changed in one or more stacks and get a feel for what\r\nchanges AWS will make when you deploy the changes for real.","created_at":"2016-01-14T02:03:32Z","updated_at":"2016-01-22T16:18:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d39d0750ccfadbbaad29d2266d74d8fe19fa50f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/remind101/stacker/pulls/133/commits","review_comments_url":"https://api.github.com/repos/remind101/stacker/pulls/133/comments","review_comment_url":"https://api.github.com/repos/remind101/stacker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/remind101/stacker/issues/133/comments","statuses_url":"https://api.github.com/repos/remind101/stacker/statuses/2f11809a73d041f973197a54011452885dd28dbe","head":{"label":"synfinatic:adt-add-diff-cmd","ref":"adt-add-diff-cmd","sha":"2f11809a73d041f973197a54011452885dd28dbe","user":{"login":"synfinatic","id":1075352,"avatar_url":"https://avatars.githubusercontent.com/u/1075352?v=3","gravatar_id":"","url":"https://api.github.com/users/synfinatic","html_url":"https://github.com/synfinatic","followers_url":"https://api.github.com/users/synfinatic/followers","following_url":"https://api.github.com/users/synfinatic/following{/other_user}","gists_url":"https://api.github.com/users/synfinatic/gists{/gist_id}","starred_url":"https://api.github.com/users/synfinatic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synfinatic/subscriptions","organizations_url":"https://api.github.com/users/synfinatic/orgs","repos_url":"https://api.github.com/users/synfinatic/repos","events_url":"https://api.github.com/users/synfinatic/events{/privacy}","received_events_url":"https://api.github.com/users/synfinatic/received_events","type":"User","site_admin":false},"repo":{"id":45276052,"name":"stacker","full_name":"synfinatic/stacker","owner":{"login":"synfinatic","id":1075352,"avatar_url":"https://avatars.githubusercontent.com/u/1075352?v=3","gravatar_id":"","url":"https://api.github.com/users/synfinatic","html_url":"https://github.com/synfinatic","followers_url":"https://api.github.com/users/synfinatic/followers","following_url":"https://api.github.com/users/synfinatic/following{/other_user}","gists_url":"https://api.github.com/users/synfinatic/gists{/gist_id}","starred_url":"https://api.github.com/users/synfinatic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synfinatic/subscriptions","organizations_url":"https://api.github.com/users/synfinatic/orgs","repos_url":"https://api.github.com/users/synfinatic/repos","events_url":"https://api.github.com/users/synfinatic/events{/privacy}","received_events_url":"https://api.github.com/users/synfinatic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/synfinatic/stacker","description":"An opinionated AWS CloudFormation Stack builder.","fork":true,"url":"https://api.github.com/repos/synfinatic/stacker","forks_url":"https://api.github.com/repos/synfinatic/stacker/forks","keys_url":"https://api.github.com/repos/synfinatic/stacker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/synfinatic/stacker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/synfinatic/stacker/teams","hooks_url":"https://api.github.com/repos/synfinatic/stacker/hooks","issue_events_url":"https://api.github.com/repos/synfinatic/stacker/issues/events{/number}","events_url":"https://api.github.com/repos/synfinatic/stacker/events","assignees_url":"https://api.github.com/repos/synfinatic/stacker/assignees{/user}","branches_url":"https://api.github.com/repos/synfinatic/stacker/branches{/branch}","tags_url":"https://api.github.com/repos/synfinatic/stacker/tags","blobs_url":"https://api.github.com/repos/synfinatic/stacker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/synfinatic/stacker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/synfinatic/stacker/git/refs{/sha}","trees_url":"https://api.github.com/repos/synfinatic/stacker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/synfinatic/stacker/statuses/{sha}","languages_url":"https://api.github.com/repos/synfinatic/stacker/languages","stargazers_url":"https://api.github.com/repos/synfinatic/stacker/stargazers","contributors_url":"https://api.github.com/repos/synfinatic/stacker/contributors","subscribers_url":"https://api.github.com/repos/synfinatic/stacker/subscribers","subscription_url":"https://api.github.com/repos/synfinatic/stacker/subscription","commits_url":"https://api.github.com/repos/synfinatic/stacker/commits{/sha}","git_commits_url":"https://api.github.com/repos/synfinatic/stacker/git/commits{/sha}","comments_url":"https://api.github.com/repos/synfinatic/stacker/comments{/number}","issue_comment_url":"https://api.github.com/repos/synfinatic/stacker/issues/comments{/number}","contents_url":"https://api.github.com/repos/synfinatic/stacker/contents/{+path}","compare_url":"https://api.github.com/repos/synfinatic/stacker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/synfinatic/stacker/merges","archive_url":"https://api.github.com/repos/synfinatic/stacker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/synfinatic/stacker/downloads","issues_url":"https://api.github.com/repos/synfinatic/stacker/issues{/number}","pulls_url":"https://api.github.com/repos/synfinatic/stacker/pulls{/number}","milestones_url":"https://api.github.com/repos/synfinatic/stacker/milestones{/number}","notifications_url":"https://api.github.com/repos/synfinatic/stacker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/synfinatic/stacker/labels{/name}","releases_url":"https://api.github.com/repos/synfinatic/stacker/releases{/id}","deployments_url":"https://api.github.com/repos/synfinatic/stacker/deployments","created_at":"2015-10-30T20:54:29Z","updated_at":"2015-10-30T20:54:30Z","pushed_at":"2016-01-21T22:24:37Z","git_url":"git://github.com/synfinatic/stacker.git","ssh_url":"git@github.com:synfinatic/stacker.git","clone_url":"https://github.com/synfinatic/stacker.git","svn_url":"https://github.com/synfinatic/stacker","homepage":null,"size":409,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"remind101:master","ref":"master","sha":"a664af6bffd12920cca52715b05f967143f8f309","user":{"login":"remind101","id":376343,"avatar_url":"https://avatars.githubusercontent.com/u/376343?v=3","gravatar_id":"","url":"https://api.github.com/users/remind101","html_url":"https://github.com/remind101","followers_url":"https://api.github.com/users/remind101/followers","following_url":"https://api.github.com/users/remind101/following{/other_user}","gists_url":"https://api.github.com/users/remind101/gists{/gist_id}","starred_url":"https://api.github.com/users/remind101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remind101/subscriptions","organizations_url":"https://api.github.com/users/remind101/orgs","repos_url":"https://api.github.com/users/remind101/repos","events_url":"https://api.github.com/users/remind101/events{/privacy}","received_events_url":"https://api.github.com/users/remind101/received_events","type":"Organization","site_admin":false},"repo":{"id":28885080,"name":"stacker","full_name":"remind101/stacker","owner":{"login":"remind101","id":376343,"avatar_url":"https://avatars.githubusercontent.com/u/376343?v=3","gravatar_id":"","url":"https://api.github.com/users/remind101","html_url":"https://github.com/remind101","followers_url":"https://api.github.com/users/remind101/followers","following_url":"https://api.github.com/users/remind101/following{/other_user}","gists_url":"https://api.github.com/users/remind101/gists{/gist_id}","starred_url":"https://api.github.com/users/remind101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remind101/subscriptions","organizations_url":"https://api.github.com/users/remind101/orgs","repos_url":"https://api.github.com/users/remind101/repos","events_url":"https://api.github.com/users/remind101/events{/privacy}","received_events_url":"https://api.github.com/users/remind101/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/remind101/stacker","description":"An opinionated AWS CloudFormation Stack builder.","fork":false,"url":"https://api.github.com/repos/remind101/stacker","forks_url":"https://api.github.com/repos/remind101/stacker/forks","keys_url":"https://api.github.com/repos/remind101/stacker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/remind101/stacker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/remind101/stacker/teams","hooks_url":"https://api.github.com/repos/remind101/stacker/hooks","issue_events_url":"https://api.github.com/repos/remind101/stacker/issues/events{/number}","events_url":"https://api.github.com/repos/remind101/stacker/events","assignees_url":"https://api.github.com/repos/remind101/stacker/assignees{/user}","branches_url":"https://api.github.com/repos/remind101/stacker/branches{/branch}","tags_url":"https://api.github.com/repos/remind101/stacker/tags","blobs_url":"https://api.github.com/repos/remind101/stacker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/remind101/stacker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/remind101/stacker/git/refs{/sha}","trees_url":"https://api.github.com/repos/remind101/stacker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/remind101/stacker/statuses/{sha}","languages_url":"https://api.github.com/repos/remind101/stacker/languages","stargazers_url":"https://api.github.com/repos/remind101/stacker/stargazers","contributors_url":"https://api.github.com/repos/remind101/stacker/contributors","subscribers_url":"https://api.github.com/repos/remind101/stacker/subscribers","subscription_url":"https://api.github.com/repos/remind101/stacker/subscription","commits_url":"https://api.github.com/repos/remind101/stacker/commits{/sha}","git_commits_url":"https://api.github.com/repos/remind101/stacker/git/commits{/sha}","comments_url":"https://api.github.com/repos/remind101/stacker/comments{/number}","issue_comment_url":"https://api.github.com/repos/remind101/stacker/issues/comments{/number}","contents_url":"https://api.github.com/repos/remind101/stacker/contents/{+path}","compare_url":"https://api.github.com/repos/remind101/stacker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/remind101/stacker/merges","archive_url":"https://api.github.com/repos/remind101/stacker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/remind101/stacker/downloads","issues_url":"https://api.github.com/repos/remind101/stacker/issues{/number}","pulls_url":"https://api.github.com/repos/remind101/stacker/pulls{/number}","milestones_url":"https://api.github.com/repos/remind101/stacker/milestones{/number}","notifications_url":"https://api.github.com/repos/remind101/stacker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/remind101/stacker/labels{/name}","releases_url":"https://api.github.com/repos/remind101/stacker/releases{/id}","deployments_url":"https://api.github.com/repos/remind101/stacker/deployments","created_at":"2015-01-06T21:46:05Z","updated_at":"2016-01-17T23:04:23Z","pushed_at":"2016-01-21T22:24:37Z","git_url":"git://github.com/remind101/stacker.git","ssh_url":"git@github.com:remind101/stacker.git","clone_url":"https://github.com/remind101/stacker.git","svn_url":"https://github.com/remind101/stacker","homepage":null,"size":467,"stargazers_count":49,"watchers_count":49,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":19,"forks":18,"open_issues":19,"watchers":49,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/remind101/stacker/pulls/133"},"html":{"href":"https://github.com/remind101/stacker/pull/133"},"issue":{"href":"https://api.github.com/repos/remind101/stacker/issues/133"},"comments":{"href":"https://api.github.com/repos/remind101/stacker/issues/133/comments"},"review_comments":{"href":"https://api.github.com/repos/remind101/stacker/pulls/133/comments"},"review_comment":{"href":"https://api.github.com/repos/remind101/stacker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/remind101/stacker/pulls/133/commits"},"statuses":{"href":"https://api.github.com/repos/remind101/stacker/statuses/2f11809a73d041f973197a54011452885dd28dbe"}}}}