@@ -90,6 +90,8 @@ def createResource(self, jsonStr, **kwargs) -> dict:
9090 jsonObj = jsonStr
9191 if type (jsonObj ) is str :
9292 jsonObj = json .loads (jsonObj )
93+ elif type (jsonObj ) is dict :
94+ jsonStr = dictToJsonString (jsonStr )
9395
9496 kind = self .getRealKind (str (jsonObj ["kind" ]), str (jsonObj ["apiVersion" ]))
9597
@@ -106,6 +108,8 @@ def updateResource(self, jsonStr:Union[str,dict], **kwargs) -> dict:
106108 jsonObj = jsonStr
107109 if type (jsonObj ) is str :
108110 jsonObj = json .loads (jsonObj )
111+ elif type (jsonObj ) is dict :
112+ jsonStr = dictToJsonString (jsonStr )
109113
110114 kind = self .getRealKind (str (jsonObj ["kind" ]), str (jsonObj ["apiVersion" ]))
111115
@@ -303,6 +307,8 @@ def updateResourceStatus(self, jsonStr, **kwargs) -> dict:
303307 jsonObj = jsonStr
304308 if type (jsonObj ) is str :
305309 jsonObj = json .loads (jsonObj )
310+ elif type (jsonObj ) is dict :
311+ jsonStr = dictToJsonString (jsonStr )
306312
307313 kind = self .getRealKind (jsonObj ["kind" ], jsonObj ["apiVersion" ])
308314 namespace = ""
@@ -314,7 +320,7 @@ def updateResourceStatus(self, jsonStr, **kwargs) -> dict:
314320 url += self .analyzer .FullKindToNameDict [kind ] + "/" + jsonObj ["metadata" ]["name" ]
315321 url += "/status"
316322
317- return createRequest (url = url , token = self .token , method = "PUT" , body = jsonObj , keep_json = False ,config = self .config , ** kwargs )
323+ return createRequest (url = url , token = self .token , method = "PUT" , body = jsonStr , keep_json = False ,config = self .config , ** kwargs )
318324
319325 def getResourceStatus (self ,kind , name , namespace = "" , ** kwargs )-> dict :
320326 fullKind = self .analyzer .checkAndReturnRealKind (kind )
0 commit comments