win_nssm: test parameters with spaces, quotes or backslashes
This commit is contained in:
parent
933a4092bf
commit
51843a7b3c
1 changed files with 14 additions and 6 deletions
|
@ -145,7 +145,7 @@
|
||||||
win_nssm:
|
win_nssm:
|
||||||
name: '{{ test_service_name }}'
|
name: '{{ test_service_name }}'
|
||||||
application: C:\Windows\System32\cmd.exe
|
application: C:\Windows\System32\cmd.exe
|
||||||
app_parameters_free_form: '-v -Dcom.test.string=value test'
|
app_parameters_free_form: '-v -Dcom.test.string=value "C:\with space\\"'
|
||||||
state: present
|
state: present
|
||||||
register: free_params
|
register: free_params
|
||||||
|
|
||||||
|
@ -159,13 +159,14 @@
|
||||||
- free_params.changed == true
|
- free_params.changed == true
|
||||||
- (free_params_actual.stdout|from_json).Exists == true
|
- (free_params_actual.stdout|from_json).Exists == true
|
||||||
- (free_params_actual.stdout|from_json).Parameters.Application == "C:\Windows\System32\cmd.exe"
|
- (free_params_actual.stdout|from_json).Parameters.Application == "C:\Windows\System32\cmd.exe"
|
||||||
- (free_params_actual.stdout|from_json).Parameters.AppParameters == "-v -Dcom.test.string=value test"
|
# Expected value: -v -Dcom.test.string=value "C:\with space\\" (backslashes doubled for jinja)
|
||||||
|
- (free_params_actual.stdout|from_json).Parameters.AppParameters == '-v -Dcom.test.string=value "C:\\with space\\\\"'
|
||||||
|
|
||||||
- name: install service with free form parameters (idempotent)
|
- name: install service with free form parameters (idempotent)
|
||||||
win_nssm:
|
win_nssm:
|
||||||
name: '{{ test_service_name }}'
|
name: '{{ test_service_name }}'
|
||||||
application: C:\Windows\System32\cmd.exe
|
application: C:\Windows\System32\cmd.exe
|
||||||
app_parameters_free_form: '-v -Dcom.test.string=value test'
|
app_parameters_free_form: '-v -Dcom.test.string=value "C:\with space\\"'
|
||||||
state: present
|
state: present
|
||||||
register: free_params_again
|
register: free_params_again
|
||||||
|
|
||||||
|
@ -179,7 +180,8 @@
|
||||||
- free_params_again.changed == false
|
- free_params_again.changed == false
|
||||||
- (free_params_again_actual.stdout|from_json).Exists == true
|
- (free_params_again_actual.stdout|from_json).Exists == true
|
||||||
- (free_params_again_actual.stdout|from_json).Parameters.Application == "C:\Windows\System32\cmd.exe"
|
- (free_params_again_actual.stdout|from_json).Parameters.Application == "C:\Windows\System32\cmd.exe"
|
||||||
- (free_params_again_actual.stdout|from_json).Parameters.AppParameters == "-v -Dcom.test.string=value test"
|
# Expected value: -v -Dcom.test.string=value "C:\with space\\" (backslashes doubled for jinja)
|
||||||
|
- (free_params_again_actual.stdout|from_json).Parameters.AppParameters == '-v -Dcom.test.string=value "C:\\with space\\\\"'
|
||||||
|
|
||||||
- name: install service with dict parameters
|
- name: install service with dict parameters
|
||||||
win_nssm:
|
win_nssm:
|
||||||
|
@ -188,6 +190,8 @@
|
||||||
app_parameters:
|
app_parameters:
|
||||||
foo: true
|
foo: true
|
||||||
'-file.out': 'output.bat'
|
'-file.out': 'output.bat'
|
||||||
|
'-path': 'C:\with space\'
|
||||||
|
'-str': 'test"quotes'
|
||||||
_: bar
|
_: bar
|
||||||
register: mixed_params
|
register: mixed_params
|
||||||
|
|
||||||
|
@ -201,7 +205,8 @@
|
||||||
- mixed_params.changed == true
|
- mixed_params.changed == true
|
||||||
- (mixed_params_actual.stdout|from_json).Exists == true
|
- (mixed_params_actual.stdout|from_json).Exists == true
|
||||||
- (mixed_params_actual.stdout|from_json).Parameters.Application == "C:\Windows\System32\cmd.exe"
|
- (mixed_params_actual.stdout|from_json).Parameters.Application == "C:\Windows\System32\cmd.exe"
|
||||||
- (mixed_params_actual.stdout|from_json).Parameters.AppParameters == "bar -file.out output.bat foo True"
|
# Expected value: bar -str "test\"quotes" -file.out output.bat foo True -path "C:\with space\\" (backslashes doubled for jinja)
|
||||||
|
- (mixed_params_actual.stdout|from_json).Parameters.AppParameters == 'bar -str "test\\"quotes" -file.out output.bat foo True -path "C:\\with space\\\\"'
|
||||||
|
|
||||||
- name: install service with dict parameters (idempotent)
|
- name: install service with dict parameters (idempotent)
|
||||||
win_nssm:
|
win_nssm:
|
||||||
|
@ -210,6 +215,8 @@
|
||||||
app_parameters:
|
app_parameters:
|
||||||
foo: true
|
foo: true
|
||||||
'-file.out': 'output.bat'
|
'-file.out': 'output.bat'
|
||||||
|
'-path': 'C:\with space\'
|
||||||
|
'-str': 'test"quotes'
|
||||||
_: bar
|
_: bar
|
||||||
register: mixed_params_again
|
register: mixed_params_again
|
||||||
|
|
||||||
|
@ -223,7 +230,8 @@
|
||||||
- mixed_params_again.changed == false
|
- mixed_params_again.changed == false
|
||||||
- (mixed_params_again_actual.stdout|from_json).Exists == true
|
- (mixed_params_again_actual.stdout|from_json).Exists == true
|
||||||
- (mixed_params_again_actual.stdout|from_json).Parameters.Application == "C:\Windows\System32\cmd.exe"
|
- (mixed_params_again_actual.stdout|from_json).Parameters.Application == "C:\Windows\System32\cmd.exe"
|
||||||
- (mixed_params_again_actual.stdout|from_json).Parameters.AppParameters == "bar -file.out output.bat foo True"
|
# Expected value: bar -str "test\"quotes" -file.out output.bat foo True -path "C:\with space\\" (backslashes doubled for jinja)
|
||||||
|
- (mixed_params_again_actual.stdout|from_json).Parameters.AppParameters == 'bar -str "test\\"quotes" -file.out output.bat foo True -path "C:\\with space\\\\"'
|
||||||
|
|
||||||
- name: remove service
|
- name: remove service
|
||||||
win_nssm:
|
win_nssm:
|
||||||
|
|
Loading…
Reference in a new issue