Skip to content

Commit 738dcde

Browse files
authored
Merge pull request #51 from SEJeff/patch-1
Make the README example code more portable
2 parents ff9295b + 699d71c commit 738dcde

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import os
3131
from kubernetes import client, config
3232

3333
# Configs can be set in Configuration class directly or using helper utility
34-
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
34+
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
3535

3636
v1=client.CoreV1Api()
3737
print("Listing pods with their IPs:")
@@ -48,7 +48,7 @@ import os
4848
from kubernetes import client, config, watch
4949

5050
# Configs can be set in Configuration class directly or using helper utility
51-
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
51+
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
5252

5353
v1 = client.CoreV1Api()
5454
count = 10

examples/example1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
def main():
2121
# Configs can be set in Configuration class directly or using helper
2222
# utility
23-
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
23+
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
2424

2525
v1 = client.CoreV1Api()
2626
print("Listing pods with their IPs:")

examples/example2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
def main():
2121
# Configs can be set in Configuration class directly or using helper
2222
# utility
23-
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
23+
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
2424

2525
v1 = client.CoreV1Api()
2626
count = 10

examples/example3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
def main():
2121
# Configs can be set in Configuration class directly or using helper
2222
# utility
23-
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
23+
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
2424

2525
print("Supported APIs (* is preferred version):")
2626
print("%-20s %s" %

0 commit comments

Comments
 (0)