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: skip incorrect action_date instead of failing c7n #7594

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion c7n/resources/opsworks.py
Expand Up @@ -64,7 +64,7 @@ def process_stack(self, stack):
instances = client.describe_instances(StackId=stack_id)['Instances']
orig_length = len(instances)
instances = self.filter_resources(instances, 'Status', self.valid_origin_states)
if(len(instances) != orig_length):
if len(instances) != orig_length:
self.log.exception(
"All instances must be stopped before deletion. Stack Id: %s Name: %s." %
(stack_id, stack['Name']))
Expand Down
3 changes: 2 additions & 1 deletion c7n/resources/rds.py
Expand Up @@ -1825,7 +1825,8 @@ class resource_type(TypeInfo):

@filters.register('consecutive-snapshots')
class ConsecutiveSnapshots(Filter):
"""Returns instances where number of consective daily snapshots is equal to/or greater than n days.
"""Returns instances where number of consective daily snapshots is
equal to/or greater than n days.

:example:

Expand Down
6 changes: 3 additions & 3 deletions c7n/resources/ssm.py
Expand Up @@ -719,7 +719,7 @@ def process(self, resources):
AccountIdsToRemove=r['c7n:CrossAccountViolations']
)
except client.exceptions.InvalidDocumentOperation as e:
raise(e)
raise e
else:
for r in resources:
try:
Expand All @@ -730,7 +730,7 @@ def process(self, resources):
AccountIdsToRemove=remove_accounts
)
except client.exceptions.InvalidDocumentOperation as e:
raise(e)
raise e


@SSMDocument.action_registry.register('delete')
Expand Down Expand Up @@ -783,7 +783,7 @@ def process(self, resources):
Force=True
)
else:
raise(e)
raise e


@resources.register('ssm-data-sync')
Expand Down
2 changes: 1 addition & 1 deletion c7n/resources/vpc.py
Expand Up @@ -2078,7 +2078,7 @@ def process_attached(self, client, associated_addrs):
client.disassociate_address(AssociationId=aa['AssociationId'])
except ClientError as e:
# If its already been diassociated ignore, else raise.
if not(e.response['Error']['Code'] == 'InvalidAssocationID.NotFound' and
if not (e.response['Error']['Code'] == 'InvalidAssocationID.NotFound' and
aa['AssocationId'] in e.response['Error']['Message']):
raise e
associated_addrs.remove(aa)
Expand Down
1 change: 1 addition & 0 deletions c7n/tags.py
Expand Up @@ -314,6 +314,7 @@ def __call__(self, i):
except Exception:
self.log.warning("could not parse tag:%s value:%s on %s" % (
tag, v, i['InstanceId']))
return False

if self.current_date is None:
self.current_date = datetime.now()
Expand Down
2 changes: 1 addition & 1 deletion c7n/utils.py
Expand Up @@ -523,7 +523,7 @@ def reformat_schema(model):
ret = copy.deepcopy(model.schema['properties'])

if 'type' in ret:
del(ret['type'])
del ret['type']

for key in model.schema.get('required', []):
if key in ret:
Expand Down