Update the geranted config output to use S3Origin and DNSName
instead of just Origin. Note that this has not been tested for
custom origins.
... | ... |
@@ -133,7 +133,7 @@ class DistributionConfig(object): |
133 | 133 |
## </Logging> |
134 | 134 |
## </DistributionConfig> |
135 | 135 |
|
136 |
- EMPTY_CONFIG = "<DistributionConfig><Origin/><CallerReference/><Enabled>true</Enabled></DistributionConfig>" |
|
136 |
+ EMPTY_CONFIG = "<DistributionConfig><S3Origin><DNSName/></S3Origin><CallerReference/><Enabled>true</Enabled></DistributionConfig>" |
|
137 | 137 |
xmlns = "http://cloudfront.amazonaws.com/doc/%(api_ver)s/" % { 'api_ver' : cloudfront_api_version } |
138 | 138 |
def __init__(self, xml = None, tree = None): |
139 | 139 |
if xml is None: |
... | ... |
@@ -174,7 +174,8 @@ class DistributionConfig(object): |
174 | 174 |
tree.attrib['xmlns'] = DistributionConfig.xmlns |
175 | 175 |
|
176 | 176 |
## Retain the order of the following calls! |
177 |
- appendXmlTextNode("Origin", self.info['Origin'], tree) |
|
177 |
+ s3org = appendXmlTextNode("S3Origin", '', tree) |
|
178 |
+ appendXmlTextNode("DNSName", self.info['S3Origin']['DNSName'], s3org) |
|
178 | 179 |
appendXmlTextNode("CallerReference", self.info['CallerReference'], tree) |
179 | 180 |
for cname in self.info['CNAME']: |
180 | 181 |
appendXmlTextNode("CNAME", cname.lower(), tree) |
... | ... |
@@ -322,7 +323,7 @@ class CloudFront(object): |
322 | 322 |
def CreateDistribution(self, uri, cnames_add = [], comment = None, logging = None, default_root_object = None): |
323 | 323 |
dist_config = DistributionConfig() |
324 | 324 |
dist_config.info['Enabled'] = True |
325 |
- dist_config.info['Origin'] = uri.host_name() |
|
325 |
+ dist_config.info['S3Origin']['DNSName'] = uri.host_name() |
|
326 | 326 |
dist_config.info['CallerReference'] = str(uri) |
327 | 327 |
dist_config.info['DefaultRootObject'] = default_root_object |
328 | 328 |
if comment == None: |
... | ... |
@@ -671,7 +672,7 @@ class Cmd(object): |
671 | 671 |
d = response['distribution'] |
672 | 672 |
dc = d.info['DistributionConfig'] |
673 | 673 |
output("Distribution created:") |
674 |
- pretty_output("Origin", S3UriS3.httpurl_to_s3uri(dc.info['Origin'])) |
|
674 |
+ pretty_output("Origin", S3UriS3.httpurl_to_s3uri(dc.info['S3Origin']['DNSName'])) |
|
675 | 675 |
pretty_output("DistId", d.uri()) |
676 | 676 |
pretty_output("DomainName", d.info['DomainName']) |
677 | 677 |
pretty_output("CNAMEs", ", ".join(dc.info['CNAME'])) |
... | ... |
@@ -713,7 +714,7 @@ class Cmd(object): |
713 | 713 |
response = cf.GetDistInfo(cfuri) |
714 | 714 |
d = response['distribution'] |
715 | 715 |
dc = d.info['DistributionConfig'] |
716 |
- pretty_output("Origin", S3UriS3.httpurl_to_s3uri(dc.info['Origin'])) |
|
716 |
+ pretty_output("Origin", S3UriS3.httpurl_to_s3uri(dc.info['S3Origin']['DNSName'])) |
|
717 | 717 |
pretty_output("DistId", d.uri()) |
718 | 718 |
pretty_output("DomainName", d.info['DomainName']) |
719 | 719 |
pretty_output("Status", d.info['Status']) |