Ansible driver: fix deployment with serial specified as root device hint

Change-Id: Ie0d56da52ae8476d9f9860c967e8e31253a63c5b
Story: #2006275
Task: #35975
This commit is contained in:
Raphael Glon 2019-07-24 15:18:12 +02:00
parent 3958c94fa8
commit ba207ba372
3 changed files with 13 additions and 3 deletions

View File

@ -41,7 +41,10 @@ def get_devices_wwn(devices, module):
dev_dict[device] = {} dev_dict[device] = {}
for key, udev_key in COLLECT_INFO: for key, udev_key in COLLECT_INFO:
dev_dict[device][key] = udev.get('ID_%s' % udev_key) candidate = udev.get('ID_%s' % udev_key)
if candidate:
candidate = candidate.lower()
dev_dict[device][key] = candidate
return {"ansible_facts": {"devices_wwn": dev_dict}} return {"ansible_facts": {"devices_wwn": dev_dict}}

View File

@ -345,8 +345,10 @@ class TestAnsibleMethods(AnsibleDeployTestCaseBase):
ansible_deploy._prepare_extra_vars(host_list, ansible_vars)) ansible_deploy._prepare_extra_vars(host_list, ansible_vars))
def test__parse_root_device_hints(self): def test__parse_root_device_hints(self):
hints = {"wwn": "fake wwn", "size": "12345", "rotational": True} hints = {"wwn": "fake wwn", "size": "12345", "rotational": True,
expected = {"wwn": "fake wwn", "size": 12345, "rotational": True} "serial": "HELLO"}
expected = {"wwn": "fake wwn", "size": 12345, "rotational": True,
"serial": "hello"}
props = self.node.properties props = self.node.properties
props['root_device'] = hints props['root_device'] = hints
self.node.properties = props self.node.properties = props

View File

@ -0,0 +1,5 @@
---
fixes:
|
Fixes an issue with using serial number as root device hints
with the ``ansible`` deploy interface.