summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/library/oc_version.py
diff options
context:
space:
mode:
Diffstat (limited to 'roles/lib_openshift/library/oc_version.py')
-rw-r--r--roles/lib_openshift/library/oc_version.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/roles/lib_openshift/library/oc_version.py b/roles/lib_openshift/library/oc_version.py
index b3c4edd98..7ecf61016 100644
--- a/roles/lib_openshift/library/oc_version.py
+++ b/roles/lib_openshift/library/oc_version.py
@@ -683,7 +683,7 @@ class OpenShiftCLI(object):
''' Constructor for OpenshiftCLI '''
self.namespace = namespace
self.verbose = verbose
- self.kubeconfig = kubeconfig
+ self.kubeconfig = Utils.create_tmpfile_copy(kubeconfig)
self.all_namespaces = all_namespaces
# Pylint allows only 5 arguments to be passed.
@@ -969,6 +969,17 @@ class Utils(object):
return tmp
@staticmethod
+ def create_tmpfile_copy(inc_file):
+ '''create a temporary copy of a file'''
+ tmpfile = Utils.create_tmpfile()
+ Utils._write(tmpfile, open(inc_file).read())
+
+ # Cleanup the tmpfile
+ atexit.register(Utils.cleanup, [tmpfile])
+
+ return tmpfile
+
+ @staticmethod
def create_tmpfile(prefix=None):
''' Generates and returns a temporary file name '''