Merge remote-tracking branch 'origin/dmw'
* origin/dmw: docs: update Changelog. issue #536: rework how 2.3-compatible simplejson is served .github: add some more questions to issue template docs: duplicate word docs: update Changelog. tests/ansible: Spec.become_method() test & mitogen_via= fix. setup.py: include LICENSE; closes #538. tests/ansible: Spec.become() test tests/ansible: Spec.password() test, document interactive pw limitation. tests/ansible: Spec.remote_user() test & mitogen_via= fix. tests/ansible: Spec.remote_addr() test & mitogen_via= fix. tests/ansible: Spec.transport() test. docs: lighter pink docs: add 'Fixes' heading docs: more margin tweaks for changelog docs: tighter <p> margins, even less shouting, red headings docs: tidy up footer and GitHub link docs: enable fixed_sidebar docs: sans-serif fonts, reduce shouty headings issue #536: add mitogen_via= tests too. ansible: fix a crash on 2.3 when mitogen_via= host is missing. tests: for 2.3 compatibility, disable gcloud.py for nowpull/564/head
commit
2fe8332983
@ -0,0 +1 @@
|
||||
include LICENSE
|
@ -1,8 +1,4 @@
|
||||
<p>
|
||||
<br>
|
||||
<a class="github-button" href="https://github.com/dw/mitogen" data-size="large" data-show-count="true" aria-label="Star dw/mitogen on GitHub">Star</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="https://github.com/dw/mitogen/">GitHub Repository</a>
|
||||
<a class="github-button" href="https://github.com/dw/mitogen/" data-size="large" data-show-count="true" aria-label="Star dw/mitogen on GitHub">Star</a>
|
||||
</p>
|
||||
|
@ -1,10 +1,33 @@
|
||||
# integration/transport_config
|
||||
# Hosts with twiddled configs that need to be checked somehow.
|
||||
|
||||
|
||||
# tansport()
|
||||
tc-transport-unset
|
||||
tc-transport-local ansible_connection=local
|
||||
|
||||
# python_path()
|
||||
tc-python-path-unset
|
||||
tc-python-path-hostvar ansible_python_interpreter=/hostvar/path/to/python
|
||||
|
||||
# local connections get virtualenv python path
|
||||
tc-python-path-local-unset ansible_connection=local
|
||||
tc-python-path-local-explicit ansible_connection=local ansible_python_interpreter=/a/b/c
|
||||
|
||||
# remote_addr()
|
||||
tc-remote-addr-unset # defaults to inventory_hostname
|
||||
tc-remote-addr-explicit-ssh ansible_ssh_host=ansi.ssh.host
|
||||
tc-remote-addr-explicit-host ansible_host=ansi.host
|
||||
tc-remote-addr-explicit-both ansible_ssh_host=a.b.c ansible_host=b.c.d
|
||||
|
||||
# password()
|
||||
tc-password-unset
|
||||
tc-password-explicit-ssh ansible_ssh_pass=ansi-ssh-pass
|
||||
tc-password-explicit-user ansible_password=ansi-pass
|
||||
tc-password-explicit-both ansible_password=a.b.c ansible_ssh_pass=c.b.a
|
||||
|
||||
# become()
|
||||
tc-become-unset
|
||||
tc-become-set
|
||||
|
||||
# become_method()
|
||||
tc-become-method-unset
|
||||
tc-become-method-su ansible_become_method=su
|
||||
|
@ -0,0 +1,4 @@
|
||||
# Include me for plays that can't run on vanilla.
|
||||
#
|
||||
- meta: end_play
|
||||
when: not is_mitogen
|
@ -1,2 +1,7 @@
|
||||
|
||||
- include: become.yml
|
||||
- include: become_method.yml
|
||||
- include: password.yml
|
||||
- include: python_path.yml
|
||||
- include: remote_addr.yml
|
||||
- include: remote_user.yml
|
||||
- include: transport.yml
|
||||
|
@ -0,0 +1,68 @@
|
||||
# Each case is followed by mitogen_via= case to test hostvars method.
|
||||
|
||||
|
||||
# No become set.
|
||||
- name: integration/transport_config/become.yml
|
||||
hosts: tc-become-unset
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert:
|
||||
that:
|
||||
- out.result|length == 1
|
||||
- out.result[0].method == "ssh"
|
||||
- out.result[0].kwargs.username == "ansible-cfg-remote-user"
|
||||
|
||||
- hosts: tc-become-unset
|
||||
vars: {mitogen_via: becomeuser@tc-become-set}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert:
|
||||
that:
|
||||
- out.result|length == 3
|
||||
- out.result[0].method == "ssh"
|
||||
- out.result[0].kwargs.username == "ansible-cfg-remote-user"
|
||||
|
||||
- out.result[1].method == "sudo"
|
||||
- out.result[1].kwargs.username == "becomeuser"
|
||||
|
||||
- out.result[2].method == "ssh"
|
||||
- out.result[2].kwargs.hostname == "tc-become-unset"
|
||||
|
||||
|
||||
# Become set.
|
||||
- name: integration/transport_config/become.yml
|
||||
hosts: tc-become-set
|
||||
become: true
|
||||
become_user: becomeuser
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert:
|
||||
that:
|
||||
- out.result|length == 2
|
||||
- out.result[0].method == "ssh"
|
||||
- out.result[0].kwargs.username == "ansible-cfg-remote-user"
|
||||
- out.result[1].method == "sudo"
|
||||
- out.result[1].kwargs.username == "becomeuser"
|
||||
|
||||
- hosts: tc-become-set
|
||||
vars: {mitogen_via: tc-become-unset}
|
||||
become: true
|
||||
become_user: becomeuser
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert:
|
||||
that:
|
||||
- out.result|length == 3
|
||||
- out.result[0].method == "ssh"
|
||||
- out.result[0].kwargs.hostname == "tc-become-unset"
|
||||
- out.result[0].kwargs.username == "ansible-cfg-remote-user"
|
||||
|
||||
- out.result[1].method == "ssh"
|
||||
- out.result[1].kwargs.hostname == "tc-become-set"
|
||||
|
||||
- out.result[2].method == "sudo"
|
||||
- out.result[2].kwargs.username == "becomeuser"
|
@ -0,0 +1,83 @@
|
||||
# Each case is followed by mitogen_via= case to test hostvars method.
|
||||
|
||||
|
||||
# No become-method set.
|
||||
- name: integration/transport_config/become-method.yml
|
||||
hosts: tc-become-method-unset
|
||||
become: true
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert:
|
||||
that:
|
||||
- out.result|length == 2
|
||||
- out.result[0].method == "ssh"
|
||||
- out.result[1].method == "sudo"
|
||||
|
||||
- hosts: tc-become-method-unset
|
||||
vars: {mitogen_via: becomeuser@tc-become-method-su}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert:
|
||||
that:
|
||||
- out.result|length == 3
|
||||
- out.result[0].method == "ssh"
|
||||
- out.result[1].method == "su"
|
||||
- out.result[1].kwargs.username == "becomeuser"
|
||||
- out.result[2].method == "ssh"
|
||||
- out.result[2].kwargs.hostname == "tc-become-method-unset"
|
||||
|
||||
|
||||
# ansible_become_method=su
|
||||
- hosts: tc-become-method-su
|
||||
become: true
|
||||
become_user: becomeuser
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert:
|
||||
that:
|
||||
- out.result|length == 2
|
||||
- out.result[0].method == "ssh"
|
||||
- out.result[1].method == "su"
|
||||
- out.result[1].kwargs.username == "becomeuser"
|
||||
|
||||
- hosts: tc-become-method-su
|
||||
vars: {mitogen_via: tc-become-method-unset}
|
||||
become: true
|
||||
become_user: becomeuser
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert:
|
||||
that:
|
||||
- out.result|length == 3
|
||||
- out.result[0].method == "ssh"
|
||||
- out.result[0].kwargs.hostname == "tc-become-method-unset"
|
||||
|
||||
- out.result[1].method == "ssh"
|
||||
- out.result[1].kwargs.hostname == "tc-become-method-su"
|
||||
|
||||
- out.result[2].method == "su"
|
||||
- out.result[2].kwargs.username == "becomeuser"
|
||||
|
||||
|
||||
|
||||
# mitogen_via used to specify explicit become method
|
||||
- hosts: tc-become-method-unset
|
||||
vars: {mitogen_via: "doas:doasuser@tc-become-method-su"}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert:
|
||||
that:
|
||||
- out.result|length == 3
|
||||
- out.result[0].method == "ssh"
|
||||
- out.result[0].kwargs.hostname == "tc-become-method-su"
|
||||
|
||||
- out.result[1].method == "doas"
|
||||
- out.result[1].kwargs.username == "doasuser"
|
||||
|
||||
- out.result[2].method == "ssh"
|
||||
- out.result[2].kwargs.hostname == "tc-become-method-unset"
|
@ -0,0 +1,94 @@
|
||||
# Each case is followed by mitogen_via= case to test hostvars method.
|
||||
|
||||
|
||||
# When no ansible_ssh_pass/ansible_password= is set, password comes via
|
||||
# interactive input.
|
||||
- name: integration/transport_config/password.yml
|
||||
hosts: tc-password-unset
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "" # actually null, but assert_equal limitation
|
||||
|
||||
- hosts: tc-password-unset
|
||||
vars: {mitogen_via: tc-password-explicit-ssh}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "ansi-ssh-pass"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.password
|
||||
right: ""
|
||||
|
||||
|
||||
# ansible_ssh_user=
|
||||
|
||||
- hosts: tc-password-explicit-ssh
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "ansi-ssh-pass"
|
||||
|
||||
- hosts: tc-password-explicit-ssh
|
||||
vars: {mitogen_via: tc-password-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: ""
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.password
|
||||
right: "ansi-ssh-pass"
|
||||
|
||||
|
||||
# ansible_user=
|
||||
|
||||
- hosts: tc-password-explicit-pass
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "ansi-pass"
|
||||
|
||||
- hosts: tc-password-explicit-pass
|
||||
vars: {mitogen_via: tc-password-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: ""
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.password
|
||||
right: "ansi-pass"
|
||||
|
||||
|
||||
# both; ansible_ssh_user= takes precedence according to play_context.py.
|
||||
|
||||
- hosts: tc-password-explicit-both
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "c.b.a"
|
||||
|
||||
- hosts: tc-password-explicit-both
|
||||
vars: {mitogen_via: tc-password-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: ""
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.password
|
||||
right: "c.b.a"
|
@ -0,0 +1,95 @@
|
||||
|
||||
# Each case is followed by mitogen_via= case to test hostvars method.
|
||||
|
||||
|
||||
# When no ansible_host/ansible_ssh_host= is set, hostname is same as inventory
|
||||
# name.
|
||||
- name: integration/transport_config/remote_addr.yml
|
||||
hosts: tc-remote-addr-unset
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.hostname
|
||||
right: "tc-remote-addr-unset"
|
||||
|
||||
- hosts: tc-remote-addr-unset
|
||||
vars: {mitogen_via: tc-remote-addr-explicit-ssh}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.hostname
|
||||
right: "ansi.ssh.host"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.hostname
|
||||
right: "tc-remote-addr-unset"
|
||||
|
||||
|
||||
# ansible_ssh_host=
|
||||
|
||||
- hosts: tc-remote-addr-explicit-ssh
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.hostname
|
||||
right: "ansi.ssh.host"
|
||||
|
||||
- hosts: tc-remote-addr-explicit-ssh
|
||||
vars: {mitogen_via: tc-remote-addr-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.hostname
|
||||
right: "tc-remote-addr-unset"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.hostname
|
||||
right: "ansi.ssh.host"
|
||||
|
||||
|
||||
# ansible_host=
|
||||
|
||||
- hosts: tc-remote-addr-explicit-host
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.hostname
|
||||
right: "ansi.host"
|
||||
|
||||
- hosts: tc-remote-addr-explicit-host
|
||||
vars: {mitogen_via: tc-remote-addr-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.hostname
|
||||
right: "tc-remote-addr-unset"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.hostname
|
||||
right: "ansi.host"
|
||||
|
||||
|
||||
# both; ansible_ssh_host= takes precedence according to play_context.py.
|
||||
|
||||
- hosts: tc-remote-addr-explicit-both
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.hostname
|
||||
right: "a.b.c"
|
||||
|
||||
- hosts: tc-remote-addr-explicit-both
|
||||
vars: {mitogen_via: tc-remote-addr-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.hostname
|
||||
right: "tc-remote-addr-unset"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.hostname
|
||||
right: "a.b.c"
|
@ -0,0 +1,96 @@
|
||||
|
||||
# Each case is followed by mitogen_via= case to test hostvars method.
|
||||
|
||||
|
||||
# When no ansible_user/ansible_ssh_user= is set, username is
|
||||
# C.DEFAULT_REMOTE_USER.
|
||||
- name: integration/transport_config/remote_user.yml
|
||||
hosts: tc-remote-user-unset
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.username
|
||||
# We set DEFAULT_REMOTE_USER in our ansible.cfg
|
||||
right: "ansible-cfg-remote-user"
|
||||
|
||||
- hosts: tc-remote-user-unset
|
||||
vars: {mitogen_via: tc-remote-user-explicit-ssh}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.username
|
||||
right: "ansi-ssh-user"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.username
|
||||
right: "ansible-cfg-remote-user"
|
||||
|
||||
|
||||
# ansible_ssh_user=
|
||||
|
||||
- hosts: tc-remote-user-explicit-ssh
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.username
|
||||
right: "ansi-ssh-user"
|
||||
|
||||
- hosts: tc-remote-user-explicit-ssh
|
||||
vars: {mitogen_via: tc-remote-user-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.username
|
||||
right: "ansible-cfg-remote-user"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.username
|
||||
right: "ansi-ssh-user"
|
||||
|
||||
|
||||
# ansible_user=
|
||||
|
||||
- hosts: tc-remote-user-explicit-user
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.username
|
||||
right: "ansi-user"
|
||||
|
||||
- hosts: tc-remote-user-explicit-host
|
||||
vars: {mitogen_via: tc-remote-user-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.username
|
||||
right: "ansible-cfg-remote-user"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.username
|
||||
right: "ansi-user"
|
||||
|
||||
|
||||
# both; ansible_ssh_user= takes precedence according to play_context.py.
|
||||
|
||||
- hosts: tc-remote-user-explicit-both
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.username
|
||||
right: "c.b.a"
|
||||
|
||||
- hosts: tc-remote-user-explicit-both
|
||||
vars: {mitogen_via: tc-remote-user-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.username
|
||||
right: "ansible-cfg-remote-user"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.username
|
||||
right: "c.b.a"
|
@ -0,0 +1,48 @@
|
||||
# Each case is followed by mitogen_via= case to test hostvars method.
|
||||
|
||||
|
||||
# When no ansible_connection= is set, transport comes via ansible.cfg ("smart"
|
||||
# is parsed away to either paramiko or ssh).
|
||||
- name: integration/transport_config/transport.yml
|
||||
hosts: tc-transport-unset
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].method
|
||||
right: "ssh"
|
||||
|
||||
- hosts: tc-transport-local
|
||||
vars: {mitogen_via: tc-transport-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].method
|
||||
right: "ssh"
|
||||
- assert_equal:
|
||||
left: out.result[1].method
|
||||
right: "local"
|
||||
|
||||
|
||||
# ansible_connection=local
|
||||
|
||||
- hosts: tc-transport-local
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].method
|
||||
right: "local"
|
||||
|
||||
- hosts: tc-transport-unset
|
||||
vars: {mitogen_via: tc-transport-local}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].method
|
||||
right: "local"
|
||||
- assert_equal:
|
||||
left: out.result[1].method
|
||||
right: "ssh"
|
Loading…
Reference in New Issue