mirror of https://github.com/ansible/ansible.git
Fix locale_gen to compare native strings rather than mixing byte and text strings
Fixes #19426pull/17831/merge
parent
c771ab34c7
commit
e98c0a3009
@ -0,0 +1,3 @@
|
|||||||
|
destructive
|
||||||
|
needs/root
|
||||||
|
posix/ci/group3
|
@ -0,0 +1,2 @@
|
|||||||
|
dependencies:
|
||||||
|
- prepare_tests
|
@ -0,0 +1,94 @@
|
|||||||
|
- name: Is the locale we're going to test against installed?
|
||||||
|
shell: locale -a | grep pt_BR
|
||||||
|
register: initial_state
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Make sure the locale is not installed
|
||||||
|
locale_gen:
|
||||||
|
name: pt_BR
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Is the locale present?
|
||||||
|
shell: locale -a | grep pt_BR
|
||||||
|
register: cleaned
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Make sure the locale is not present
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "cleaned.rc == 1"
|
||||||
|
|
||||||
|
- name: Install the locale
|
||||||
|
locale_gen:
|
||||||
|
name: pt_BR
|
||||||
|
state: present
|
||||||
|
register: output
|
||||||
|
|
||||||
|
- name: Is the locale present?
|
||||||
|
shell: locale -a | grep pt_BR
|
||||||
|
register: post_check_output
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Make sure the locale is present and we say we installed it
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "post_check_output.rc == 0"
|
||||||
|
- "output.changed"
|
||||||
|
|
||||||
|
- name: Install the locale a second time
|
||||||
|
locale_gen:
|
||||||
|
name: pt_BR
|
||||||
|
state: present
|
||||||
|
register: output
|
||||||
|
|
||||||
|
- name: Is the locale present?
|
||||||
|
shell: locale -a | grep pt_BR
|
||||||
|
register: post_check_output
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Make sure the locale is present and we reported no change
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "post_check_output.rc == 0"
|
||||||
|
- "not output.changed"
|
||||||
|
|
||||||
|
- name: Remove the locale
|
||||||
|
locale_gen:
|
||||||
|
name: pt_BR
|
||||||
|
state: absent
|
||||||
|
register: output
|
||||||
|
|
||||||
|
- name: Is the locale present?
|
||||||
|
shell: locale -a | grep pt_BR
|
||||||
|
register: post_check_output
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Make sure the locale is absent and we reported a change
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "post_check_output.rc == 1"
|
||||||
|
- "output.changed"
|
||||||
|
|
||||||
|
- name: Remove the locale a second time
|
||||||
|
locale_gen:
|
||||||
|
name: pt_BR
|
||||||
|
state: absent
|
||||||
|
register: output
|
||||||
|
|
||||||
|
- name: Is the locale present?
|
||||||
|
shell: locale -a | grep pt_BR
|
||||||
|
register: post_check_output
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Make sure the locale is absent and we reported no change
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "post_check_output.rc == 1"
|
||||||
|
- "not output.changed"
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
- name: Reinstall the locale we tested against if it was initially installed
|
||||||
|
locale_gen:
|
||||||
|
name: pt_BR
|
||||||
|
state: present
|
||||||
|
when: initial_state.rc == 0
|
@ -0,0 +1,19 @@
|
|||||||
|
# (c) 2014, James Tanner <tanner.jc@gmail.com>
|
||||||
|
|
||||||
|
# This file is part of Ansible
|
||||||
|
#
|
||||||
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Ansible is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
- include: 'locale_gen.yml'
|
||||||
|
when: ansible_distribution in ('Ubuntu', 'Debian')
|
Loading…
Reference in New Issue