From 76b99082bddf9f8e24063e5d2553b144e13d5984 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Wed, 8 Feb 2017 09:42:08 -0500 Subject: Adding code to copy kubeconfig before running oc commands. --- roles/lib_openshift/library/oadm_manage_node.py | 13 ++++++++++++- roles/lib_openshift/library/oc_edit.py | 13 ++++++++++++- roles/lib_openshift/library/oc_label.py | 13 ++++++++++++- roles/lib_openshift/library/oc_obj.py | 13 ++++++++++++- roles/lib_openshift/library/oc_route.py | 13 ++++++++++++- roles/lib_openshift/library/oc_scale.py | 13 ++++++++++++- roles/lib_openshift/library/oc_secret.py | 13 ++++++++++++- roles/lib_openshift/library/oc_service.py | 13 ++++++++++++- roles/lib_openshift/library/oc_serviceaccount.py | 13 ++++++++++++- roles/lib_openshift/library/oc_serviceaccount_secret.py | 13 ++++++++++++- roles/lib_openshift/library/oc_version.py | 13 ++++++++++++- 11 files changed, 132 insertions(+), 11 deletions(-) (limited to 'roles/lib_openshift/library') diff --git a/roles/lib_openshift/library/oadm_manage_node.py b/roles/lib_openshift/library/oadm_manage_node.py index 94fe5b019..7a24f7c44 100644 --- a/roles/lib_openshift/library/oadm_manage_node.py +++ b/roles/lib_openshift/library/oadm_manage_node.py @@ -731,7 +731,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. @@ -1016,6 +1016,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' diff --git a/roles/lib_openshift/library/oc_edit.py b/roles/lib_openshift/library/oc_edit.py index c934d55b9..edd96ad3d 100644 --- a/roles/lib_openshift/library/oc_edit.py +++ b/roles/lib_openshift/library/oc_edit.py @@ -759,7 +759,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. @@ -1044,6 +1044,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' diff --git a/roles/lib_openshift/library/oc_label.py b/roles/lib_openshift/library/oc_label.py index 5a6f06b89..24bf3c82e 100644 --- a/roles/lib_openshift/library/oc_label.py +++ b/roles/lib_openshift/library/oc_label.py @@ -735,7 +735,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. @@ -1020,6 +1020,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' diff --git a/roles/lib_openshift/library/oc_obj.py b/roles/lib_openshift/library/oc_obj.py index 6c4bd1a2d..c2976ba47 100644 --- a/roles/lib_openshift/library/oc_obj.py +++ b/roles/lib_openshift/library/oc_obj.py @@ -738,7 +738,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. @@ -1023,6 +1023,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' diff --git a/roles/lib_openshift/library/oc_route.py b/roles/lib_openshift/library/oc_route.py index 6ee34bafb..5a4a09e7b 100644 --- a/roles/lib_openshift/library/oc_route.py +++ b/roles/lib_openshift/library/oc_route.py @@ -763,7 +763,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. @@ -1048,6 +1048,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' diff --git a/roles/lib_openshift/library/oc_scale.py b/roles/lib_openshift/library/oc_scale.py index 63d818c66..728c11cb5 100644 --- a/roles/lib_openshift/library/oc_scale.py +++ b/roles/lib_openshift/library/oc_scale.py @@ -713,7 +713,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. @@ -998,6 +998,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' diff --git a/roles/lib_openshift/library/oc_secret.py b/roles/lib_openshift/library/oc_secret.py index 978c5741d..c1c621162 100644 --- a/roles/lib_openshift/library/oc_secret.py +++ b/roles/lib_openshift/library/oc_secret.py @@ -759,7 +759,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. @@ -1044,6 +1044,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' diff --git a/roles/lib_openshift/library/oc_service.py b/roles/lib_openshift/library/oc_service.py index edaa97af5..a9adff0b1 100644 --- a/roles/lib_openshift/library/oc_service.py +++ b/roles/lib_openshift/library/oc_service.py @@ -765,7 +765,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. @@ -1050,6 +1050,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' diff --git a/roles/lib_openshift/library/oc_serviceaccount.py b/roles/lib_openshift/library/oc_serviceaccount.py index 7b34f298b..773a3f176 100644 --- a/roles/lib_openshift/library/oc_serviceaccount.py +++ b/roles/lib_openshift/library/oc_serviceaccount.py @@ -711,7 +711,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. @@ -996,6 +996,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' diff --git a/roles/lib_openshift/library/oc_serviceaccount_secret.py b/roles/lib_openshift/library/oc_serviceaccount_secret.py index 9a2bd81cd..fdaf6d93b 100644 --- a/roles/lib_openshift/library/oc_serviceaccount_secret.py +++ b/roles/lib_openshift/library/oc_serviceaccount_secret.py @@ -711,7 +711,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. @@ -996,6 +996,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' 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. @@ -968,6 +968,17 @@ class Utils(object): atexit.register(Utils.cleanup, [tmp]) 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 ''' -- cgit v1.2.3 From 04ea66c4ab6cd1e5daa217526d7c9591aa164f10 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Wed, 8 Feb 2017 10:23:48 -0500 Subject: Added temporary kubeconfig file. Fixed tests to coincide with tmpfile. --- roles/lib_openshift/library/oadm_manage_node.py | 4 ++-- roles/lib_openshift/library/oc_edit.py | 4 ++-- roles/lib_openshift/library/oc_label.py | 4 ++-- roles/lib_openshift/library/oc_obj.py | 4 ++-- roles/lib_openshift/library/oc_route.py | 4 ++-- roles/lib_openshift/library/oc_scale.py | 4 ++-- roles/lib_openshift/library/oc_secret.py | 4 ++-- roles/lib_openshift/library/oc_service.py | 4 ++-- roles/lib_openshift/library/oc_serviceaccount.py | 4 ++-- roles/lib_openshift/library/oc_serviceaccount_secret.py | 4 ++-- roles/lib_openshift/library/oc_version.py | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) (limited to 'roles/lib_openshift/library') diff --git a/roles/lib_openshift/library/oadm_manage_node.py b/roles/lib_openshift/library/oadm_manage_node.py index 7a24f7c44..8e217ac28 100644 --- a/roles/lib_openshift/library/oadm_manage_node.py +++ b/roles/lib_openshift/library/oadm_manage_node.py @@ -1019,7 +1019,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1028,7 +1028,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_edit.py b/roles/lib_openshift/library/oc_edit.py index edd96ad3d..11b87a015 100644 --- a/roles/lib_openshift/library/oc_edit.py +++ b/roles/lib_openshift/library/oc_edit.py @@ -1047,7 +1047,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1056,7 +1056,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_label.py b/roles/lib_openshift/library/oc_label.py index 24bf3c82e..f67eb2552 100644 --- a/roles/lib_openshift/library/oc_label.py +++ b/roles/lib_openshift/library/oc_label.py @@ -1023,7 +1023,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1032,7 +1032,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_obj.py b/roles/lib_openshift/library/oc_obj.py index c2976ba47..e4b8ac26c 100644 --- a/roles/lib_openshift/library/oc_obj.py +++ b/roles/lib_openshift/library/oc_obj.py @@ -1026,7 +1026,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1035,7 +1035,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_route.py b/roles/lib_openshift/library/oc_route.py index 5a4a09e7b..7c4fa1fbd 100644 --- a/roles/lib_openshift/library/oc_route.py +++ b/roles/lib_openshift/library/oc_route.py @@ -1051,7 +1051,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1060,7 +1060,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_scale.py b/roles/lib_openshift/library/oc_scale.py index 728c11cb5..48a629b5e 100644 --- a/roles/lib_openshift/library/oc_scale.py +++ b/roles/lib_openshift/library/oc_scale.py @@ -1001,7 +1001,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1010,7 +1010,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_secret.py b/roles/lib_openshift/library/oc_secret.py index c1c621162..526474f17 100644 --- a/roles/lib_openshift/library/oc_secret.py +++ b/roles/lib_openshift/library/oc_secret.py @@ -1047,7 +1047,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1056,7 +1056,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_service.py b/roles/lib_openshift/library/oc_service.py index a9adff0b1..a9baef765 100644 --- a/roles/lib_openshift/library/oc_service.py +++ b/roles/lib_openshift/library/oc_service.py @@ -1053,7 +1053,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1062,7 +1062,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_serviceaccount.py b/roles/lib_openshift/library/oc_serviceaccount.py index 773a3f176..cd0847963 100644 --- a/roles/lib_openshift/library/oc_serviceaccount.py +++ b/roles/lib_openshift/library/oc_serviceaccount.py @@ -999,7 +999,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1008,7 +1008,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_serviceaccount_secret.py b/roles/lib_openshift/library/oc_serviceaccount_secret.py index fdaf6d93b..e22ccbfc2 100644 --- a/roles/lib_openshift/library/oc_serviceaccount_secret.py +++ b/roles/lib_openshift/library/oc_serviceaccount_secret.py @@ -999,7 +999,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -1008,7 +1008,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: diff --git a/roles/lib_openshift/library/oc_version.py b/roles/lib_openshift/library/oc_version.py index 7ecf61016..e44375ffa 100644 --- a/roles/lib_openshift/library/oc_version.py +++ b/roles/lib_openshift/library/oc_version.py @@ -971,7 +971,7 @@ class Utils(object): @staticmethod def create_tmpfile_copy(inc_file): '''create a temporary copy of a file''' - tmpfile = Utils.create_tmpfile() + tmpfile = Utils.create_tmpfile('lib_openshift-') Utils._write(tmpfile, open(inc_file).read()) # Cleanup the tmpfile @@ -980,7 +980,7 @@ class Utils(object): return tmpfile @staticmethod - def create_tmpfile(prefix=None): + def create_tmpfile(prefix='tmp'): ''' Generates and returns a temporary file name ''' with tempfile.NamedTemporaryFile(prefix=prefix, delete=False) as tmp: -- cgit v1.2.3