Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
200706d5
Commit
200706d5
authored
Jun 30, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9812 from fgsch/fix_1904
Allow globbing in creates= and removes= directives
parents
0cfebb87
91a73cff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
16 deletions
+30
-16
test/integration/roles/test_command_shell/tasks/main.yml
+30
-16
No files found.
test/integration/roles/test_command_shell/tasks/main.yml
View file @
200706d5
...
...
@@ -82,24 +82,36 @@
file
:
path={{output_dir_test}}/afile.txt state=absent
-
name
:
create afile.txt with create_afile.sh via command
shell
:
"
{{output_dir_test
|
expanduser}}/create_afile.sh
{{output_dir_test
|
expanduser}}/afile.txt
creates={{output_dir_test
|
expanduser}}/afile.txt"
command
:
"
{{output_dir_test
|
expanduser}}/create_afile.sh
{{output_dir_test
|
expanduser}}/afile.txt
creates={{output_dir_test
|
expanduser}}/afile.txt"
-
name
:
verify that afile.txt is present
file
:
path={{output_dir_test}}/afile.txt state=file
-
name
:
re-run previous command using creates with globbing
command
:
"
{{output_dir_test
|
expanduser}}/create_afile.sh
{{output_dir_test
|
expanduser}}/afile.txt
creates={{output_dir_test
|
expanduser}}/afile.*"
register
:
command_result3
-
name
:
assert that creates with globbing is working
assert
:
that
:
-
"
command_result3.changed
!=
True"
# removes
-
name
:
remove afile.txt with remote_afile.sh via command
shell
:
"
{{output_dir_test
|
expanduser}}/remove_afile.sh
{{output_dir_test
|
expanduser}}/afile.txt
removes={{output_dir_test
|
expanduser}}/afile.txt"
command
:
"
{{output_dir_test
|
expanduser}}/remove_afile.sh
{{output_dir_test
|
expanduser}}/afile.txt
removes={{output_dir_test
|
expanduser}}/afile.txt"
-
name
:
verify that afile.txt is absent
file
:
path={{output_dir_test}}/afile.txt state=absent
register
:
command_result3
-
name
:
assert that the file was removed by the script
-
name
:
re-run previous command using removes with globbing
command
:
"
{{output_dir_test
|
expanduser}}/remove_afile.sh
{{output_dir_test
|
expanduser}}/afile.txt
removes={{output_dir_test
|
expanduser}}/afile.*"
register
:
command_result4
-
name
:
assert that removes with globbing is working
assert
:
that
:
-
"
command_result
3
.changed
!=
True"
-
"
command_result
4
.changed
!=
True"
##
## shell
...
...
@@ -161,21 +173,23 @@
-
name
:
remove afile.txt using rm
shell
:
rm {{output_dir_test | expanduser}}/afile.txt removes={{output_dir_test | expanduser}}/afile.txt
register
:
shell_result
4
register
:
shell_result
3
-
name
:
assert that using rm under shell causes a warning
assert
:
that
:
-
"
shell_result
4
.warnings"
-
"
shell_result
3
.warnings"
-
name
:
verify that afile.txt is absent
file
:
path={{output_dir_test}}/afile.txt state=absent
register
:
shell_result
5
register
:
shell_result
4
-
name
:
assert that the file was removed by the shell
assert
:
that
:
-
"
shell_result5.changed
==
False"
-
"
shell_result4.changed
==
False"
# multiline
-
name
:
execute a shell command using a literal multiline block
args
:
...
...
@@ -189,28 +203,28 @@
| tr -s ' ' \
| cut -f1 -d ' '
echo "this is a second line"
register
:
shell_result
6
register
:
shell_result
5
-
debug
:
var=shell_result
6
-
debug
:
var=shell_result
5
-
name
:
assert the multiline shell command ran as expected
assert
:
that
:
-
"
shell_result
6
.changed"
-
"
shell_result
6
.stdout
==
'5575bb6b71c9558db0b6fbbf2f19909eeb4e3b98
\n
this
is
a
second
line'"
-
"
shell_result
5
.changed"
-
"
shell_result
5
.stdout
==
'5575bb6b71c9558db0b6fbbf2f19909eeb4e3b98
\n
this
is
a
second
line'"
-
name
:
execute a shell command using a literal multiline block with arguments in it
shell
:
|
executable=/bin/bash
creates={{output_dir_test | expanduser}}/afile.txt
echo "test"
register
:
shell_result
7
register
:
shell_result
6
-
name
:
assert the multiline shell command with arguments in it run as expected
assert
:
that
:
-
"
shell_result
7
.changed"
-
"
shell_result
7
.stdout
==
'test'"
-
"
shell_result
6
.changed"
-
"
shell_result
6
.stdout
==
'test'"
-
name
:
remove the previously created file
file
:
path={{output_dir_test}}/afile.txt state=absent
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment