[stream-refactor] allow doas_test to succeed on CentOS

Unlike on Debian, some environment variables that tickle
getpass.getuser() are being inherited. So use getuid() instead.

Also install the doas binary on CentOS. CI was changed (I believe) to
shrink the configuration matrix, and now these tests run on CentOS too.
pull/607/head
David Wilson 5 years ago
parent 2ba3973bc5
commit 2f950b3bda

@ -1,5 +1,4 @@
import getpass
import os import os
import mitogen import mitogen
@ -59,7 +58,7 @@ class DoasTest(testlib.DockerMixin, testlib.TestCase):
password='has_sudo_password', password='has_sudo_password',
) )
context = self.router.su(via=ssh, password='rootpassword') context = self.router.su(via=ssh, password='rootpassword')
self.assertEquals('root', context.call(getpass.getuser)) self.assertEquals(0, context.call(os.getuid))
if __name__ == '__main__': if __name__ == '__main__':

@ -11,10 +11,13 @@ code, the OS X config just has the user accounts.
See ../README.md for a (mostly) description of the accounts created. See ../README.md for a (mostly) description of the accounts created.
## Building the containers ## Building the containers
``./build_docker_images.sh`` ``./build_docker_images.sh``
Requires Ansible 2.3.x.x in order to target CentOS 5
## Preparing an OS X box ## Preparing an OS X box

@ -87,27 +87,24 @@
shell: locale-gen shell: locale-gen
when: distro == "Debian" when: distro == "Debian"
- name: Install prebuilt 'doas' binary on Debian - name: Install prebuilt 'doas' binary
unarchive: unarchive:
dest: / dest: /
src: ../data/docker/doas-debian.tar.gz src: ../data/docker/doas-debian.tar.gz
when: distro == "Debian"
- name: Make prebuilt 'doas' binary executable on Debian - name: Make prebuilt 'doas' binary executable
file: file:
path: /usr/local/bin/doas path: /usr/local/bin/doas
mode: 'u=rwxs,go=rx' mode: 'u=rwxs,go=rx'
owner: root owner: root
group: root group: root
when: distro == "Debian"
- name: Install doas.conf on Debian - name: Install doas.conf
copy: copy:
dest: /etc/doas.conf dest: /etc/doas.conf
content: | content: |
permit :mitogen__group permit :mitogen__group
permit :root permit :root
when: distro == "Debian"
- name: Vanilla Ansible needs simplejson on CentOS 5. - name: Vanilla Ansible needs simplejson on CentOS 5.
shell: mkdir -p /usr/lib/python2.4/site-packages/simplejson/ shell: mkdir -p /usr/lib/python2.4/site-packages/simplejson/

Loading…
Cancel
Save