Fix win_nssm credentials quoting (#48761)

* Fix win_nssm credentials quoting

Fix credential quoting for win_nssm after changes to the way nssm command is invoked in Ansible 2.7.1.

* Updating nssm command to update credentials to use Argv-ToString to properly escape password variable.

* Adding changelog fragment for fix of #48728.

(cherry picked from commit 15c5dbcc20)
This commit is contained in:
mattandes 2018-12-04 18:38:28 -06:00 committed by Toshio Kuratomi
parent 91b2347344
commit 9cc7f7bcf2
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "win_nssm - Switched to Argv-ToString for escaping NSSM credentials (https://github.com/ansible/ansible/issues/48728)"

View file

@ -403,7 +403,7 @@ Function Nssm-Update-Credentials
} }
If ($nssm_result.stdout.split("`n`r")[0] -ne $fullUser) { If ($nssm_result.stdout.split("`n`r")[0] -ne $fullUser) {
$cmd = "set ""$name"" ObjectName $fullUser '$password'" $cmd = Argv-ToString @("set", $name, "ObjectName", $fullUser, $password)
$nssm_result = Nssm-Invoke $cmd $nssm_result = Nssm-Invoke $cmd
if ($nssm_result.rc -ne 0) if ($nssm_result.rc -ne 0)