Skip to content
Merged
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
6 changes: 6 additions & 0 deletions changelogs/fragments/oracle_asmdg-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bugfixes:
- "oracle_asmdg.py: wanted_attributes casted to list to reflect change in zip object type"
- "oracle_asmdg.py: compare sorted current_properties to sorted wanted_attributes, because we shouldn't rely on the list order of asm_diskgroups' attributes list is the same as querying v$asm_attribute returns"
- "oracle_asmdg.py: exclude read_only attributes when building current_properties from v$asm_attribute as they're also removed from wanted_attributes"

9 changes: 8 additions & 1 deletion plugins/modules/oracle_asmdg.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ def ensure_diskgroup_state(
attribute_value = [y.lower() for y in attribute_value]
wanted_attributes = zip(attribute_name, attribute_value)

# Zip object type apparently changed from list (python2) to iterator (python3)
# We convert it to list because otherwise we'd loose it's content with the first
# iteration
if not isinstance(wanted_attributes, list):
wanted_attributes = list(wanted_attributes)

# Make sure we don't try to modify read only attributes. Removing them
# from the wanted_attributes list
for a in wanted_attributes:
Expand All @@ -282,7 +288,7 @@ def ensure_diskgroup_state(
cursor, module, msg, name, attribute_names_
)
# Convert to dict and compare current with wanted
if current_properties != wanted_attributes:
if sorted(current_properties) != sorted(wanted_attributes):
change_attr = True
for i in wanted_attributes:
total_sql.append(
Expand Down Expand Up @@ -351,6 +357,7 @@ def get_current_properties(cursor, module, msg, name, attribute_names_):
sql = 'select lower(a.name),lower(a.value) '
sql += 'from v$asm_attribute a, v$asm_diskgroup dg '
sql += 'where dg.group_number = a.group_number '
sql += 'and a.read_only = \'N\' '
sql += 'and upper(dg.name) = \'%s\' ' % (name.upper())
sql += 'and a.name in (%s) ' % (attribute_names_.lower())

Expand Down
Loading