Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KeyError for PHD type with no events #5133

Merged
merged 3 commits into from Dec 5, 2019

Conversation

@myoung34
Copy link
Contributor

myoung34 commented Dec 2, 2019

Yaml:

policies:
  - name: phd
    resource: account
    comment: subscribe to PHD events
    mode:
      type: phd
      role: arn:aws:iam::1111111:role/cloud_custodian_role
    description: |
      All PHD events

Without this PR:

2019-12-02 12:35:17,711: custodian.commands:ERROR Error while executing policy phd, continuing
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/c7n/commands.py", line 283, in run
    policy()
  File "/usr/lib/python2.7/site-packages/c7n/policy.py", line 1030, in __call__
    resources = mode.provision()
  File "/usr/lib/python2.7/site-packages/c7n/policy.py", line 568, in provision
    role=self.policy.options.assume_role)
  File "/usr/lib/python2.7/site-packages/c7n/mu.py", line 375, in publish
    if e.add(func):
  File "/usr/lib/python2.7/site-packages/c7n/mu.py", line 1114, in add
    pattern = self.render_event_pattern()
  File "/usr/lib/python2.7/site-packages/c7n/mu.py", line 1090, in render_event_pattern
    'eventTypeCode': list(self.data['events'])}
KeyError: u'events'

With this PR:

Lambda works as expected

Resolves #5064

myoung34 added 2 commits Dec 2, 2019
@kapilt

This comment has been minimized.

Copy link
Collaborator

kapilt commented Dec 2, 2019

followup to #5066

@kapilt
kapilt approved these changes Dec 5, 2019
@kapilt kapilt merged commit e8c38d6 into cloud-custodian:master Dec 5, 2019
16 checks passed
16 checks passed
Custodian - CI #20191205.1 succeeded
Details
Custodian - CI (Container Cask) Container Cask succeeded
Details
Custodian - CI (Docs) Docs succeeded
Details
Custodian - CI (Lint) Lint succeeded
Details
Custodian - CI (Test Python27) Test Python27 succeeded
Details
Custodian - CI (Test Python36) Test Python36 succeeded
Details
Custodian - CI (Test Python37) Test Python37 succeeded
Details
Custodian - CI (Test Python38) Test Python38 succeeded
Details
Custodian - CI (Test Win2019 Python36) Test Win2019 Python36 succeeded
Details
Custodian - CI (Test Win2019 Python37) Test Win2019 Python37 succeeded
Details
codecov/patch 100% of diff hit (target 89.67%)
Details
codecov/project/azure 92.19% remains the same compared to a826604
Details
codecov/project/custodian 90.67% (+0.01%) compared to a826604
Details
codecov/project/gcp 91.39% remains the same compared to a826604
Details
codecov/project/k8s 93.72% remains the same compared to a826604
Details
codecov/project/mailer 62.09% remains the same compared to a826604
Details
@myoung34 myoung34 deleted the myoung34:phd_hotfix branch Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.