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

tencentcloud - mysql-backup - fix for casting date when status is not SUCCESS #8126

Merged

Conversation

thisisshi
Copy link
Member

Fixes the following bug:

Traceback (most recent call last):
  File "/Users/sonny/dev/thisisshi/cloud-custodian/c7n/commands.py", line 302, in run
    policy()
  File "/Users/sonny/dev/thisisshi/cloud-custodian/c7n/policy.py", line 1329, in __call__
    resources = mode.run()
  File "/Users/sonny/dev/thisisshi/cloud-custodian/c7n/policy.py", line 330, in run
    resources = self.policy.resource_manager.resources()
  File "/Users/sonny/dev/thisisshi/cloud-custodian/tools/c7n_tencentcloud/c7n_tencentcloud/query.py", line 307, in resources
    resources = self.augment(resources)
  File "/Users/sonny/dev/thisisshi/cloud-custodian/tools/c7n_tencentcloud/c7n_tencentcloud/resources/mysql_backup.py", line 54, in augment
    item["Date"] = isoformat_datetime_str(item["Date"],
  File "/Users/sonny/dev/thisisshi/cloud-custodian/tools/c7n_tencentcloud/c7n_tencentcloud/utils.py", line 28, in isoformat_datetime_str
    dt = timezone_from.localize(datetime.strptime(date_str, date_str_format))
  File "/usr/local/Cellar/[email protected]/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/Cellar/[email protected]/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '0000-00-00 00:00:00' does not match format '%Y-%m-%d %H:%M:%S'

policy:

  - name: tc-mysql-backup
    resource: tencentcloud.mysql-backup

@thisisshi thisisshi requested a review from kapilt as a code owner January 9, 2023 18:06
@thisisshi thisisshi changed the title tencentcloud - mysql-backup - fix for casting date when status is RUNNING tencentcloud - mysql-backup - fix for casting date when status is not SUCCESS Jan 9, 2023
Copy link
Collaborator

@kapilt kapilt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@thisisshi thisisshi merged commit 7c0ce9b into cloud-custodian:master Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants