ansible/test/integration/targets/alternatives/tasks/setup_test.yml
Pilou 016cd0691c alternatives: handle absent link, add integration tests (#27967)
* alternatives: add integration tests

* alternatives: handle absent link (fix AttributeError)

Error occurred at least on Debian Stretch and OpenSuse 42.2:
Traceback (most recent call last):
  File "/tmp/ansible_RY6X41/ansible_module_alternatives.py", line 161, in <module>
    main()
  File "/tmp/ansible_RY6X41/ansible_module_alternatives.py", line 113, in main
    current_path = current_path_regex.search(display_output).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

update-alternatives stdout sample:
dummy - manual mode
  link best version is /usr/bin/dummy1
  link currently absent
  link dummy is /usr/bin/dummy

* alternatives: PEP 8 fixes

* alternatives: fix copyright in integration tests

* alternatives: nested loops handle more than 2 items

Thanks to Michael Scherer (@mscherer) for pointing that.

* alternatives: enable integration tests
2017-08-16 10:35:56 -04:00

22 lines
640 B
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- template:
src: dummy_alternative
dest: '{{ alternatives_dir }}/dummy'
owner: root
group: root
mode: 0644
when: with_alternatives or ansible_os_family != 'RedHat'
# update-alternatives included in Fedora 26 (1.10) & Red Hat 7.4 (1.8) segfaults
# when <admindir>/dummy file contains only mode and link. Hence the file is
# deleted instead of containing only mode and link. The file below works fine with
# newer version of update-alternatives:
# """
# auto
# /usr/bin/dummy
#
#
# """
- file:
path: '{{ alternatives_dir }}/dummy'
state: absent
when: not with_alternatives and ansible_os_family == 'RedHat'