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

win_updates fails with Cannot find an overload for "WriteLog" #411

Closed
anasaizg opened this issue Sep 8, 2022 · 2 comments · Fixed by #414
Closed

win_updates fails with Cannot find an overload for "WriteLog" #411

anasaizg opened this issue Sep 8, 2022 · 2 comments · Fixed by #414

Comments

@anasaizg
Copy link

anasaizg commented Sep 8, 2022

SUMMARY

In some servers, win_updates fails with the following message: "Cannot find an overload for "WriteLog" and the argument count: "5".". However, when update is launched manually, there seems to be no errors.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_updates

ANSIBLE VERSION
ansible 2.10.14
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/my-envs/venv-windows/lib64/python3.6/site-packages/ansible
  executable location = /opt/my-envs/venv-windows/bin/ansible
  python version = 3.6.8 (default, Nov 18 2021, 10:07:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44.0.3)]

COLLECTION VERSION
Collection      Version
--------------- -------
ansible.windows 1.11.1

CONFIGURATION
OS / ENVIRONMENT

Target OS: Microsoft Windows Server 2016 Standard
Powershell version: 5
Connection Type: PSRP

STEPS TO REPRODUCE
- name: Windows updates - log to {{ansible_log}}
  ansible.windows.win_updates:
    category_names: "{{ category_updates |default('*') }}"
    state: installed
    log_path: "{{ ansible_log }}"
    reboot: yes
    reboot_timeout: 3600
  register: win_updates_result
  ignore_errors: yes

- debug:
    var: win_updates_result
EXPECTED RESULTS

Server is updated after some minutes (or hours, depending on the patches)

ACTUAL RESULTS

Update task fails and the following data is registered:

{
    "changed": true,
    "reboot_required": false,
    "msg": "Cannot find an overload for \"WriteLog\" and the argument count: \"5\".",
    "exception": "Cannot find an overload for \"WriteLog\" and the argument count: \"5\".\r\nAt line:772 char:13\r\n+             $api.WriteLog(\"Search warning {0} - Context {1} - HResult ...\r\n+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodException\r\n    + FullyQualifiedErrorId : MethodCountCouldNotFindBest\r\n \r\n\r\n\r\nat <ScriptBlock>, <No file>: line 772",
    "found_update_count": 0,
    "failed_update_count": 0,
    "installed_update_count": 0,
    "updates": {},
    "filtered_updates": {},
    "invocation": {
        "module_args": {
            "reboot_timeout": 3600,
            "category_names": [
                "*"
            ],
            "reboot": true,
            "server_selection": "default",
            "accept_list": null,
            "state": "installed",
            "use_scheduled_task": false,
            "reject_list": null,
            "skip_optional": false,
            "log_path": "C:/Temp/ansible-windows-update-2022-09-07.log"
        }
    },
    "_ansible_no_log": false
}

Following resolution for issue #366 I opened some months ago, we upgraded collection to version 1.11.1 last week and now this message appears when updating.

The good side is it only appears in thos servers that in version 1.9.0 failed with message ""Failed to search for updates (SuceededWithErrors 3)", so it seems something related to that specific fix.

I can try and get more information if needed.

Thanks!

@jborean93
Copy link
Collaborator

Thanks for the bug report, looks like I didn't implement it properly. The changes in #414 should solve this particular problem for you and allow the search errors to be loged in the file correctly.

@anasaizg
Copy link
Author

Thank you very much Jordan! Let's check it and see what it says now :)

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

Successfully merging a pull request may close this issue.

2 participants