Skip to content

Error parsing KUBECONFIG url #599

Description

@cpwr

I have KUBECONFIG path like that:

/home/username/.kube/config:/home/username/Downloads/config-azure-dev.txt

The way config file name parsed is not correct for such cases:
config_file = os.path.expanduser(KUBE_CONFIG_DEFAULT_LOCATION)
and it causes an error:

$ python test.py
Traceback (most recent call last):
File "test.py", line 4, in
config.load_kube_config()
File "/home/username/workspace/kubernetes/env/lib/python3.5/site-packages/kubernetes/config/kube_config.py", line 470, in load_kube_config
config_persister=config_persister)
File "/home/username/workspace/kubernetes/env/lib/python3.5/site-packages/kubernetes/config/kube_config.py", line 427, in _get_kube_config_loader_for_yaml_file
with open(filename) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/username/.kube/config:/home/username/Downloads/config-azure-dev.txt'

Maybe user should get a warning instead?

if len(KUBE_CONFIG_DEFAULT_LOCATION.split(':')) > 1:
    raise ValueError('Your setup has more than one path. Please, provide the config file location '
                     'explicitly')

or use the default path like so:
config_file = os.path.expanduser(KUBE_CONFIG_DEFAULT_LOCATION.split(':')[0])

Activity

  1. tomplus commented on Oct 19, 2018

    @tomplus
    Member

    This feature has to be added to python-base repo, ref issue: kubernetes-client/python-base#62

  2. ignertic commented on Oct 29, 2018

    @ignertic

    Check out #96

  3. fejta-bot commented on Apr 26, 2019

    @fejta-bot

    Issues go stale after 90d of inactivity.
    Mark the issue as fresh with /remove-lifecycle stale.
    Stale issues rot after an additional 30d of inactivity and eventually close.

    If this issue is safe to close now please do so with /close.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
    /lifecycle stale

  4. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Apr 26, 2019
  5. fejta-bot commented on May 26, 2019

    @fejta-bot

    Stale issues rot after 30d of inactivity.
    Mark the issue as fresh with /remove-lifecycle rotten.
    Rotten issues close after an additional 30d of inactivity.

    If this issue is safe to close now please do so with /close.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
    /lifecycle rotten

  6. added
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on May 26, 2019
  7. ignertic commented on May 27, 2019

    @ignertic

    /remove-lifecycle rotten

  8. removed
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    on May 27, 2019
  9. yliaog commented on Aug 13, 2019

    @yliaog
    Contributor

    this is fixed by kubernetes-client/python-base#94
    /close

  10. k8s-ci-robot commented on Aug 13, 2019

    @k8s-ci-robot
    Contributor

    @yliaog: Closing this issue.

    Details

    In response to this:

    this is fixed by kubernetes-client/python-base#94
    /close

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions