8000 Move ConfigException out of incluster_config and in it's own file · mbohlool/client-python@66e4f5f · GitHub
[go: up one dir, main page]

Skip to content

Commit 66e4f5f

Browse files
committed
Move ConfigException out of incluster_config and in it's own file
1 parent 812125f commit 66e4f5f

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

kubernetes/config/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from .kube_config import load_kube_config
15+
from .config_exception import ConfigException
1616
from .incluster_config import load_incluster_config
17-
from .incluster_config import ConfigException
17+
from .kube_config import load_kube_config

kubernetes/config/config_exception.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2016 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
class ConfigException(Exception):
17+
pass

kubernetes/config/incluster_config.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
from kubernetes.client import configuration
1818

19+
from .config_exception import ConfigException
20+
1921
_SERVICE_HOST_ENV_NAME = "KUBERNETES_SERVICE_HOST"
2022
_SERVICE_PORT_ENV_NAME = "KUBERNETES_SERVICE_PORT"
2123
_SERVICE_TOKEN_FILENAME = "/var/run/secrets/kubernetes.io/serviceaccount/token"
@@ -31,10 +33,6 @@ def _join_host_port(host, port):
3133
return template % (host, port)
3234

3335

34-
class ConfigException(Exception):
35-
pass
36-
37-
3836
class InClusterConfigLoader(object):
3937

4038
def __init__(self, host_env_name, port_env_name, token_filename,

kubernetes/config/incluster_config_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
import tempfile
1717
import unittest
1818

19-
from kubernetes.client import configuration
20-
19+
from .config_exception import ConfigException
2120
from .incluster_config import (_SERVICE_HOST_ENV_NAME, _SERVICE_PORT_ENV_NAME,
22-
ConfigException, InClusterConfigLoader)
21+
InClusterConfigLoader)
2322

2423
_TEST_TOKEN = "temp_token"
2524
_TEST_HOST = "127.0.0.1"

0 commit comments

Comments
 (0)
0