@@ -11,9 +11,9 @@ def retrieve_kubeconfig(self, serverURL, kubeconfigFor, kubeconfig):
1111
1212 kubeplusNS = self .get_kubeplus_namespace (kubeconfig )
1313 if kubeconfigFor == 'provider' :
14- cmd = "kubectl get configmaps kubeplus-saas-provider -n " + kubeplusNS + " -o jsonpath=\" {.data.kubeplus-saas-provider\.json}\" "
14+ cmd = "kubectl get configmaps kubeplus-saas-provider -n " + kubeplusNS + r " -o jsonpath=\"{.data.kubeplus-saas-provider\.json}\""
1515 if kubeconfigFor == 'consumer' :
16- cmd = "kubectl get configmaps kubeplus-saas-consumer-kubeconfig -n " + kubeplusNS + " -o jsonpath=\" {.data.kubeplus-saas-consumer\.json}\" "
16+ cmd = "kubectl get configmaps kubeplus-saas-consumer-kubeconfig -n " + kubeplusNS + r " -o jsonpath=\"{.data.kubeplus-saas-consumer\.json}\""
1717
1818 #kubeconfigParts = kubeconfig.split("=")
1919 #kubeconfigPath = kubeconfigParts[1].strip()
@@ -24,19 +24,19 @@ def retrieve_kubeconfig(self, serverURL, kubeconfigFor, kubeconfig):
2424 json_output = {}
2525 try :
2626 json_output = json .loads (out )
27+ if isinstance (json_output , str ):
28+ json_output = json .loads (json_output )
2729 except Exception as e :
2830 print (e )
2931 print ("KubePlus might not be ready yet. Try again once the KubePlus Pod is running." )
30- if serverURL != '-1' :
31- #parts = serverURL.split("=")
32- #sURL = parts[1].strip()
33- #if sURL != '':
34- json_output ["clusters" ][0 ]["cluster" ]["server" ] = serverURL
35- try :
36- pkubeconfig = json .dumps (json_output )
37- print (pkubeconfig )
38- except Exception as e :
39- print (e )
32+ if isinstance (json_output , dict ):
33+ if serverURL != '-1' :
34+ json_output ["clusters" ][0 ]["cluster" ]["server" ] = serverURL
35+ try :
36+ pkubeconfig = json .dumps (json_output )
37+ print (pkubeconfig )
38+ except Exception as e :
39+ print (e )
4040
4141if __name__ == '__main__' :
4242
0 commit comments