add with_sequence lookup plugin

Plugin allows you to do easy counts for items.
This commit is contained in:
Jayson Vantuyl
2013-01-08 12:13:25 -08:00
parent b57b1f4cbe
commit 13ddd39db9
4 changed files with 273 additions and 6 deletions

View File

@@ -172,9 +172,9 @@ class TestPlaybook(unittest.TestCase):
print utils.jsonify(actual, format=True)
expected = {
"localhost": {
"changed": 7,
"changed": 9,
"failures": 0,
"ok": 9,
"ok": 14,
"skipped": 1,
"unreachable": 0
}
@@ -185,7 +185,7 @@ class TestPlaybook(unittest.TestCase):
assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True)
print "len(EVENTS) = %d" % len(EVENTS)
assert len(EVENTS) == 26
assert len(EVENTS) == 60
def test_includes(self):
pb = os.path.join(self.test_dir, 'playbook-includer.yml')

View File

@@ -26,6 +26,25 @@
- name: test LOOKUP and PIPE
action: command test "$LOOKUP(pipe, cat sample.j2)" = "$PIPE(cat sample.j2)"
- name: test with_sequence, generate
command: touch /tmp/seq-${item}
with_sequence: 0-16/2:%02x
- name: test with_sequence, fenceposts 1
copy: src=/tmp/seq-00 dest=/tmp/seq-10
- name: test with_sequence, fenceposts 2
file: dest=/tmp/seq-${item} state=absent
with_items: [11, 12]
- name: test with_sequence, missing
file: dest=/tmp/seq-${item} state=absent
with_sequence: 0x10/02:%02x
- name: test with_sequence,remove
file: dest=/tmp/seq-${item} state=absent
with_sequence: 0-0x10/02:%02x
- name: ensure test file doesnt exist
# command because file will return differently
action: command rm -f /tmp/ansible-test-with_lines-data