Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Upgrade/600/ntp #391

Open
wants to merge 2 commits into
base: enhancement/resource_base_class
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/appliance_time_and_locale_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@

# Update NTP servers and locale
# Set to use appliance local time and date server
time_and_locale['ntpServers'] = ['127.0.0.1']
# time_and_locale['ntpServers'] = ['127.0.0.1']
# Set locale to Chinese (China) with charset UTF-8
time_and_locale['locale'] = 'zh_CN.UTF-8'
# Remove the date and time, we do not want to update it manually
time_and_locale.pop('dateTime')
time_and_locale = oneview_client.appliance_time_and_locale_configuration.update(time_and_locale)
time_and_locale = oneview_client.appliance_time_and_locale_configuration.update(time_and_locale, force=False)
print("\n## Updated appliance time and locale configurations successfully!")
pprint(time_and_locale)

Expand Down
2 changes: 1 addition & 1 deletion examples/config-rename.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ip": "172.16.102.59",
"image_streamer_ip": "172.16.102.60",
"api_version": 500,
"api_version": 600,
"ssl_certificate": "",
"credentials": {
"userName": "administrator",
Expand Down
7 changes: 5 additions & 2 deletions hpOneView/resources/resource.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- ccding: utf-8 -*-
Copy link
Member

Choose a reason for hiding this comment

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

rename it back to coding

###
# (C) Copyright (2012-2018) Hewlett Packard Enterprise Development LP
#
Expand Down Expand Up @@ -1168,7 +1168,7 @@ def create_with_zero_body(self, uri=None, timeout=-1, custom_headers=None):

return self.__do_post(uri, {}, timeout, custom_headers)

def create(self, resource, uri=None, timeout=-1, custom_headers=None, default_values={}):
def create(self, resource, force=False, uri=None, timeout=-1, custom_headers=None, default_values={}):
Copy link
Member

Choose a reason for hiding this comment

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

add force args in the comments section as well

Copy link
Member

Choose a reason for hiding this comment

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

Also, i would suggest force to be added in the end of args list as it would not break any existing code.

"""
Makes a POST request to create a resource when a request body is required.

Expand Down Expand Up @@ -1202,6 +1202,9 @@ def create(self, resource, uri=None, timeout=-1, custom_headers=None, default_va
if not uri:
uri = self._uri

if force:
uri += '?force=True'

logger.debug('Create (uri = %s, resource = %s)' %
(uri, str(resource)))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get(self):
"""
return self._client.get(self.URI)

def update(self, resource, timeout=-1):
def update(self, resource, force=False, timeout=-1):
"""
Updates the appliance time and locale configuration.

Expand All @@ -71,4 +71,4 @@ def update(self, resource, timeout=-1):
dict: Updated appliance time and locale configuration.

"""
return self._client.create(resource, timeout=timeout, default_values=self.DEFAULT_VALUES)
return self._client.create(resource, force=force, timeout=timeout, default_values=self.DEFAULT_VALUES)
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ def test_update_called_once(self, mock_create):
'uri': None
}
self._time_and_locale.update(resource)
mock_create.assert_called_once_with(resource, timeout=-1, default_values=self._time_and_locale.DEFAULT_VALUES)
mock_create.assert_called_once_with(resource, force=False, timeout=-1, default_values=self._time_and_locale.DEFAULT_VALUES)