@@ -193,7 +193,7 @@ def do_update_stack():
193193 apicall = action_api_uri_dic [args .action ]
194194 uri = api_url + apicall
195195 r = requests .post (uri , headers = api_headers )
196- r_json = json .loads (r .txt )
196+ r_json = json .loads (r .text )
197197 newVersionId = r_json ["entityId" ]
198198
199199 args .action = "get_application_packages"
@@ -211,29 +211,32 @@ def do_update_stack():
211211 api_headers = {'Content-Type' : 'application/json' , 'charset' : 'UTF-8' ,
212212 'X-Oracle-UserId' : creds ['user_email' ], 'Authorization' : f"Bearer { access_token } " }
213213 r = requests .patch (uri , headers = api_headers )
214- r_json = json .loads (r .txt )
214+ r_json = json .loads (r .text )
215215 newPackageVersionId = r_json ["entityId" ]
216216
217217 args .action = "get_application_package"
218218 args .id2 = newPackageVersionId
219219 bind_action_dic ()
220220 apicall = action_api_uri_dic [args .action ]
221221 uri = api_url + apicall
222- body = "{'version': '" + args .version_string + "'}"
222+ api_headers = {'Content-Type' : 'multipart/form-data' , 'boundary' : '----WebKitFormBoundary7MA4YWxkTrZu0gW' , 'charset' : 'UTF-8' ,
223+ 'X-Oracle-UserId' : creds ['user_email' ], 'Authorization' : f"Bearer { access_token } " }
224+ body = '{"version": "' + args .version_string + '", "description": "Description of package", "tncId": "", "serviceType": "OCIOrchestration"}'
223225 body_json = json .loads (body )
224- r = requests .put (uri , headers = api_headers , json = body_json )
225- r_json = json .loads (r .txt )
226+ #r = requests.put(uri, headers=api_headers, json=body_json)
227+ r = requests .put (uri , headers = api_headers , data = body )
228+ r_json = json .loads (r .text )
226229 message = r_json ["message" ]
227230
228231 args .action = "get_artifacts"
229232 bind_action_dic ()
230233 apicall = action_api_uri_dic [args .action ]
231234 uri = api_url + apicall
232- body = "{' name': 'TF_" + args .version_string + "', ' artifactType:': ' TERRAFORM_TEMPLATE'}"
235+ body = '{" name": "TF_' + args .version_string + '", " artifactType:": " TERRAFORM_TEMPLATE"}'
233236 body_json = json .loads (body )
234- files = {'upload_file' : open ('terraform.gz ' , 'rb' )}
237+ files = {'upload_file' : open ('tf.zip ' , 'rb' )}
235238 r = requests .post (uri , headers = api_headers , json = body_json , files = files )
236- r_json = json .loads (r .txt )
239+ r_json = json .loads (r .text )
237240 artifactId = r_json ["entityId" ]
238241
239242 with open ("newArtifact" , "r" ) as file_in :
@@ -248,7 +251,7 @@ def do_update_stack():
248251 apicall = action_api_uri_dic [args .action ]
249252 uri = api_url + apicall
250253 r = requests .put (uri , headers = api_headers , json = body_json )
251- r_json = json .loads (r .txt )
254+ r_json = json .loads (r .text )
252255 message = r_json ["message" ]
253256
254257
0 commit comments