From b838cd316472ebc7a8dbbdb649f23f6f7db1fa09 Mon Sep 17 00:00:00 2001 From: Conor Schaefer Date: Wed, 13 Mar 2019 18:09:53 -0700 Subject: [PATCH] Enforces locale overrides on all playbooks Porting the locale override logic by @rmol to the usual medley of SecureDrop prod playbooks. Correspondingly updates the config tests to reuse the "all prod playbooks" lookup logic, so we're sure to retain coverage into the future. (cherry picked from commit c71bf16a420e577ee59deac68f2c792ba64f4429) --- install_files/ansible-base/securedrop-backup.yml | 2 ++ install_files/ansible-base/securedrop-logs.yml | 2 ++ install_files/ansible-base/securedrop-restore.yml | 2 ++ install_files/ansible-base/securedrop-tails.yml | 2 ++ molecule/ansible-config/tests/test_play_configuration.py | 5 +---- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/install_files/ansible-base/securedrop-backup.yml b/install_files/ansible-base/securedrop-backup.yml index e778cb9b814..51c3a8d212c 100644 --- a/install_files/ansible-base/securedrop-backup.yml +++ b/install_files/ansible-base/securedrop-backup.yml @@ -3,6 +3,8 @@ hosts: securedrop_application_server max_fail_percentage: 0 any_errors_fatal: yes + environment: + LC_ALL: C roles: - role: backup tags: backup diff --git a/install_files/ansible-base/securedrop-logs.yml b/install_files/ansible-base/securedrop-logs.yml index 0638714737b..6a3f430a0f8 100644 --- a/install_files/ansible-base/securedrop-logs.yml +++ b/install_files/ansible-base/securedrop-logs.yml @@ -4,6 +4,8 @@ become: yes max_fail_percentage: 0 any_errors_fatal: yes + environment: + LC_ALL: C vars: log_paths_reference: app: diff --git a/install_files/ansible-base/securedrop-restore.yml b/install_files/ansible-base/securedrop-restore.yml index 879ab1a3bb0..a6079f8294f 100644 --- a/install_files/ansible-base/securedrop-restore.yml +++ b/install_files/ansible-base/securedrop-restore.yml @@ -3,6 +3,8 @@ hosts: securedrop_application_server max_fail_percentage: 0 any_errors_fatal: yes + environment: + LC_ALL: C roles: - role: restore tags: restore diff --git a/install_files/ansible-base/securedrop-tails.yml b/install_files/ansible-base/securedrop-tails.yml index 6aeeb11fc31..e63439a2ae3 100755 --- a/install_files/ansible-base/securedrop-tails.yml +++ b/install_files/ansible-base/securedrop-tails.yml @@ -8,6 +8,8 @@ any_errors_fatal: yes connection: local gather_facts: yes + environment: + LC_ALL: C roles: - role: tails-config tags: tails-config diff --git a/molecule/ansible-config/tests/test_play_configuration.py b/molecule/ansible-config/tests/test_play_configuration.py index 87296bdf6fe..942e13e0783 100644 --- a/molecule/ansible-config/tests/test_play_configuration.py +++ b/molecule/ansible-config/tests/test_play_configuration.py @@ -80,14 +80,11 @@ def test_any_errors_fatal(host, playbook): assert play['any_errors_fatal'] -@pytest.mark.parametrize('playbook', ['securedrop-prod.yml', 'securedrop-staging.yml']) +@pytest.mark.parametrize('playbook', find_ansible_playbooks()) def test_locale(host, playbook): """ The securedrop-prod and securedrop-staging playbooks should control the locale in the host environment by setting LC_ALL=C. - - TODO: evaluate whether to do the same for the rest of the - playbooks. """ with io.open(os.path.join(ANSIBLE_BASE, playbook), 'r') as f: playbook_yaml = yaml.safe_load(f)