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

Ensure that the encoding of the win_updates scripts is not corrupted. #636

Conversation

matthew-s-walker
Copy link
Contributor

SUMMARY

We run Windows updates on some machines with more "unusual" encodings such as Chinese machines.
At some point between Ansible 7.5.0 and 8.3.0, we started encountering encoding related issues (see below).

This change base64 encode/decodes the update script wrapper and contents to prevent this.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

win_updates

ADDITIONAL INFORMATION

Example error on a Chinese machine:

FAILED - RETRYING: [win2019_x64_std_zh_tw]: Check for updates (3 retries left).Result was: {
    "attempts": 1,
    "changed": false,
    "failed_update_count": 0,
    "filtered_updates": {},
    "found_update_count": 0,
    "installed_update_count": 0,
    "invocation": {
        "module_args": {
            "accept_list": null,
            "category_names": [
                ...
            ],
            "log_path": "c:\\windows_updates_pre.txt",
            "reboot": false,
            "reboot_timeout": 1200,
            "reject_list": [
		...
            ],
            "server_selection": "windows_update",
            "skip_optional": false,
            "state": "searched"
        }
    },
    "msg": "Unknown failure running win_updates bootstrap process:  H \"1\"  ޼ƩI s \"Deserialize\"  ɵo ͨҥ~   p: \"'Element'  O L Ī  XmlNodeType C\"",
    "retries": 4,
    "updates": {}
}

@jborean93
Copy link
Collaborator

Sorry I missed this PR. The change looks good but are you able to;

The encoding of these scripts gets corrupted somewhere along the line,
maybe due to WinRM's stdin encoding. Base64 en/decode to prevent errors
such as:

Unknown failure running win_updates bootstrap process:  H \"1\"  ޼ƩI s \"Deserialize\"  ɵo ͨҥ~   p: \"'Element'  O L Ī  XmlNodeType C\""
@matthew-s-walker matthew-s-walker force-pushed the bugfix/support-chinese-encodings branch from a3dfa8d to e0b6d2d Compare August 12, 2024 16:12
@matthew-s-walker
Copy link
Contributor Author

matthew-s-walker commented Aug 12, 2024

@jborean93 Sure, hope this looks OK. I'm afraid I don't have time at the moment to do a full test with those changes, but the lines work as expected in powershell for me.

@jborean93 jborean93 closed this Aug 12, 2024
@jborean93 jborean93 reopened this Aug 12, 2024
@jborean93
Copy link
Collaborator

Closed and re-opened to trigger AZP which didn't seem to run on the last push.

@jborean93 jborean93 merged commit 72b7fc4 into ansible-collections:main Aug 12, 2024
27 of 30 checks passed
@jborean93
Copy link
Collaborator

Thanks for submitting this fix!

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 this pull request may close these issues.

2 participants