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

Module crashes with import error #484

Closed agdunkley closed 4 years ago

agdunkley commented 4 years ago

Scenario/Intent

Just trying out oneview ansible as part of a larger automation project and I am getting an error. May be something I have (not) done, any advice is appreciated

Environment Details

Steps to Reproduce

Use the example YAML for server_hardware_facts and execute the play, or just run the library code directly and it will fail immediately

Expected Result

Server Facts from the iLO

Actual Result

An error traceback

Traceback (most recent call last): File "oneview_server_hardware_facts.py", line 205, in from ansible.module_utils.oneview import OneViewModule ImportError: cannot import name OneViewModule

yuvirani commented 4 years ago

@agdunkley, ansible.module_utils which actually contains the shared code for oneview modules. When you run a playbook, ansible takes module name provided(oneview_server_hardware_facts) in the playbook and look for the same in module_utils i.e.oneview_server_hardware_facts.py, and then yields the actual results.

You can go through the doc for more clarification. https://docs.ansible.com/ansible/latest/dev_guide/developing_module_utilities.html.

So there is no need to run library module explicitly. Could you please post the playbook error here? Because I was able to get the details by running oneview_server_hardware_facts.yml

yuvirani commented 4 years ago

Playbook ran fine and able to get the details from server_hardware_facts.yml. Hence, closing it.