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

Chore/python3 #646

Merged
merged 29 commits into from
Jul 12, 2019
Merged

Chore/python3 #646

merged 29 commits into from
Jul 12, 2019

Conversation

paulineribeyre
Copy link
Contributor

@paulineribeyre paulineribeyre commented Jun 18, 2019

  • updated dockerfile to use the python 3 base image
  • did NOT update shibboleth dockerfile to work with python 3
  • ran 2to3 for python 2 to 3 syntax updates
  • encoding fixes: lots of encoding issues due to all python 3 strings now being unicode; may have missed some…
  • Exception.message does not exist in python 3, so the custom Gen3 exceptions (CirrusNotFound, GoogleAPIError, etc) that inherit from Exception don't have a message attribute anymore
  • removed enum34 dependency because it is not compatible with the standard library's enum on python >3.4
  • removed conditional imports for python 2/3 compatibility since Fence now only works on python 3
  • fixed test logic test_update_user_service_account_success

TODO:
pin versions after PRs are merged:

Breaking Changes

  • Python 3 instead of python 2

Dependency updates

  • Remove unused flask-postgres-session dependency
  • Remove enum34 dependency
  • Use python 3 versions of cirrus (1.0.0), storage-client, cdisutilstest (1.0.0), userdatamodel (2.0.0), cdispyutils (1.0.0) and authutils (4.0.0)

@PlanXCyborg
Copy link
Contributor

PlanXCyborg commented Jun 18, 2019

The style in this PR agrees with black. ✔️

This formatting comment was generated automatically by a script in uc-cdis/wool.

@coveralls
Copy link

coveralls commented Jun 18, 2019

Pull Request Test Coverage Report for Build 7256

  • 69 of 103 (66.99%) changed or added relevant lines in 31 files are covered.
  • 5 unchanged lines in 3 files lost coverage.
  • Overall coverage remained the same at ?%

Changes Missing Coverage Covered Lines Changed/Added Lines %
fence/error_handler.py 4 5 80.0%
fence/jwt/keys.py 7 8 87.5%
fence/rbac/client.py 1 2 50.0%
fence/resources/storage/cdis_jwt.py 0 2 0.0%
fence/utils.py 5 8 62.5%
fence/scripting/google_monitor.py 1 5 20.0%
fence/scripting/fence_create.py 0 7 0.0%
fence/resources/aws/boto_manager.py 0 15 0.0%
Files with Coverage Reduction New Missed Lines %
fence/resources/google/validity.py 1 88.1%
fence/resources/aws/boto_manager.py 2 20.69%
fence/jwt/keys.py 2 86.96%
Totals Coverage Status
Change from base Build 7250: 0.0%
Covered Lines:
Relevant Lines: 0

💛 - Coveralls

Dockerfile Outdated

COPY . /fence
# number of uwsgi worker processes
ENV UWSGI_CHEAPER 2
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -181,8 +181,13 @@ def public_key_to_jwk(self):
Return:
dict: JWK representation of the public key
"""
n, e = _rsa_public_numbers(self.public_key)
# n, e = _rsa_public_numbers(self.public_key)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can fully remove this

@@ -22,15 +22,15 @@ def reload_modules(module_name):
# actually exist, even if it does. To do this, patch-delete the attribute
# and reload all the fence modules.
fence_submodules = [
module for module in sys.modules.keys() if module.startswith(module_name)
module for module in list(sys.modules.keys()) if module.startswith(module_name)
]
for module in fence_submodules:
if sys.modules[module]:
# SQLAlchemy gets upset when a table is loaded twice, so ignore
# that.
try:
# NOTE: in python3 this should become ``importlib.reload``
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# NOTE: in python3 this should become ``importlib.reload``

import urlparse
import urllib
import urllib.request, urllib.parse, urllib.error
from fence.resources.storage.cdis_jwt import create_session_token
Copy link
Contributor

Choose a reason for hiding this comment

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

is this needed? it doesn't look like it was there before

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's duplicated :o looks like the imports have been messed up during a rebase to master, thanks will fix

@@ -101,6 +101,7 @@ At the moment, supported IDPs include:
- InCommon
- eduGAIN

Note: the Shibboleth dockerfile image is at https://quay.io/repository/cdis/fence-shib and is NOT compatible with python 3/the latest fence.
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a specific reason for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i didn't update the shibboleth dockerfile to work with python 3 code for now, I discussed with Rudy and he said master fence probably won't be deployed to the commons that's using this dockerfile

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.

4 participants