HewlettPackard / oneview-ansible

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
Apache License 2.0
104 stars 65 forks source link

Rename enclosure with ETag #443

Closed DungKHoang closed 5 years ago

DungKHoang commented 5 years ago

Scenario/Intent

Rename an enclosure

Environment Details

Steps to Reproduce

 - name: Rename enclosure  0000A66101                
   oneview_enclosure:                        
         config: '{{config}}'              
         state: present                      
         data:                               
             name:                        '0000A66101' 
             newName:                     'BLvCC0011' 
             ETag:                        "2019-07-28T02:56:22.118Z"

Expected Result

rename enclosure

Actual Result

TASK [Rename enclosure 0000A66101] ***** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: HPOneViewException: (u'This operation requires an ETag value and none was specified.', {u'errorSource': None, u'recommendedActions': [u'Specify an ETag value in the If-Match header or the eTag attribute of the request body.'], u'data': {}, u'errorCode': u'MISSING_ETAG_IN_REQUEST', u'details': u'', u'message': u'This operation requires an ETag value and none was specified.', u'nestedErrors': []}) fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/dung/.ansible/tmp/ansible-tmp-1566877732.32-159662304414981/AnsiballZ_oneview_enclosure.py\", line 114, in \n _ansiballz_main()\n File \"/home/dung/.ansible/tmp/ansible-tmp-1566877732.32-159662304414981/AnsiballZ_oneview_enclosure.py\", line 106, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/dung/.ansible/tmp/ansible-tmp-1566877732.32-159662304414981/AnsiballZ_oneview_enclosure.py\", line 49, in invoke_module\n imp.load_module('main', mod, module, MOD_DESC)\n File \"/tmp/ansible_oneview_enclosure_payload_bJkhOP/main.py\", line 711, in \n File \"/tmp/ansible_oneview_enclosure_payload_bJkhOP/main.py\", line 707, in main\n File \"/tmp/ansible_oneview_enclosure_payload_bJkhOP/ansible_oneview_enclosure_payload.zip/ansible/module_utils/oneview.py\", line 445, in run\n File \"/tmp/ansible_oneview_enclosure_payload_bJkhOP/main.py\", line 506, in execute_module\n File \"/tmp/ansible_oneview_enclosure_payload_bJkhOP/main.py\", line 555, in present\n File \"/tmp/ansible_oneview_enclosure_payload_bJkhOP/main.py\", line 679, in replace_enclosure_name\n File \"/home/dung/.local/lib/python2.7/site-packages/hpOneView/resources/resource.py\", line 69, in call\n return self.method(obj, *args, kwargs)\n File \"/home/dung/.local/lib/python2.7/site-packages/hpOneView/resources/resource.py\", line 805, in patch\n timeout=timeout)\n File \"/home/dung/.local/lib/python2.7/site-packages/hpOneView/resources/resource.py\", line 830, in patch_request\n task, entity = self._connection.patch(uri, body, custom_headers=custom_headers)\n File \"/home/dung/.local/lib/python2.7/site-packages/hpOneView/connection.py\", line 379, in patch\n return self.do_rest_call('PATCH', uri, body, custom_headers=custom_headers)\n File \"/home/dung/.local/lib/python2.7/site-packages/hpOneView/connection.py\", line 403, in do_rest_call\n raise HPOneViewException(body)\nHPOneViewException: (u'This operation requires an ETag value and none was specified.', {u'errorSource': None, u'recommendedActions': [u'Specify an ETag value in the If-Match header or the eTag attribute of the request body.'], u'data': {}, u'errorCode': u'MISSING_ETAG_IN_REQUEST', u'details': u'', u'message': u'This operation requires an ETag value and none was specified.', u'nestedErrors': []})\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

DungKHoang commented 5 years ago

Fixed by adding "If-Match": "*" in oneview_config.json