-
Notifications
You must be signed in to change notification settings - Fork 65
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
time_and_locale_branch #646
Conversation
…kard/oneview-ansible into time_and_locale_branch
|
||
|
||
class ApplianceTimeAndLocaleConfigurationModule(OneViewModuleBase): | ||
MSG_UPDATED = 'Appliance Locale and Time Configuration updated successfully.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing Update Msg, does this resource do not have PUT/PATCH Operation?
added_timeconfig_and_documentation
@@ -80,8 +81,19 @@ def __init__(self): | |||
self.resource_client = self.oneview_client.appliance_time_and_locale_configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use set_resource_object method as we follow the same part of refactoring
author: | ||
"Thiago Miotto (@tmiotto)" | ||
"Shanmugam M (@SHANDCRUZ)" | ||
extends_documentation_fragment: | ||
- oneview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add oneview.validateetag
added_ssh_access
short_description: Retrieve the facts about the OneView appliance time configuration. | ||
description: | ||
- Retrieve the facts about the OneView appliance time configuration. | ||
version_added: "2.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change version to "2.9". This is the ansible version.
version_added: "2.4" | ||
requirements: | ||
- "python >= 3.4.2" | ||
- "hpeOneView >= 5.6.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change hpeOneView >= 6.0.0.
Follow the same for all resources
def execute_module(self): | ||
changed, msg, ansible_facts = False, '', {} | ||
appliance_ssh_access = self.resource_client.get_all() | ||
self.current_resource = appliance_ssh_access |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
directly assign self.resource_client.get_all()
to self.current_resource
class ApplianceTimeAndLocaleConfigurationModule(OneViewModuleBase): | ||
MSG_UPDATED = 'Appliance Locale and Time Configuration updated successfully.' | ||
class ApplianceTimeAndLocaleConfigurationModule(OneViewModule): | ||
MSG_CREATED = 'Appliance Locale and Time Configuration created successfully.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modify the message to avoid confusion
MSG_CREATED = 'Appliance Locale and Time Configuration configured successfully.'
|
||
def __present(self): | ||
self.current_resource = self.resource_client.get_all() | ||
merged_data = self.current_resource.data.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the return value of self.resource_client.get_all()
is None..?
self.current_resource.data.copy()
value will fail saying None type has no 'data' attribute. So add the if condition before that.
…kard/oneview-ansible into added_time_and_locale
self.current_resource = self.resource_client.create(self.data) | ||
return True, self.MSG_CREATED, dict(appliance_time_and_locale_configuration=self.current_resource.data) | ||
else: | ||
return False, self.MSG_ALREADY_PRESENT, dict(appliance_time_and_locale_configuration=self.current_resource.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try the below code
def __present(self):
resource_data = {}
self.current_resource = self.resource_client.get_all()
if self.current_resource:
resource_data = self.current_resource.data.copy()
merged_data = resource_data.copy()
merged_data.update(self.data)
if not compare(resource_data, merged_data):
self.current_resource = self.resource_client.create(self.data)
return True, self.MSG_CREATED, dict(appliance_time_and_locale_configuration=self.current_resource.data)
else:
return False, self.MSG_ALREADY_PRESENT, dict(appliance_time_and_locale_configuration=resource_data)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Refactored Appliance Time and Locale Configuration
Issues Resolved
None
Check List
$ ./build.sh
).