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

ExecProvider bug when accessing stderr before None type check #2136

Closed
jonoden opened this issue Oct 24, 2023 · 7 comments · May be fixed by #2336
Closed

ExecProvider bug when accessing stderr before None type check #2136

jonoden opened this issue Oct 24, 2023 · 7 comments · May be fixed by #2336
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@jonoden
Copy link

jonoden commented Oct 24, 2023

What happened (please include outputs or screenshots):
When authentication method is exec and the provider is aws, the command can sometimes return non-zero status without stderr. Below is an example of the output ot config.load_kube_config() in this case:

The SSO session associated with this profile has expired or is otherwise invalid. To refresh this SSO session run aws sso login with the corresponding profile.
ERROR:root:'NoneType' object has no attribute 'strip'

in this case the command returns a 255 return code with stderr: None. This causes ConfigException to not be raised.

Proposing a change to kubernetes/base/config/exec_provider.py as such:

--- a/kubernetes/base/config/exec_provider.py
+++ b/kubernetes/base/config/exec_provider.py
@@ -80,8 +80,8 @@ class ExecProvider(object):
         exit_code = process.wait()
         if exit_code != 0:
             msg = 'exec: process returned %d' % exit_code
-            stderr = stderr.strip()
             if stderr:
+                stderr = stderr.strip()
                 msg += '. %s' % stderr
             raise ConfigException(msg)
         try:

What you expected to happen:

ConfigException should be raised if exec fails

How to reproduce it (as minimally and precisely as possible):
Use exec auth configuration with non-valid SSO creds.

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): v1.28.3
  • OS (e.g., MacOS 10.13.6): macOS 13.6
  • Python version (python --version): 3.11.6
  • Python client version (pip list | grep kubernetes): 28.1.0
@jonoden jonoden added the kind/bug Categorizes issue or PR as related to a bug. label Oct 24, 2023
@jonoden jonoden changed the title base/config/exec_provider bug when accessingstderr before None type check base/config/exec_provider bug when accessing stderr before None type check Oct 24, 2023
@jonoden jonoden changed the title base/config/exec_provider bug when accessing stderr before None type check ExecProvider bug when accessing stderr before None type check Oct 24, 2023
@roycaihw
Copy link
Member

roycaihw commented Nov 6, 2023

@jonoden Would you like to send a PR? Thanks

@roycaihw
Copy link
Member

roycaihw commented Nov 6, 2023

/assign @jonoden

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 4, 2024
@darshanip
Copy link

@roycaihw, I'm happy to send a PR.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 19, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

@k8s-ci-robot k8s-ci-robot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2024
@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

calebAtIspot added a commit to calebAtIspot/python that referenced this issue Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants