{"action":"closed","issue":{"url":"https://api.github.com/repos/capitalone/cloud-custodian/issues/560","repository_url":"https://api.github.com/repos/capitalone/cloud-custodian","labels_url":"https://api.github.com/repos/capitalone/cloud-custodian/issues/560/labels{/name}","comments_url":"https://api.github.com/repos/capitalone/cloud-custodian/issues/560/comments","events_url":"https://api.github.com/repos/capitalone/cloud-custodian/issues/560/events","html_url":"https://github.com/capitalone/cloud-custodian/issues/560","id":186630312,"number":560,"title":"report subcommand accepts --region, but doesn't use it","user":{"login":"scotwk","id":2279506,"avatar_url":"https://avatars.githubusercontent.com/u/2279506?v=3","gravatar_id":"","url":"https://api.github.com/users/scotwk","html_url":"https://github.com/scotwk","followers_url":"https://api.github.com/users/scotwk/followers","following_url":"https://api.github.com/users/scotwk/following{/other_user}","gists_url":"https://api.github.com/users/scotwk/gists{/gist_id}","starred_url":"https://api.github.com/users/scotwk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scotwk/subscriptions","organizations_url":"https://api.github.com/users/scotwk/orgs","repos_url":"https://api.github.com/users/scotwk/repos","events_url":"https://api.github.com/users/scotwk/events{/privacy}","received_events_url":"https://api.github.com/users/scotwk/received_events","type":"User","site_admin":false},"labels":[{"id":390675751,"url":"https://api.github.com/repos/capitalone/cloud-custodian/labels/area/cli","name":"area/cli","color":"d93f0b","default":false},{"id":390676190,"url":"https://api.github.com/repos/capitalone/cloud-custodian/labels/kind/bug","name":"kind/bug","color":"0052cc","default":false},{"id":390677170,"url":"https://api.github.com/repos/capitalone/cloud-custodian/labels/scope/bitesize","name":"scope/bitesize","color":"0e8a16","default":false}],"state":"closed","locked":false,"assignee":{"login":"scotwk","id":2279506,"avatar_url":"https://avatars.githubusercontent.com/u/2279506?v=3","gravatar_id":"","url":"https://api.github.com/users/scotwk","html_url":"https://github.com/scotwk","followers_url":"https://api.github.com/users/scotwk/followers","following_url":"https://api.github.com/users/scotwk/following{/other_user}","gists_url":"https://api.github.com/users/scotwk/gists{/gist_id}","starred_url":"https://api.github.com/users/scotwk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scotwk/subscriptions","organizations_url":"https://api.github.com/users/scotwk/orgs","repos_url":"https://api.github.com/users/scotwk/repos","events_url":"https://api.github.com/users/scotwk/events{/privacy}","received_events_url":"https://api.github.com/users/scotwk/received_events","type":"User","site_admin":false},"assignees":[{"login":"scotwk","id":2279506,"avatar_url":"https://avatars.githubusercontent.com/u/2279506?v=3","gravatar_id":"","url":"https://api.github.com/users/scotwk","html_url":"https://github.com/scotwk","followers_url":"https://api.github.com/users/scotwk/followers","following_url":"https://api.github.com/users/scotwk/following{/other_user}","gists_url":"https://api.github.com/users/scotwk/gists{/gist_id}","starred_url":"https://api.github.com/users/scotwk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scotwk/subscriptions","organizations_url":"https://api.github.com/users/scotwk/orgs","repos_url":"https://api.github.com/users/scotwk/repos","events_url":"https://api.github.com/users/scotwk/events{/privacy}","received_events_url":"https://api.github.com/users/scotwk/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2016-11-01T19:55:37Z","updated_at":"2016-11-15T17:45:27Z","closed_at":"2016-11-15T17:45:27Z","body":"I don't know if this is true for all services, but at least for ec2, I have a sample policy here that lists running instances.\r\n\r\n```\r\npolicies:\r\n- name: ec2-running-instances\r\n  resource: ec2\r\n  comment: |\r\n    Report all running instances\r\n  query:\r\n    - instance-state-name: running\r\n```\r\n\r\nAnd here are some examples of running it.\r\n\r\nThis example shows it works properly in a basic use case against us-east-1:\r\n\r\n```\r\n$ custodian run -c report.yml -s out -r us-east-1\r\n2016-11-01 15:49:48,461: custodian.policy:INFO Running policy ec2-running-instances resource: ec2 region:us-east-1 c7n:0.8.19.7\r\n2016-11-01 15:49:48,461: custodian.resources.ec2:INFO Filtered from 1 to 1 ec2\r\n2016-11-01 15:49:48,461: custodian.policy:INFO policy: ec2-running-instances resource:ec2 has count:1 time:0.00\r\n\r\n$ custodian report -c report.yml -s out\r\naction-date,instance-id,name,instance-type,launch,vpc-id,ip-addr,asv,env,owner\r\n2016-11-01,i-09c1c849ee8955035,c7n-test-ec2,t2.micro,2016-10-25T13:08:35+00:00,vpc-d2d616b5,172.31.27.131,,,\r\n```\r\n\r\nThis example shows a problem.  Note that us-east-2 has no instances (as seen in the output from the first command).  But when I try to run a report from us-east-1 it shows nothing (because `resources.json` has been overwritten by the second time this was run)\r\n\r\n```\r\n$ custodian run -c report.yml -s out -r us-east-2\r\n2016-11-01 15:51:43,892: custodian.policy:INFO Running policy ec2-running-instances resource: ec2 region:us-east-2 c7n:0.8.19.7\r\n2016-11-01 15:51:43,893: custodian.resources.ec2:INFO Filtered from 0 to 0 ec2\r\n2016-11-01 15:51:43,893: custodian.policy:INFO policy: ec2-running-instances resource:ec2 has count:0 time:0.00\r\n\r\n$ custodian report -c report.yml -s out -r us-east-1\r\naction-date,instance-id,name,instance-type,launch,vpc-id,ip-addr,asv,env,owner\r\n```\r\n\r\nAnd now the opposite.  Run against us-east-1 and run the report against us-east-2 (which should have no running instances) but it shows one:\r\n\r\n```\r\n$ custodian run -c report.yml -s out -r us-east-1\r\n2016-11-01 15:52:41,884: custodian.policy:INFO Running policy ec2-running-instances resource: ec2 region:us-east-1 c7n:0.8.19.7\r\n2016-11-01 15:52:41,884: custodian.resources.ec2:INFO Filtered from 1 to 1 ec2\r\n2016-11-01 15:52:41,884: custodian.policy:INFO policy: ec2-running-instances resource:ec2 has count:1 time:0.00\r\n\r\n$ custodian report -c report.yml -s out -r us-east-2\r\naction-date,instance-id,name,instance-type,launch,vpc-id,ip-addr,asv,env,owner\r\n2016-11-01,i-09c1c849ee8955035,c7n-test-ec2,t2.micro,2016-10-25T13:08:35+00:00,vpc-d2d616b5,172.31.27.131,,,\r\n```\r\n\r\nDo output files need to be stored as region-specific?  Or is the easier fix just to remove `--region` as an option from the `report` subcommand?"}}
{"actor":{"display_login":"kapilt"}}