mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
win_nssm: tests and several bug fixes (#44755)
* win_nssm: add failing tests for issue #44079 * win_nssm: use Run-Command instead of Invoke-Expression to prevent interpretation issue Fix #44079 * win_nssm: add more failing tests These tests highlight several issues with this module: * Service not started when state=started * Errors with app_parameters (see #25265) * Exception when passing several dependencies separated by comma as specified in doc * win_nssm: fix service not started when state=started Nssm status returns a multiline output that doesn't match any of the strict patterns in the switch statement. * win_nssm: fix incorrect separator in doc for service dependencies The dependencies parameter works with space as separator, but not with comma as shown in the documentation * win_nssm: fix error with app_parameters parameter Fix #25265 * win_nssm: add idempotence tests * win_nssm: fix several idempotence issues and misbehaviors Add missing space between arguments when app_parameters contains several keys. Use Argv-ToString and Escape-Argument to improve arguments handling (parameters with quotes, backslashes or spaces). * win_nssm: test parameters with spaces, quotes or backslashes * win_nssm: restore comma as separator for service dependencies Revert commit ddd4b4b * win_nssm: restore support of string as dict form for app_parameters and remove support of literal YAML dict * win_nssm: wrong variable in tests
This commit is contained in:
parent
69594c5370
commit
ac9d506a61
7 changed files with 445 additions and 157 deletions
|
@ -49,7 +49,7 @@ options:
|
|||
- Path to receive error output.
|
||||
app_parameters:
|
||||
description:
|
||||
- Parameters to be passed to the application when it starts.
|
||||
- A string representing a dictionary of parameters to be passed to the application when it starts.
|
||||
- Use either this or C(app_parameters_free_form), not both.
|
||||
app_parameters_free_form:
|
||||
version_added: "2.3.0"
|
||||
|
@ -87,37 +87,25 @@ EXAMPLES = r'''
|
|||
application: C:\windows\foo.exe
|
||||
|
||||
# Install and start the foo service with a key-value pair argument
|
||||
# This will yield the following command: C:\windows\foo.exe bar "true"
|
||||
# This will yield the following command: C:\windows\foo.exe -bar true
|
||||
- win_nssm:
|
||||
name: foo
|
||||
application: C:\windows\foo.exe
|
||||
app_parameters:
|
||||
bar: 'true'
|
||||
|
||||
# Install and start the foo service with a key-value pair argument, where the argument needs to start with a dash
|
||||
# This will yield the following command: C:\windows\\foo.exe -bar "true"
|
||||
- win_nssm:
|
||||
name: foo
|
||||
application: C:\windows\foo.exe
|
||||
app_parameters:
|
||||
"-bar": 'true'
|
||||
app_parameters: -bar=true
|
||||
|
||||
# Install and start the foo service with a single parameter
|
||||
# This will yield the following command: C:\windows\\foo.exe bar
|
||||
- win_nssm:
|
||||
name: foo
|
||||
application: C:\windows\foo.exe
|
||||
app_parameters:
|
||||
_: bar
|
||||
app_parameters: _=bar
|
||||
|
||||
# Install and start the foo service with a mix of single params, and key value pairs
|
||||
# This will yield the following command: C:\windows\\foo.exe bar -file output.bat
|
||||
# This will yield the following command: C:\windows\\foo.exe bar -file output.bat -foo false
|
||||
- win_nssm:
|
||||
name: foo
|
||||
application: C:\windows\foo.exe
|
||||
app_parameters:
|
||||
_: bar
|
||||
"-file": "output.bat"
|
||||
app_parameters: _=bar; -file=output.bat; -foo=false
|
||||
|
||||
# Use the single line parameters option to specify an arbitrary string of parameters
|
||||
# for the service executable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue