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

fix: cli fails when listing providers [DET-10127] #8903

Merged
merged 2 commits into from
Feb 29, 2024
Merged

Conversation

eecsliu
Copy link
Contributor

@eecsliu eecsliu commented Feb 27, 2024

Description

In EE, the CLI returns an error when listing auth providers but auth is not being used. This is because we are always expecting a list, but we receive null in this case, hence the error 'NoneType' has no len(). This fix updates the CLI to catch null values and not fail the length check.

Test Plan

Run a devcluster on EE with the oidc config field populated with something like:

      oidc:
          authentication_claim: email
          auto_provision_users: false
          client_id: ''
          client_secret: ''
          enabled: false
          idp_recipient_url: ''
          idp_sso_url: ''
          provider: ''
          scim_authentication_attribute: userName

Run the cli command det auth list-providers - the CLI should return No SSO providers found.

Commentary (optional)

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

Ticket

@eecsliu eecsliu requested a review from a team as a code owner February 27, 2024 00:24
@eecsliu eecsliu requested a review from caehd10 February 27, 2024 00:24
@cla-bot cla-bot bot added the cla-signed label Feb 27, 2024
Copy link

netlify bot commented Feb 27, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit e309fd3
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/65df70f367a53d0007cdc4af
😎 Deploy Preview https://deploy-preview-8903--determined-ui.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -121,7 +121,7 @@ def list_providers(args: Namespace) -> None:
except KeyError:
raise EnterpriseOnlyError("No SSO providers data")

if len(sso_providers) == 0:
if not sso_providers or len(sso_providers) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

if not sso_providers:

should be sufficient. bool(<empty_list>) evaluates to False.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed! thanks

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 47.52%. Comparing base (a8ac657) to head (e309fd3).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8903      +/-   ##
==========================================
- Coverage   47.53%   47.52%   -0.01%     
==========================================
  Files        1066     1066              
  Lines      170248   170248              
  Branches     2235     2237       +2     
==========================================
- Hits        80919    80915       -4     
- Misses      89171    89175       +4     
  Partials      158      158              
Flag Coverage Δ
backend 43.34% <ø> (-0.01%) ⬇️
harness 63.77% <0.00%> (-0.01%) ⬇️
web 42.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
harness/determined/cli/sso.py 19.78% <0.00%> (ø)

... and 4 files with indirect coverage changes

Copy link
Contributor

@wes-turner wes-turner left a comment

Choose a reason for hiding this comment

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

LGTM!

@eecsliu eecsliu merged commit 63adae5 into main Feb 29, 2024
72 of 86 checks passed
@eecsliu eecsliu deleted the eliu-cli-auth-bug branch February 29, 2024 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants