Closed bigmagic closed 3 years ago
Hi Nicolas, Thanks for sharing this. Will keep you updated.
Hi @bigmagic the support for User resource has been added and also updated examples are merged into master branch. Please feel free to reopen if further help needed.
Scenario/Intent
When we execute the oneview_user_facts module and we filter by name, an exception is returned.
Environment Details
Steps to Reproduce
hosts: localhost
vars: config: 'oneview.json' ansible_python_interpreter: '/usr/local/bin/python3.6' userName: "test-user"
tasks:
name: "Create a user" oneview_user: config: "{{ config }}" state: present data: name: "{{ userName }}"
name: "Get user by name" oneview_user_facts: config: "{{ config }}" name: "{{ userName }}"
Expected Result
Should work
Actual Result
An exception is returned
`root@6a588ad9c03a:/playbooks# ansible-playbook user-get.yml [WARNING]: Found both group and host with same name: localhost
PLAY [localhost] ****
TASK [Gathering Facts] ** ok: [localhost]
TASK [Create a user] **** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: hpeOneView.exceptions.HPEOneViewException: ('The role name cannot be empty.', {'errorCode': 'INVALID_ROLE', 'message': 'The role name cannot be empty.', 'details': '', 'messageParameters': [], 'recommendedActions': ['Specify a valid or different value.'], 'errorSource': None, 'nestedErrors': [], 'data': {}}) fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1619595064.774543-84068660648093/AnsiballZ_oneview_user.py\", line 113, in\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1619595064.774543-84068660648093/AnsiballZ_oneview_user.py\", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1619595064.774543-84068660648093/AnsiballZ_oneview_user.py\", line 48, in invoke_module\n imp.load_module('main', mod, module, MOD_DESC)\n File \"/usr/local/lib/python3.6/imp.py\", line 235, in load_module\n return load_source(name, filename, file)\n File \"/usr/local/lib/python3.6/imp.py\", line 170, in load_source\n module = _exec(spec, sys.modules[name])\n File \"\", line 618, in _exec\n File \"\", line 678, in exec_module\n File \"\", line 219, in _call_with_frames_removed\n File \"/tmp/ansible_oneview_user_payload_6k_x7sng/main.py\", line 182, in \n File \"/tmp/ansible_oneview_user_payload_6k_x7sng/main.py\", line 178, in main\n File \"/tmp/ansible_oneview_user_payload_6k_x7sng/ansible_oneview_user_payload.zip/ansible/module_utils/oneview.py\", line 768, in run\n File \"/tmp/ansible_oneview_user_payload_6k_x7sng/main.py\", line 134, in execute_module\n File \"/tmp/ansible_oneview_user_payload_6k_x7sng/main.py\", line 145, in __present\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/resource.py\", line 179, in create\n resource_data = self._helper.create(data, uri, timeout, custom_headers, force)\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/resource.py\", line 431, in create\n return self.do_post(uri, data, timeout, custom_headers)\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/resource.py\", line 761, in do_post\n task, entity = self._connection.post(uri, resource, custom_headers=custom_headers)\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/connection.py\", line 386, in post\n return self.do_rest_call('POST', uri, body, custom_headers=custom_headers)\n File \"/usr/local/lib/python3.6/site-packages/hpeOneView/connection.py\", line 413, in do_rest_call\n raise HPEOneViewException(body)\nhpeOneView.exceptions.HPEOneViewException: ('The role name cannot be empty.', {'errorCode': 'INVALID_ROLE', 'message': 'The role name cannot be empty.', 'details': '', 'messageParameters': [], 'recommendedActions': ['Specify a valid or different value.'], 'errorSource': None, 'nestedErrors': [], 'data': {}})\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
to retry, use: --limit @/playbooks/user-get.retry
PLAY RECAP ** localhost : ok=1 changed=0 unreachable=0 failed=1`
Best Regards, Nicolas