MCPcopy Create free account
hub / github.com/s3tools/s3cmd / DeleteDistribution

Method DeleteDistribution

S3/CloudFront.py:409–434  ·  view source on GitHub ↗
(self, cfuri)

Source from the content-addressed store, hash-verified

407 return response
408
409 def DeleteDistribution(self, cfuri):
410 if cfuri.type != "cf":
411 raise ValueError("Expected CFUri instead of: %s" % cfuri)
412 # Get current dist status (enabled/disabled) and Etag
413 info("Checking current status of %s" % cfuri)
414 response = self.GetDistConfig(cfuri)
415 if response['dist_config'].info['Enabled']:
416 info("Distribution is ENABLED. Disabling first.")
417 response['dist_config'].info['Enabled'] = False
418 response = self.SetDistConfig(cfuri, response['dist_config'],
419 response['headers']['etag'])
420 warning("Waiting for Distribution to become disabled.")
421 warning("This may take several minutes, please wait.")
422 while True:
423 response = self.GetDistInfo(cfuri)
424 d = response['distribution']
425 if d.info['Status'] == "Deployed" and d.info['Enabled'] == False:
426 info("Distribution is now disabled")
427 break
428 warning("Still waiting...")
429 time.sleep(10)
430 headers = SortedDict(ignore_case = True)
431 headers['if-match'] = response['headers']['etag']
432 response = self.send_request("DeleteDist", dist_id = cfuri.dist_id(),
433 headers = headers)
434 return response
435
436 def GetDistInfo(self, cfuri):
437 if cfuri.type != "cf":

Callers 1

deleteMethod · 0.95

Calls 6

GetDistConfigMethod · 0.95
SetDistConfigMethod · 0.95
GetDistInfoMethod · 0.95
send_requestMethod · 0.95
SortedDictClass · 0.90
dist_idMethod · 0.80

Tested by

no test coverage detected