mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
NetworkSetFactsModule for HPE OneView (#28730)
* Add NetworkSetFactsModule for retrieving HPE OneView Network Sets - Allow querying for Network Set resources in HPE OneView - Adds unit tests to new module - Updates oneview_module_loader copyright header to short GPL3 version * Adding possibility to pass in credentials as parameters * Removed required false and changed format of filter_by_name declaration * Updated examples in docs to reflect new way to pass in credentials - All examples of the oneview_network_set_facts updated to use credential parameters - All required=False from oneview base module removed - Shared docs updated to bring attention to API version being used
This commit is contained in:
parent
b3dbd1bca8
commit
a4ae8536d9
5 changed files with 290 additions and 31 deletions
|
@ -202,15 +202,15 @@ class OneViewModuleBase(object):
|
|||
HPE_ONEVIEW_SDK_REQUIRED = 'HPE OneView Python SDK is required for this module.'
|
||||
|
||||
ONEVIEW_COMMON_ARGS = dict(
|
||||
config=dict(required=False, type='str')
|
||||
config=dict(type='path'),
|
||||
hostname=dict(type='str'),
|
||||
username=dict(type='str'),
|
||||
password=dict(type='str'),
|
||||
api_version=dict(type='int'),
|
||||
image_streamer_hostname=dict(type='str')
|
||||
)
|
||||
|
||||
ONEVIEW_VALIDATE_ETAG_ARGS = dict(
|
||||
validate_etag=dict(
|
||||
required=False,
|
||||
type='bool',
|
||||
default=True)
|
||||
)
|
||||
ONEVIEW_VALIDATE_ETAG_ARGS = dict(validate_etag=dict(type='bool', default=True))
|
||||
|
||||
resource_client = None
|
||||
|
||||
|
@ -257,7 +257,13 @@ class OneViewModuleBase(object):
|
|||
self.module.fail_json(msg=self.HPE_ONEVIEW_SDK_REQUIRED)
|
||||
|
||||
def _create_oneview_client(self):
|
||||
if not self.module.params['config']:
|
||||
if self.module.params.get('hostname'):
|
||||
config = dict(ip=self.module.params['hostname'],
|
||||
credentials=dict(userName=self.module.params['username'], password=self.module.params['password']),
|
||||
api_version=self.module.params['api_version'],
|
||||
image_streamer_ip=self.module.params['image_streamer_hostname'])
|
||||
self.oneview_client = OneViewClient(config)
|
||||
elif not self.module.params['config']:
|
||||
self.oneview_client = OneViewClient.from_environment_variables()
|
||||
else:
|
||||
self.oneview_client = OneViewClient.from_json_file(self.module.params['config'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue