(self, cfuri)
| 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": |
no test coverage detected