Module "Warning" after upgrade to v. 2.2

Hello, all.

Today, I upgraded Ansible to version 2.2 from version 2.1 via RPM on a CentOS 6.x server. The first playbook I ran post-upgrade contained a play using the win_updates module. It appears the module worked, but I saw the following “Warning” during execution (I could only run the playbook again against a test server that was up-to-date so as to get verbose output) :

Using module file /usr/lib/python2.6/site-packages/ansible/modules/extras/windows/win_updates.ps1
ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5986 TO sawintest02
EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name “ansible-tmp-1480539501.17-123206679591223”).FullName | Write-Host -Separator ‘’;
PUT “/tmp/tmpxodTis” TO “C:\Users\ansible\AppData\Local\Temp\ansible-tmp-1480539501.17-123206679591223\win_updates.ps1”
EXEC Set-StrictMode -Version Latest
Try
{
& ‘C:\Users\ansible\AppData\Local\Temp\ansible-tmp-1480539501.17-123206679591223\win_updates.ps1’
}
Catch
{
$obj = @{ failed = $true }
If ($
.Exception.GetType)
{
$obj.Add(‘msg’, $.Exception.Message)
}
Else
{
$obj.Add(‘msg’, $.ToString())
}
If ($.InvocationInfo.PositionMessage)
{
$obj.Add(‘exception’, $.InvocationInfo.PositionMessage)
}
ElseIf ($
.ScriptStackTrace)
{
$obj.Add(‘exception’, $.ScriptStackTrace)
}
Try
{
$obj.Add(‘error_record’, ($ | ConvertTo-Json | ConvertFrom-Json))
}
Catch
{
}
Echo $_obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
[WARNING]: Module invocation had junk after the JSON data:

ok: [sawintest02] => {
“changed”: false,
“found_update_count”: 0,
“installed_update_count”: 0,
“invocation”: {
“module_name”: “win_updates”
},
“reboot_required”: false,
“updates”: {}
}

What’s the error about, and how can I fix it?

As always, thanks.

I got the same JSON junk warnings with win_updates after updating… What this warning mean? What junk exactly?

It’s nothing you need to worry about- due to some changes in the module JSON sanitizer in 2.2, it’s a little more sensitive than it used to be, so some modules are tripping it that didn’t used to. Those warnings are there because sometimes there is actual spurious output from the module guts that signifies an error (you’d see the actual output in the message too, if there were anything to worry about).

We don’t currently have a consistent way to fail module tests when one of those warnings gets shown, but it’s on the list of things to do, so meantime it’s a game of whack-a-mole to find them and clean them up as we see them. If you want to file bugs for them when you spot them, it’d be helpful for us (since we’re not in the habit of running all modules interactively looking for warnings). If you’re willing to do thay, you might want to wait for the module repo consolidation that’s happening next week (after which you can file it on http://github.com/ansible/ansible).

-Matt

Thank you, Matt. As long as the errors aren’t playbook killers, I can live with them, in the short-term anyway. I will file bugs as I encounter them.