Skip to content
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

5433 replace platform.linux distribution #5559

Conversation

DrGFreeman
Copy link
Contributor

Status

Ready for review.

Description of Changes

Fixes #5433

Changes proposed in this pull request:

  • Replace the deprecated platform.linux_distribution function by reading the os version directly from /etc/lsb-release.
  • Update mock in tests/test_source.py::test_metadata_route to reflect new server_os variable.

Testing

How should the reviewer test this PR?
Write out any special testing steps here.

  1. Run tests with make tests. The server_os value returned by the /metadata endpoint is verified in tests/functional/test_source_metadata.py::TestInstanceMetadata::test_instance_metadata.
  2. Run make dev and verify the server_os parameter on /metadata equals "16.04".
  3. Test in "focal" staging environment.

Deployment

Any special considerations for deployment? Consider both:

  1. Upgrading existing production instances.
  2. New installs.

Checklist

If you made changes to the server application code:

  • Linting (make lint) and tests (make test) pass in the development container

If you made changes to securedrop-admin:

  • Linting and tests (make -C admin test) pass in the admin development container
    N/A.

If you made changes to the system configuration:

If you made non-trivial code changes:

  • I have written a test plan and validated it for this PR
    N/A. Already covered by functional test.

If you made changes to documentation:

  • Doc linting (make docs-lint) passed locally
    N/A.

If you added or updated a code dependency:

Choose one of the following:

  • I have performed a diff review and pasted the contents to the packaging wiki
  • I would like someone else to do the diff review
    N/A.

- Replace deprecated platform.linux_distribution function by reading the
  os version directly from /etc/lsb-release.
- Update mock in test_metadata_route to reflect new server_os variable.
@kushaldas kushaldas self-assigned this Oct 7, 2020
Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected in both Xenial and Focal. Thank you for the PR.

@@ -8,6 +7,10 @@
import version


with open("/etc/lsb-release", "r") as f:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/etc/lsb-release comes from the base-files package.

@kushaldas kushaldas merged commit 43da794 into freedomofpress:develop Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update removed platform.linux_distribution funtion call in Python 3.8
2 participants