This project is no longer being developed and has limited support. Please use the newer Ansible Collection project: https://github.com/HewlettPackard/oneview-ansible-collection
library/module_utils/oneview.py:dict_merge(dict1, dict2) do not work as expected
It makes a deep merge of 2 dictionaries and returns the merged dictionary.
Values in dict2 will overwrite same key values of dict1.
merged_data = dict_merge(self.data, self.current_resource)
Common keys in current_resource will overwrite what we want to change in data.
We have to permute.
2.dict_merge() modifies dict1 passed to it.
After permutation because of point 1 above, original current_resource is now modified.
When _update() compare current and merged data, it doesn't detect any change.
We have to work on a copy of dict1 before modify it to keep original unchanged.
rename task is not idempotent.
When no rack with (old) name exists but there is a rack with newName, it will create a new rack with (old) name.
We have to check first if rack with newName exists.
Scenario/Intent
When trying to rename a rack, ansible task remain unchanged and nothing is done
Environment Details
"git clone" then "docker container build" on November 19th
Steps to Reproduce
rename.yml
# ansible-playbook rename.yml
Expected Result
Rename of the rack to newName when it exists with (old) name
Actual Result
Nothing done
My comments
library/module_utils/oneview.py:dict_merge(dict1, dict2) do not work as expected It makes a deep merge of 2 dictionaries and returns the merged dictionary. Values in dict2 will overwrite same key values of dict1.
2.dict_merge() modifies dict1 passed to it. After permutation because of point 1 above, original current_resource is now modified. When _update() compare current and merged data, it doesn't detect any change. We have to work on a copy of dict1 before modify it to keep original unchanged.