tests: image_prep fixes.

pull/350/head
David Wilson 6 years ago
parent e1306bb03d
commit e48e32cd0c

@ -73,7 +73,7 @@ also by Ansible's `osx_setup.yml`.
used to target this account, the parent session requires a TTY and the used to target this account, the parent session requires a TTY and the
account password must be entered. account password must be entered.
`mitogen__user1` .. `mitogen__user21` `mitogen__user1` .. `mitogen__user5`
These accounts do not have passwords set. They exist to test the Ansible These accounts do not have passwords set. They exist to test the Ansible
interpreter recycling logic. interpreter recycling logic.

@ -9,8 +9,12 @@
strategy: mitogen_linear strategy: mitogen_linear
become: true become: true
vars: vars:
distro: "{{ansible_distribution}}"
ver: "{{ansible_distribution_major_version}}"
special_users: special_users:
- has_sudo - has_sudo
- has_sudo_nopw
- has_sudo_pubkey - has_sudo_pubkey
- pw_required - pw_required
- readonly_homedir - readonly_homedir
@ -19,10 +23,10 @@
- slow_user - slow_user
- webapp - webapp
groups: user_groups:
- has_sudo: ['mitogen__group', '{{sudo_group[distro]}}'] has_sudo: ['mitogen__group', '{{sudo_group[distro]}}']
- has_sudo_pubkey: ['mitogen__group', '{{sudo_group[distro]}}'] has_sudo_pubkey: ['mitogen__group', '{{sudo_group[distro]}}']
- has_sudo_nopw: ['mitogen__group', 'mitogen__sudo_nopw'] has_sudo_nopw: ['mitogen__group', 'mitogen__sudo_nopw']
normal_users: "{{ normal_users: "{{
lookup('sequence', 'start=1 end=5 format=user%d', wantlist=True) lookup('sequence', 'start=1 end=5 format=user%d', wantlist=True)
@ -53,14 +57,14 @@
- user: - user:
name: "mitogen__{{item}}" name: "mitogen__{{item}}"
shell: /bin/bash shell: /bin/bash
groups: "{{groups[item]|default(['mitogen__group'])}}" groups: "{{user_groups[item]|default(['mitogen__group'])}}"
password: "{{ (item + '_password') | password_hash('sha256') }}" password: "{{ (item + '_password') | password_hash('sha256') }}"
loop: "{{all_users}}" loop: "{{all_users}}"
when: ansible_system != 'Darwin' when: ansible_system != 'Darwin'
- user: - user:
name: "mitogen__{{item}}" name: "mitogen__{{item}}"
shell: /bin/bash shell: /bin/bash
groups: "{{groups[item]|default(['mitogen__group'])}}" groups: "{{user_groups[item]|default(['mitogen__group'])}}"
password: "{{item}}_password" password: "{{item}}_password"
loop: "{{all_users}}" loop: "{{all_users}}"
when: ansible_system == 'Darwin' when: ansible_system == 'Darwin'

@ -23,9 +23,11 @@ def sh(s, *args):
label_by_id = {} label_by_id = {}
for base_image, label in [('debian:stretch', 'debian'), for base_image, label in [
('centos:6', 'centos6'), ('debian:stretch', 'debian'),
('centos:7', 'centos7')]: ('centos:6', 'centos6'),
('centos:7', 'centos7')
]:
args = sh('docker run --rm -it -d -h mitogen-%s %s /bin/bash', args = sh('docker run --rm -it -d -h mitogen-%s %s /bin/bash',
label, base_image) label, base_image)
container_id = subprocess.check_output(args).strip() container_id = subprocess.check_output(args).strip()

Loading…
Cancel
Save