File: synchronize.yml

package info (click to toggle)
python-mitogen 0.3.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,708 kB
  • sloc: python: 24,457; sh: 198; makefile: 74; perl: 19; ansic: 18
file content (83 lines) | stat: -rw-r--r-- 2,333 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Verify basic operation of the synchronize module.

- name: integration/action/synchronize.yml
  hosts: test-targets
  vars:
    ansible_user: mitogen__has_sudo_pubkey
    ansible_become_pass: has_sudo_pubkey_password
    ansible_ssh_private_key_file: /tmp/synchronize-action-key

    # https://github.com/ansible/ansible/issues/56629
    ansible_ssh_pass: ''
    ansible_password: ''
  tasks:
    # must copy git file to set proper file mode.
    - name: Copy synchronize-action-key
      copy:
        dest: /tmp/synchronize-action-key
        src: ../../../data/docker/mitogen__has_sudo_pubkey.key
        mode: u=rw,go=
      delegate_to: localhost

    - name: Cleanup sync-test
      file:
        path: /tmp/sync-test
        state: absent
      delegate_to: localhost
      run_once: true

    - name: Create sync-test
      file:
        path: /tmp/sync-test
        state: directory
      delegate_to: localhost
      run_once: true

    - name: Create syn-test item
      copy:
        dest: /tmp/sync-test/item
        content: "item!"
      delegate_to: localhost
      run_once: true

    - name: Ensure clean slate
      become: true
      file:
        path: /tmp/sync-test.out
        state: absent

    # exception:   File "/tmp/venv/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 129, in cleanup
    # exception:     self._remove_tmp_path(self._connection._shell.tmpdir)
    # exception: AttributeError: 'get_with_context_result' object has no attribute '_shell'
    # TODO: looks like a bug on Ansible's end with 2.10? Maybe 2.10.1 will fix it
    # https://github.com/dw/mitogen/issues/746
    - name: do synchronize test
      block:
        - synchronize:
            private_key: /tmp/synchronize-action-key
            dest: /tmp/sync-test.out
            src: /tmp/sync-test/

        - slurp:
            src: /tmp/sync-test.out/item
          register: out

        - set_fact: outout="{{out.content|b64decode}}"

        - assert:
            that: outout == "item!"
            fail_msg: |
              outout={{ outout }}
      when: False

    - name: Cleanup
      become: true
      file:
        path: "{{ item }}"
        state: absent
      with_items:
        - /tmp/synchronize-action-key
        - /tmp/sync-test
        - /tmp/sync-test.out
  tags:
    - synchronize