def _update_webjob_setting(self, webjob_name, site_name, json_body, webjob_service_type="triggeredwebjobs"): body = RequestBody.create(self._json_media_type, json_body) request = self._kudu_request( site_name, "%s/%s/settings" % (webjob_service_type, webjob_name)).put(body) self._execute_http_request(request)
def _deploy_webjob(self, webjob_name, site_name, executable_file_name, zip_file_path, webjob_service_type="triggeredwebjobs"): body = RequestBody.create(self._zip_media_type, File(zip_file_path)) request = self._kudu_request(site_name, "%s/%s" % (webjob_service_type, webjob_name)).put(body) \ .addHeader("Content-Disposition", "attachement; filename=%s" % executable_file_name) self._execute_http_request(request)
def _retry_stop_start_webjob(self, site_name, service_uri): retry = 0 while retry < 12: body = RequestBody.create(self._json_media_type, "") request = self._kudu_request(site_name, service_uri).post(body) response = self._execute_http_request_return_response(request) reply_body = str(response.body().string()) response.body().close() if response.code() == 404 and reply_body.startswith('"No route registered for'): retry += 1 time.sleep(5) else: self._check_return_code(response, reply_body) return True raise Exception("rc=404, msg='No route registered for 'api/%s''" % service_uri)
def _retry_stop_start_webjob(self, site_name, service_uri): retry = 0 while retry < 12: body = RequestBody.create(self._json_media_type, "") request = self._kudu_request(site_name, service_uri).post(body) response = self._execute_http_request_return_response(request) reply_body = str(response.body().string()) response.body().close() if response.code() == 404 and reply_body.startswith( '"No route registered for'): retry += 1 time.sleep(5) else: self._check_return_code(response, reply_body) return True raise Exception("rc=404, msg='No route registered for 'api/%s''" % service_uri)
def _update_webjob_setting(self, webjob_name, site_name, json_body, webjob_service_type="triggeredwebjobs"): body = RequestBody.create(self._json_media_type, json_body) request = self._kudu_request(site_name, "%s/%s/settings" % (webjob_service_type, webjob_name)).put(body) self._execute_http_request(request)
def _deploy_webjob(self, webjob_name, site_name, executable_file_name, zip_file_path, webjob_service_type="triggeredwebjobs" ): body = RequestBody.create(self._zip_media_type, File(zip_file_path)) request = self._kudu_request(site_name, "%s/%s" % (webjob_service_type, webjob_name)).put(body) \ .addHeader("Content-Disposition", "attachement; filename=%s" % executable_file_name) self._execute_http_request(request)
def upload_website(self, site_name, zip_file_path): body = RequestBody.create(self._zip_media_type, File(zip_file_path)) request = self._kudu_request(site_name, "zip/site/wwwroot").put(body) self._execute_http_request(request)