-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Control locale during Ansible runs #4252
Conversation
I will be testing this will the following plan
[0] Contents of /etc/default/locale:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me so far (one comment inline). I have tested this branch using the above test plan:
- Set up Prod VMs (14.04) with french locale (setting the contents of /etc/default/locale [0]) and running
sudo locale-gen fr_FR && sudo locale-gen fr_FR.UTF-8 && sudo update-locale
- Reboot and ensure
locale
returns [0], that various tooling is in French - Install on this branch from Tails, and ensure the testing completes successfully
- Upgrade to 16.04 and re-run the playbook
I will test on hardware tomorrow morning, based on the instructions provided in #4219 (comment)
@@ -2,6 +2,8 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to also apply these changes to securedrop-staging.yml
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summarizing out of band discussion, we should also add the locale blocks to the other "prod" SD playbooks, such as -logs
and -backup
. Technically only -logs
uses register
, which is how we first encountered the error we're aiming to resolve here, but adding coverage to the other playbooks will also let us broaden the config test and reuse the existing "check all prod SD playbooks" logic.
I'll tack on a commit to implement this before final review.
@@ -2,6 +2,8 @@ | |||
--- | |||
- name: Ensure validation is run before prod install | |||
hosts: localhost | |||
environment: | |||
LC_ALL: C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about validating that this variable is set (via assert
or otherwise) at the start of each play?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than an assert statement, we can add a config test (to be run in CI) that confirms the environment is set as expected on every play. See here for an example: https://github.com/freedomofpress/securedrop/blob/10a2eeedc3c22fd39e6a7eda4ca8f4bca1ca6024/molecule/ansible-config/tests/test_max_fail_percentage.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmol has already added the corresponding config test here, which will help guard against regressions in the future: if new plays are added without the explicit locale declaration, CI will report an error.
To avoid non-English system locales from breaking tasks that parse command output expecting English, set the environment variable LC_ALL=C in each play of securedrop-prod.yml.
Add configuration test to check locale is set for all plays there and in securedrop-prod.
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.
Tacked on a commit porting the locale overrides to all production playbooks, with corresponding config test update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving based on visual review of changes, as well as @emkll's detailed test report.
@emkll I tried |
@kushaldas I think you need to pass to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on @rmol's instructions, a minimal way to change locale on VMs:
sudo locale-gen fr_FR.UTF-8
sudo update-locale --reset LANG=fr_FR.UTF-8
sudo reboot
Once that was done, followed this test plan:
- Installs successfully on this branch
- Infra tests pass
-
./securedrop-admin backup
and./securedrop-admin
restore complete successfully -
./securedrop-admin logs
completes successfully -
./securedrop-admin tailsconfig
completes successfully
LGTM!
Status
Ready for review
Description of Changes
To avoid non-English system locales from breaking tasks that parse command output expecting English, set the environment variable LC_ALL=C in each play of securedrop-prod.yml.
Fixes #4219.
Testing
Install app and mon with a non-English locale. Verify that running
securedrop-admin install
completes without errors. If it breaks on tasks ininstall_tor.yml
, or anywhere else, this fix has not worked.Checklist
If you made changes to
securedrop-admin
:make -C admin test
) pass in the admin development containerIf you made non-trivial code changes: