win_nssm: restore comma as separator for service dependencies

Revert commit ddd4b4b

(cherry picked from commit ead882bb9b)
pull/46479/merge
Kévin Subileau 6 years ago committed by Toshio Kuratomi
parent 4215feeb5e
commit 2de895a07b

@ -27,7 +27,7 @@ $startMode = Get-AnsibleParam -obj $params -name "start_mode" -type "str" -defau
$stdoutFile = Get-AnsibleParam -obj $params -name "stdout_file" -type "str" $stdoutFile = Get-AnsibleParam -obj $params -name "stdout_file" -type "str"
$stderrFile = Get-AnsibleParam -obj $params -name "stderr_file" -type "str" $stderrFile = Get-AnsibleParam -obj $params -name "stderr_file" -type "str"
$dependencies = Get-AnsibleParam -obj $params -name "dependencies" -type "str" $dependencies = Get-AnsibleParam -obj $params -name "dependencies" -type "list"
$user = Get-AnsibleParam -obj $params -name "user" -type "str" $user = Get-AnsibleParam -obj $params -name "user" -type "str"
$password = Get-AnsibleParam -obj $params -name "password" -type "str" $password = Get-AnsibleParam -obj $params -name "password" -type "str"
@ -431,11 +431,11 @@ Function Nssm-Update-Dependencies
Throw "Error updating dependencies for service ""$name""" Throw "Error updating dependencies for service ""$name"""
} }
$dependencies_array = @($dependencies.split(" ") | where { $_ -ne '' })
$current_dependencies = @($nssm_result.stdout.split("`n`r") | where { $_ -ne '' }) $current_dependencies = @($nssm_result.stdout.split("`n`r") | where { $_ -ne '' })
If (@(Compare-Object -ReferenceObject $current_dependencies -DifferenceObject $dependencies_array).Length -ne 0) { If (@(Compare-Object -ReferenceObject $current_dependencies -DifferenceObject $dependencies).Length -ne 0) {
$cmd = "set ""$name"" DependOnService $dependencies" $dependencies_str = Argv-ToString -arguments $dependencies
$cmd = "set ""$name"" DependOnService $dependencies_str"
$nssm_result = Nssm-Invoke $cmd $nssm_result = Nssm-Invoke $cmd
if ($nssm_result.rc -ne 0) if ($nssm_result.rc -ne 0)

@ -58,7 +58,7 @@ options:
- Use either this or C(app_parameters), not both. - Use either this or C(app_parameters), not both.
dependencies: dependencies:
description: description:
- Service dependencies that has to be started to trigger startup, separated by space. - Service dependencies that has to be started to trigger startup, separated by comma.
user: user:
description: description:
- User to be used for service startup. - User to be used for service startup.
@ -140,7 +140,7 @@ EXAMPLES = r'''
- win_nssm: - win_nssm:
name: foo name: foo
application: C:\windows\foo.exe application: C:\windows\foo.exe
dependencies: 'adf tcpip' dependencies: 'adf,tcpip'
# Install and start the foo service with dedicated user # Install and start the foo service with dedicated user
- win_nssm: - win_nssm:

@ -81,7 +81,7 @@
name: '{{ test_service_name }}' name: '{{ test_service_name }}'
application: C:\Windows\System32\cmd.exe application: C:\Windows\System32\cmd.exe
start_mode: manual start_mode: manual
dependencies: 'tcpip dnscache' dependencies: 'tcpip,dnscache'
user: '{{ test_win_nssm_username }}' user: '{{ test_win_nssm_username }}'
password: '{{ test_win_nssm_password }}' password: '{{ test_win_nssm_password }}'
stdout_file: '{{ test_win_nssm_path }}\log.txt' stdout_file: '{{ test_win_nssm_path }}\log.txt'
@ -114,7 +114,7 @@
application: C:\Windows\System32\cmd.exe application: C:\Windows\System32\cmd.exe
start_mode: manual start_mode: manual
# Dependencies order should not trigger a change # Dependencies order should not trigger a change
dependencies: 'dnscache tcpip' dependencies: 'dnscache,tcpip'
user: '{{ test_win_nssm_username }}' user: '{{ test_win_nssm_username }}'
password: '{{ test_win_nssm_password }}' password: '{{ test_win_nssm_password }}'
stdout_file: '{{ test_win_nssm_path }}\log.txt' stdout_file: '{{ test_win_nssm_path }}\log.txt'

Loading…
Cancel
Save