{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kops/issues/1367","repository_url":"https://api.github.com/repos/kubernetes/kops","labels_url":"https://api.github.com/repos/kubernetes/kops/issues/1367/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kops/issues/1367/comments","events_url":"https://api.github.com/repos/kubernetes/kops/issues/1367/events","html_url":"https://github.com/kubernetes/kops/pull/1367","id":199056719,"number":1367,"title":"WIP #1302 - Require a confirmation when deleting resources ","user":{"login":"frodopwns","id":782143,"avatar_url":"https://avatars.githubusercontent.com/u/782143?v=3","gravatar_id":"","url":"https://api.github.com/users/frodopwns","html_url":"https://github.com/frodopwns","followers_url":"https://api.github.com/users/frodopwns/followers","following_url":"https://api.github.com/users/frodopwns/following{/other_user}","gists_url":"https://api.github.com/users/frodopwns/gists{/gist_id}","starred_url":"https://api.github.com/users/frodopwns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frodopwns/subscriptions","organizations_url":"https://api.github.com/users/frodopwns/orgs","repos_url":"https://api.github.com/users/frodopwns/repos","events_url":"https://api.github.com/users/frodopwns/events{/privacy}","received_events_url":"https://api.github.com/users/frodopwns/received_events","type":"User","site_admin":false},"labels":[{"id":485059302,"url":"https://api.github.com/repos/kubernetes/kops/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"0e8a16","default":false},{"id":469752446,"url":"https://api.github.com/repos/kubernetes/kops/labels/WIP:%20Work%20In%20Progress","name":"WIP: Work In Progress","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":{"login":"kris-nova","id":13757818,"avatar_url":"https://avatars.githubusercontent.com/u/13757818?v=3","gravatar_id":"","url":"https://api.github.com/users/kris-nova","html_url":"https://github.com/kris-nova","followers_url":"https://api.github.com/users/kris-nova/followers","following_url":"https://api.github.com/users/kris-nova/following{/other_user}","gists_url":"https://api.github.com/users/kris-nova/gists{/gist_id}","starred_url":"https://api.github.com/users/kris-nova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kris-nova/subscriptions","organizations_url":"https://api.github.com/users/kris-nova/orgs","repos_url":"https://api.github.com/users/kris-nova/repos","events_url":"https://api.github.com/users/kris-nova/events{/privacy}","received_events_url":"https://api.github.com/users/kris-nova/received_events","type":"User","site_admin":false},"assignees":[{"login":"kris-nova","id":13757818,"avatar_url":"https://avatars.githubusercontent.com/u/13757818?v=3","gravatar_id":"","url":"https://api.github.com/users/kris-nova","html_url":"https://github.com/kris-nova","followers_url":"https://api.github.com/users/kris-nova/followers","following_url":"https://api.github.com/users/kris-nova/following{/other_user}","gists_url":"https://api.github.com/users/kris-nova/gists{/gist_id}","starred_url":"https://api.github.com/users/kris-nova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kris-nova/subscriptions","organizations_url":"https://api.github.com/users/kris-nova/orgs","repos_url":"https://api.github.com/users/kris-nova/repos","events_url":"https://api.github.com/users/kris-nova/events{/privacy}","received_events_url":"https://api.github.com/users/kris-nova/received_events","type":"User","site_admin":false}],"milestone":null,"comments":11,"created_at":"2017-01-05T20:54:46Z","updated_at":"2017-01-06T19:54:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kubernetes/kops/pulls/1367","html_url":"https://github.com/kubernetes/kops/pull/1367","diff_url":"https://github.com/kubernetes/kops/pull/1367.diff","patch_url":"https://github.com/kubernetes/kops/pull/1367.patch"},"body":"## The problem:\r\n\r\nWhen running the `kops delete` command there are no confirmation attempts made before deleting the resource. This can lead to mishaps that could be devastating to an organization.\r\n\r\n## The fix:\r\n\r\nTo solve this issue I created a PersistentPreRun hook on the deleteCmd which is the parent command for all resource deleting commands. This hook alerts the user that their actions cannot be undone and then asks for a confirmation. If the flag --yes is passed to the command the confirmation will be skipped.\r\n\r\n## The test:\r\n\r\n1. Check out the branch from my fork.\r\n2. Run `make`\r\n3. now run`kops delete ig mctester`. You should see output like:\r\n\r\n```\r\nkops delete ig mctester\r\nDo you really want to delete ig mctester? This action cannot be undone. (Y/n)\r\n```\r\n\r\nSelect `no` and ensure the program exits. Run it again and select `yes` and ensure the normal error for non existing resources is displayed..\r\n4. Run the same commands agains with `--yes` and ensure no confirmation attempt is made.\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.kubernetes.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kops/1367)\r\n<!-- Reviewable:end -->\r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes/kops/issues/comments/270990436","html_url":"https://github.com/kubernetes/kops/pull/1367#issuecomment-270990436","issue_url":"https://api.github.com/repos/kubernetes/kops/issues/1367","id":270990436,"user":{"login":"frodopwns","id":782143,"avatar_url":"https://avatars.githubusercontent.com/u/782143?v=3","gravatar_id":"","url":"https://api.github.com/users/frodopwns","html_url":"https://github.com/frodopwns","followers_url":"https://api.github.com/users/frodopwns/followers","following_url":"https://api.github.com/users/frodopwns/following{/other_user}","gists_url":"https://api.github.com/users/frodopwns/gists{/gist_id}","starred_url":"https://api.github.com/users/frodopwns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frodopwns/subscriptions","organizations_url":"https://api.github.com/users/frodopwns/orgs","repos_url":"https://api.github.com/users/frodopwns/repos","events_url":"https://api.github.com/users/frodopwns/events{/privacy}","received_events_url":"https://api.github.com/users/frodopwns/received_events","type":"User","site_admin":false},"created_at":"2017-01-06T19:54:26Z","updated_at":"2017-01-06T19:54:26Z","body":"nvm i see it, cluster implements its own yes flag"}}
{"actor":{"display_login":"frodopwns"}}