-
Notifications
You must be signed in to change notification settings - Fork 177
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_dsc: failed when used with psrp connection and Windows CJK locale #83
Comments
I'm not sure that proposed fix fixes win_dsc, the error here is that the Try running this task to see if it gives you any more errors as to why it couldn't be loaded. - win_shell: Import-Module PSDesiredStateConfiguration |
I tried your idea and it didn't change the win_dsc message. # diff win_dsc.before.yml win_dsc.yml -u
--- win_dsc.before.yml 2020-07-25 13:00:24.195217100 +0000
+++ win_dsc.yml 2020-07-25 12:53:33.405217100 +0000
@@ -14,6 +14,8 @@
name: xWebAdministration
state: present
+ - win_shell: Import-Module PSDesiredStateConfiguration
+
- win_dsc:
resource_name: xWebsite
Name: WebApi # ansible-playbook -i hosts win_dsc.yml -vvvv
ansible-playbook 2.9.10
config file = /root/.ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
Using /root/.ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /root/Web/ansible/hosts as it did not pass its verify_file() method
script declined parsing /root/Web/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /root/Web/ansible/hosts as it did not pass its verify_file() method
Parsed /root/Web/ansible/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.8/dist-packages/ansible/plugins/callback/default.py
PLAYBOOK: win_dsc.yml ********************************************************************************************************************************************************************************************
Positional arguments: win_dsc.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/root/Web/ansible/hosts',)
forks: 5
1 plays in win_dsc.yml
PLAY [all] *******************************************************************************************************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
task path: /root/Web/ansible/win_dsc.yml:2
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/windows/setup.ps1
Pipelining is enabled.
<10.0.4.105> ESTABLISH PSRP CONNECTION FOR USER: Administrator ON PORT 5986 TO 10.0.4.105
PSRP: EXEC (via pipeline wrapper)
ok: [10.0.4.105]
META: ran handlers
TASK [win_shell] *************************************************************************************************************************************************************************************************
task path: /root/Web/ansible/win_dsc.yml:11
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/windows/win_shell.ps1
Pipelining is enabled.
<10.0.4.105> ESTABLISH PSRP CONNECTION FOR USER: Administrator ON PORT 5986 TO 10.0.4.105
PSRP: EXEC (via pipeline wrapper)
changed: [10.0.4.105] => {
"changed": true,
"cmd": "Install-PackageProvider -Name NuGet",
"delta": "0:00:03.140734",
"end": "2020-07-25 01:19:01.644869",
"rc": 0,
"start": "2020-07-25 01:18:58.504135",
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
}
TASK [win_psmodule] **********************************************************************************************************************************************************************************************
task path: /root/Web/ansible/win_dsc.yml:13
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/windows/win_psmodule.ps1
Pipelining is enabled.
<10.0.4.105> ESTABLISH PSRP CONNECTION FOR USER: Administrator ON PORT 5986 TO 10.0.4.105
PSRP: EXEC (via pipeline wrapper)
ok: [10.0.4.105] => {
"changed": false,
"nuget_changed": false,
"output": "Module xWebAdministration already present",
"repository_changed": false
}
TASK [win_shell] *************************************************************************************************************************************************************************************************
task path: /root/Web/ansible/win_dsc.yml:17
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/windows/win_shell.ps1
Pipelining is enabled.
<10.0.4.105> ESTABLISH PSRP CONNECTION FOR USER: Administrator ON PORT 5986 TO 10.0.4.105
PSRP: EXEC (via pipeline wrapper)
changed: [10.0.4.105] => {
"changed": true,
"cmd": "Import-Module PSDesiredStateConfiguration",
"delta": "0:00:00.859406",
"end": "2020-07-25 01:19:11.660835",
"rc": 0,
"start": "2020-07-25 01:19:10.801429",
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
}
TASK [win_dsc] ***************************************************************************************************************************************************************************************************
task path: /root/Web/ansible/win_dsc.yml:19
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/windows/win_dsc.ps1
Pipelining is enabled.
<10.0.4.105> ESTABLISH PSRP CONNECTION FOR USER: Administrator ON PORT 5986 TO 10.0.4.105
PSRP: EXEC (via pipeline wrapper)
The full traceback is:
The 'Get-DscResource' command was found in the module 'PSDesiredStateConfiguration', but the module could not be loaded. For more information, run 'Import-Module PSDesiredStateConfiguration'.
At line:332 char:21
+ $module_versions = (Get-DscResource -Name $resource_name -ErrorAction ...
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-DscResource:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
ScriptStackTrace:
at <ScriptBlock>, <No file>: line 332
fatal: [10.0.4.105]: FAILED! => {
"changed": false,
"msg": "Unhandled exception while executing module: The 'Get-DscResource' command was found in the module 'PSDesiredStateConfiguration', but the module could not be loaded. For more information, run 'Import-Module PSDesiredStateConfiguration'."
}
PLAY RECAP *******************************************************************************************************************************************************************************************************
10.0.4.105 : ok=4 changed=2 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 I tried running the command directly in Windows Server, but playbook result is the same. PS C:\Users\Administrator> Import-Module PSDesiredStateConfiguration
PS C:\Users\Administrator> Get-Module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Binary 1.0.0.1 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Pack...
Script 1.0.0.1 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
Manifest 1.1 PSDesiredStateConfiguration {Invoke-DscResource, Publish-DscConfiguration, Set-DscLoca...
Script 2.0.0 PSReadline {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS...
|
win_template, win_copy and win_service succeed in psrp. I think this is not a win_dsc problem, although I've only encountered this error with win_dsc at the moment. |
That may be the case but the error message you are getting back from The 'Get-DscResource' command was found in the module 'PSDesiredStateConfiguration', but the module could not be loaded. For more information, run 'Import-Module PSDesiredStateConfiguration'.
At line:332 char:21
+ $module_versions = (Get-DscResource -Name $resource_name -ErrorAction ...
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-DscResource:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule It's saying that the cmdlet was found but for some reason the - win_shell: |
Import-Module PSDesiredStateConfiguration -Verbose
Get-DscResource -Name xWebsite -Verbose
- win_shell: |
Get-DscResource -Name xWebsite -Verbose It might also be a good idea to try using |
I was finally able to replicate this problem and have a PR which should solve it #244. The issue occurs when there is a mismatch between the UI Culture and the one the What the changes in #244 have done is to temporary change the UI Culture to the installed culture so the import process runs properly before continuing on as normal. |
SUMMARY
win_dsc was failed when used with psrp connection and Windows ja-JP locale.
I think it happens in CJK as well as ja-JP.
I created the following dirty patch and applied it and it worked.
ISSUE TYPE
COMPONENT NAME
win_dsc
psrp
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
target OS version: Windows Server 2019 version 1809 build 17763.379
STEPS TO REPRODUCE
EXPECTED RESULTS
It does not fail.
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: