Skip to content

Commit

Permalink
fix sp idempotent issues
Browse files Browse the repository at this point in the history
  • Loading branch information
VenkateshRavula committed Apr 14, 2021
1 parent 81a1f92 commit 2a434b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 1 addition & 4 deletions library/module_utils/oneview.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2020) Hewlett Packard Enterprise Development LP
# Copyright (2016-2021) Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -190,7 +190,6 @@ def compare(first_resource, second_resource):
resource2 = second_resource

debug_resources = "resource1 = {0}, resource2 = {1}".format(resource1, resource2)

# The first resource is True / Not Null and the second resource is False / Null
if resource1 and not resource2:
logger.debug("resource1 and not resource2. " + debug_resources)
Expand Down Expand Up @@ -245,7 +244,6 @@ def compare_list(first_resource, second_resource):
resource2 = second_resource

debug_resources = "resource1 = {0}, resource2 = {1}".format(resource1, resource2)

# The second list is null / empty / False
if not resource2:
logger.debug("resource 2 is null. " + debug_resources)
Expand All @@ -257,7 +255,6 @@ def compare_list(first_resource, second_resource):

resource1 = sorted(resource1, key=_str_sorted)
resource2 = sorted(resource2, key=_str_sorted)

for i, val in enumerate(resource1):
if isinstance(val, collections.Mapping):
# change comparison function to compare dictionaries
Expand Down
5 changes: 4 additions & 1 deletion library/oneview_server_profile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
###
# Copyright (2016-2020) Hewlett Packard Enterprise Development LP
# Copyright (2016-2021) Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -360,6 +360,7 @@ def __present(self):

# Removes .mac entries from resource os_custom_attributes if no .mac passed into data params.
# Swaps True values for 'true' string, and False values for 'false' string to avoid common user errors.
# Changes the value of 'Password' attribute to 'None' in merged_data
def __validations_for_os_custom_attributes(self, merged_data, resource):
if self.data.get('osDeploymentSettings') is None or resource.get('osDeploymentSettings') is None:
return
Expand Down Expand Up @@ -393,6 +394,8 @@ def __validations_for_os_custom_attributes(self, merged_data, resource):
attribute['value'] = 'true'
elif attribute['value'] is False:
attribute['value'] = 'false'
if attribute['name'] == 'Password':
attribute['value'] = 'None'

# Searches for a key or suffix of a key inside an array of hashes. The search looks for {'name': <key>} pairs
# inside the array.
Expand Down

0 comments on commit 2a434b6

Please sign in to comment.