Tags saved during site save#26
Conversation
There was a problem hiding this comment.
Overall looks good, just minor changes requested to tighten things up. I am a bit dissatisfied with the Nexpose API needing so many workarounds here, so I might try to get a fix for that into the product sometime soon and then we could improve this more after that. I won't hold up the merge based on pending product changes, though.
| for tag in self.tags: | ||
| for tag_data in tag: | ||
| tag_data_name = get_attribute(tag_data, 'name') | ||
| tag_data_value = get_attribute(tag_data, 'value') |
There was a problem hiding this comment.
Per flake8 output, tag_data_value is never used. Should probably be used in place of the calls to get_attribute(tag_data, 'value') in the below if blocks since the value shouldn't change until the name matches a condition.
| # CREATION_DATE must be in epoch time. | ||
| if tag_data_name == 'CREATION_DATE': | ||
| creation_date_value = get_attribute(tag_data, 'value') | ||
| creation_date_as_datetime = datetime.datetime.strptime(creation_date_value, '%a %b %d %H:%M:%S %Z %Y') |
There was a problem hiding this comment.
The date format string could be extracted to a constant, but I don't think it's a big deal.
Tags were not saved during a site save.
Description
The API returns a custom date/time format for tag's creation date that is converted into epoch and sent back. Discovered that "Built-In" tags do not return the default tag color so that is added. The "Built-In" tags also have a CREATOR_USER_ID of "0" which was throwing an exception. This block of code fixes these issues so the site info can be submitted successfully.
Motivation and Context
Fixes #22
How Has This Been Tested?
Can't...dev environment is still broken.
Types of changes