Skip to content
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_guest.py: autologoncount missing default 0 if autologon=false #2118

Open
rcohub opened this issue Jul 16, 2024 · 0 comments
Open

vmware_guest.py: autologoncount missing default 0 if autologon=false #2118

rcohub opened this issue Jul 16, 2024 · 0 comments

Comments

@rcohub
Copy link

rcohub commented Jul 16, 2024

SUMMARY

Under the vmware_guest module, the customization.autologoncount is not set to 0 when customization.autologon is set to false:

Error received:

TypeError: Required field "autoLogonCount" not provided (not @optional)

Per documentation in vmware_guest.py:

autologon:
    type: bool
    description:
    - Auto logon after virtual machine customization.
    - Specific to Windows customization.
autologoncount:
    type: int
    description:
    - Number of autologon after reboot.
    - Specific to Windows customization.
    - Ignored if O(customization.autologon) is unset or set to O(customization.autologon=false).
    - If unset, 1 will be used.

Only see logic that handles unset customization.autologon which defaults to 1, as described.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware_guest.py

ANSIBLE VERSION
ansible [core 2.15.12]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/requirements_collections:/root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.19 (main, May 16 2024, 08:45:40) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] (/usr/bin/python3.9)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
Collection       Version
---------------- -------
community.vmware 2.9.1

Also tested on:

Collection       Version
---------------- -------
community.vmware 3.11.1
CONFIGURATION
ANSIBLE_FORCE_COLOR (env: ANSIBLE_FORCE_COLOR) = True
COLLECTIONS_PATHS (env: ANSIBLE_COLLECTIONS_PATH) = ['/runner/requirements_collections', '/root/.ansible/collections', '/usr/share/ansible/collections']
CONFIG_FILE = None
DEFAULT_CALLBACK_PLUGIN_PATH (env: ANSIBLE_CALLBACK_PLUGINS) = ['/runner/artifacts/147009/callback']
DEFAULT_ROLES_PATH (env: ANSIBLE_ROLES_PATH) = ['/runner/requirements_roles', '/root/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles']
DEFAULT_STDOUT_CALLBACK (env: ANSIBLE_STDOUT_CALLBACK) = awx_display
HOST_KEY_CHECKING (env: ANSIBLE_HOST_KEY_CHECKING) = False
INVENTORY_UNPARSED_IS_FAILED (env: ANSIBLE_INVENTORY_UNPARSED_FAILED) = True
RETRY_FILES_ENABLED (env: ANSIBLE_RETRY_FILES_ENABLED) = False
STEPS TO REPRODUCE

Set autologon to False and omit autologoncount if present

- name: Build VM
  community.vmware.vmware_guest:
    hostname: "{{ hostname }}"
    ...
    customization:
      autologon: False
      password: "{{ omitted }}"
      fullname: 'IS Example Name'
      timezone: "{{ timezone }}"
EXPECTED RESULTS

Prior to the reported issue, the build would run with no issues and the autologoncount was not required.

ACTUAL RESULTS
Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1720797044.2639995-59-249635465181726/AnsiballZ_vmware_guest.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1720797044.2639995-59-249635465181726/AnsiballZ_vmware_guest.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1720797044.2639995-59-249635465181726/AnsiballZ_vmware_guest.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_guest', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_guest', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_vmware_guest_payload_949rk4a_/ansible_vmware_guest_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_guest.py\", line 3646, in <module>\n  File \"/tmp/ansible_vmware_guest_payload_949rk4a_/ansible_vmware_guest_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_guest.py\", line 3635, in main\n  File \"/tmp/ansible_vmware_guest_payload_949rk4a_/ansible_vmware_guest_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_guest.py\", line 3041, in deploy_vm\n  File \"/tmp/ansible_vmware_guest_payload_949rk4a_/ansible_vmware_guest_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_guest.py\", line 2353, in customize_vm\n  File \"/usr/local/lib/python3.9/site-packages/pyVmomi/VmomiSupport.py\", line 663, in __setattr__\n    CheckField(self._GetPropertyInfo(name), val)\n  File \"/usr/local/lib/python3.9/site-packages/pyVmomi/VmomiSupport.py\", line 1041, in CheckField\n    raise TypeError('Required field \"%s\" not provided (not @optional)' % info.name)\nTypeError: Required field \"autoLogonCount\" not provided (not @optional)\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant