-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vmware_drs_group_manager: Unable to add VM/Hosts to DRS rule #1415
Comments
After some further testing it looks to be caused on line 414 for the VM's VMs output: {
"module_stdout": "",
"module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1659089295.7209122-130-208605871620236/AnsiballZ_vmware_drs_group_manager.py\", line 107, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1659089295.7209122-130-208605871620236/AnsiballZ_vmware_drs_group_manager.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1659089295.7209122-130-208605871620236/AnsiballZ_vmware_drs_group_manager.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_drs_group_manager', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_drs_group_manager', _modlib_path=modlib_path),\n File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_p6a2uyoz/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 522, in <module>\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_p6a2uyoz/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 505, in main\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_p6a2uyoz/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 475, in manage_drs_group_members\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_p6a2uyoz/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 414, in _manage_vm_group\nAttributeError: 'NoneType' object has no attribute 'vm'\n",
"exception": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1659089295.7209122-130-208605871620236/AnsiballZ_vmware_drs_group_manager.py\", line 107, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1659089295.7209122-130-208605871620236/AnsiballZ_vmware_drs_group_manager.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1659089295.7209122-130-208605871620236/AnsiballZ_vmware_drs_group_manager.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_drs_group_manager', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_drs_group_manager', _modlib_path=modlib_path),\n File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_p6a2uyoz/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 522, in <module>\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_p6a2uyoz/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 505, in main\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_p6a2uyoz/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 475, in manage_drs_group_members\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_p6a2uyoz/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 414, in _manage_vm_group\nAttributeError: 'NoneType' object has no attribute 'vm'\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1,
"_ansible_no_log": false,
"changed": false,
"_ansible_delegated_vars": {
"ansible_host": "localhost",
"ansible_port": null,
"ansible_user": "root",
"ansible_connection": "local"
}
} community.vmware/plugins/modules/vmware_drs_group_manager.py Lines 407 to 414 in b41e979
Hosts output: {
"module_stdout": "",
"module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1659089818.0389547-131-75400439795310/AnsiballZ_vmware_drs_group_manager.py\", line 107, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1659089818.0389547-131-75400439795310/AnsiballZ_vmware_drs_group_manager.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1659089818.0389547-131-75400439795310/AnsiballZ_vmware_drs_group_manager.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_drs_group_manager', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_drs_group_manager', _modlib_path=modlib_path),\n File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_tm7xis17/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 522, in <module>\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_tm7xis17/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 505, in main\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_tm7xis17/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 473, in manage_drs_group_members\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_tm7xis17/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 379, in _manage_host_group\nAttributeError: 'NoneType' object has no attribute 'host'\n",
"exception": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1659089818.0389547-131-75400439795310/AnsiballZ_vmware_drs_group_manager.py\", line 107, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1659089818.0389547-131-75400439795310/AnsiballZ_vmware_drs_group_manager.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1659089818.0389547-131-75400439795310/AnsiballZ_vmware_drs_group_manager.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_drs_group_manager', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_drs_group_manager', _modlib_path=modlib_path),\n File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_tm7xis17/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 522, in <module>\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_tm7xis17/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 505, in main\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_tm7xis17/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 473, in manage_drs_group_members\n File \"/tmp/ansible_community.vmware.vmware_drs_group_manager_payload_tm7xis17/ansible_community.vmware.vmware_drs_group_manager_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_drs_group_manager.py\", line 379, in _manage_host_group\nAttributeError: 'NoneType' object has no attribute 'host'\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1,
"_ansible_no_log": false,
"changed": false,
"_ansible_delegated_vars": {
"ansible_host": "localhost",
"ansible_port": null,
"ansible_user": "root",
"ansible_connection": "local"
}
} community.vmware/plugins/modules/vmware_drs_group_manager.py Lines 372 to 379 in b41e979
|
I think the module doesn't really test if the group exists. I can reproduce your issue if I run the playbook with a non-existing Are you sure the group really exists? Either it doesn't, or the account you're using in your playbook doesn't have permissions on DRS groups. I can't think of any other explanation at the moment. |
vmware_drs_group_manager: Improve error handling SUMMARY vmware_drs_group_manager raises exceptions instead of calling fail_json(). Additionally, if the DRS group doesn't exist the module fails with 'NoneType' object has no attribute 'vm' or 'NoneType' object has no attribute 'host' which isn't really helpful. ISSUE TYPE Feature Pull Request COMPONENT NAME vmware_drs_group_manager ADDITIONAL INFORMATION #1415
@ErikVenema Could you please test again with community.vmware 2.9.0 or later? |
Since I didn't get the information that the problem still exist wit 2.9.0 and later, I consider this issue fixed. |
SUMMARY
I'm unable to add any vm's or hosts to an existing affinity/drs rule with the error "Error: 'Nonetype' object has no attribute 'vm" for adding vm's and for hosts it's: "Error: 'Nonetype' object has no attribute 'host"
ISSUE TYPE
COMPONENT NAME
vmware_drs_group_manager
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
The vms/hosts should be added to the affinity drs group.
ACTUAL RESULTS
To test further I've used VM's that didn't exist and came up with an error that the VM's indeed didn't exist. When I use VM's that do exist it doesn't and gives above error. When using a rule that doesn't exist it also gives the above error, so I'm assuming it doesn't even get to the step that checks if the rule exists.
The text was updated successfully, but these errors were encountered: