ansible: emulate /etc/environment reloading behaviour of vanilla.
This change is relatively incomplete -- ideally we could snapshot os.environ and /etc/environment at startup and respect key deletions too, but that's a lot more work. Wait for a bug report instead. Closes #338.pull/350/head
parent
81c8156965
commit
1473f49505
@ -0,0 +1,66 @@
|
||||
# issue #338: ensure /etc/environment is reloaded if it changes.
|
||||
# Actually this test uses ~/.pam_environment, which is using the same logic,
|
||||
# but less likely to brick a development workstation
|
||||
|
||||
- name: integration/runner/etc_environment.yml
|
||||
hosts: test-targets
|
||||
any_errors_fatal: true
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- meta: end_play
|
||||
when: ansible_virtualization_type != "docker"
|
||||
|
||||
|
||||
# ~/.pam_environment
|
||||
|
||||
- file:
|
||||
path: ~/.pam_environment
|
||||
state: absent
|
||||
|
||||
- shell: echo $MAGIC_NEW_ENV
|
||||
register: echo
|
||||
|
||||
- assert:
|
||||
that: echo.stdout == ""
|
||||
|
||||
- copy:
|
||||
dest: ~/.pam_environment
|
||||
content: |
|
||||
MAGIC_NEW_ENV=321
|
||||
|
||||
- shell: echo $MAGIC_NEW_ENV
|
||||
register: echo
|
||||
|
||||
- assert:
|
||||
that: echo.stdout == "321"
|
||||
|
||||
- file:
|
||||
path: ~/.pam_environment
|
||||
state: absent
|
||||
|
||||
# /etc/environment
|
||||
|
||||
- file:
|
||||
path: /etc/environment
|
||||
state: absent
|
||||
|
||||
- shell: echo $MAGIC_ETC_ENV
|
||||
register: echo
|
||||
|
||||
- assert:
|
||||
that: echo.stdout == ""
|
||||
|
||||
- copy:
|
||||
dest: /etc/environment
|
||||
content: |
|
||||
MAGIC_ETC_ENV=555
|
||||
|
||||
- shell: echo $MAGIC_ENV_ENV
|
||||
register: echo
|
||||
|
||||
- assert:
|
||||
that: echo.stdout == "555"
|
||||
|
||||
- file:
|
||||
path: /etc/environment
|
||||
state: absent
|
Loading…
Reference in New Issue