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
2816b867
Commit
2816b867
authored
Mar 30, 2015
by
Brian Coca
Committed by
Toshio Kuratomi
May 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed corner case when counting backwards, added test cases for count=0 and backwards counts
parent
196d9e28
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletions
+23
-1
lib/ansible/runner/lookup_plugins/sequence.py
+5
-1
test/integration/roles/test_iterators/tasks/main.yml
+18
-0
No files found.
lib/ansible/runner/lookup_plugins/sequence.py
View file @
2816b867
...
...
@@ -159,7 +159,11 @@ class LookupModule(object):
raise
AnsibleError
(
"bad formatting string:
%
s"
%
self
.
format
)
def
generate_sequence
(
self
):
numbers
=
xrange
(
self
.
start
,
self
.
end
+
1
,
self
.
stride
)
if
self
.
stride
>
0
:
adjust
=
1
else
:
adjust
=
-
1
numbers
=
xrange
(
self
.
start
,
self
.
end
+
adjust
,
self
.
stride
)
for
i
in
numbers
:
try
:
...
...
test/integration/roles/test_iterators/tasks/main.yml
View file @
2816b867
...
...
@@ -60,6 +60,10 @@
set_fact
:
"
{{
'x'
+
item
}}={{
item
}}"
with_sequence
:
start=0 end=3
-
name
:
test with_sequence backwards
set_fact
:
"
{{
'y'
+
item
}}={{
item
}}"
with_sequence
:
start=3 end=0 stride=-1
-
name
:
verify with_sequence
assert
:
that
:
...
...
@@ -67,6 +71,20 @@
-
"
x1
==
'1'"
-
"
x2
==
'2'"
-
"
x3
==
'3'"
-
"
y3
==
'3'"
-
"
y2
==
'2'"
-
"
y1
==
'1'"
-
"
y0
==
'0'"
-
name
:
test with_sequence not failing on count == 0
debug
:
msg='previously failed with backward counting error'
with_sequence
:
count=0
register
:
count_of_zero
-
assert
:
that
:
-
count_of_zero | skipped
-
not count_of_zero | failed
# WITH_RANDOM_CHOICE
...
...
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