Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Quick fix for cfcreate and cf modify not working. #62

Merged
merged 1 commit into from

2 participants

godfreja Michael Ludvig
godfreja

These commands would generate a KeyError for 'Origin'. (Bug 3536626)

Update the geranted config output to use S3Origin and DNSName
instead of just Origin. Note that this has not been tested for
custom origins.

I'm not sure if this fix is good enough to be pulled, but figured it could start a discussion.

godfreja godfreja Quick fix for cfcreate and cf modify not working. These commands
would generate a KeyError for 'Origin'. (Bug 3536626)

Update the geranted config output to use S3Origin and DNSName
instead of just Origin. Note that this has not been tested for
custom origins.
e9d40a6
Michael Ludvig mludvig merged commit e9d40a6 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 21, 2012
  1. godfreja

    Quick fix for cfcreate and cf modify not working. These commands

    godfreja authored
    would generate a KeyError for 'Origin'. (Bug 3536626)
    
    Update the geranted config output to use S3Origin and DNSName
    instead of just Origin. Note that this has not been tested for
    custom origins.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 5 deletions.
  1. +6 −5 S3/CloudFront.py
11 S3/CloudFront.py
View
@@ -133,7 +133,7 @@ class DistributionConfig(object):
## </Logging>
## </DistributionConfig>
- EMPTY_CONFIG = "<DistributionConfig><Origin/><CallerReference/><Enabled>true</Enabled></DistributionConfig>"
+ EMPTY_CONFIG = "<DistributionConfig><S3Origin><DNSName/></S3Origin><CallerReference/><Enabled>true</Enabled></DistributionConfig>"
xmlns = "http://cloudfront.amazonaws.com/doc/%(api_ver)s/" % { 'api_ver' : cloudfront_api_version }
def __init__(self, xml = None, tree = None):
if xml is None:
@@ -174,7 +174,8 @@ def __str__(self):
tree.attrib['xmlns'] = DistributionConfig.xmlns
## Retain the order of the following calls!
- appendXmlTextNode("Origin", self.info['Origin'], tree)
+ s3org = appendXmlTextNode("S3Origin", '', tree)
+ appendXmlTextNode("DNSName", self.info['S3Origin']['DNSName'], s3org)
appendXmlTextNode("CallerReference", self.info['CallerReference'], tree)
for cname in self.info['CNAME']:
appendXmlTextNode("CNAME", cname.lower(), tree)
@@ -322,7 +323,7 @@ def GetList(self):
def CreateDistribution(self, uri, cnames_add = [], comment = None, logging = None, default_root_object = None):
dist_config = DistributionConfig()
dist_config.info['Enabled'] = True
- dist_config.info['Origin'] = uri.host_name()
+ dist_config.info['S3Origin']['DNSName'] = uri.host_name()
dist_config.info['CallerReference'] = str(uri)
dist_config.info['DefaultRootObject'] = default_root_object
if comment == None:
@@ -671,7 +672,7 @@ def create(args):
d = response['distribution']
dc = d.info['DistributionConfig']
output("Distribution created:")
- pretty_output("Origin", S3UriS3.httpurl_to_s3uri(dc.info['Origin']))
+ pretty_output("Origin", S3UriS3.httpurl_to_s3uri(dc.info['S3Origin']['DNSName']))
pretty_output("DistId", d.uri())
pretty_output("DomainName", d.info['DomainName'])
pretty_output("CNAMEs", ", ".join(dc.info['CNAME']))
@@ -713,7 +714,7 @@ def modify(args):
response = cf.GetDistInfo(cfuri)
d = response['distribution']
dc = d.info['DistributionConfig']
- pretty_output("Origin", S3UriS3.httpurl_to_s3uri(dc.info['Origin']))
+ pretty_output("Origin", S3UriS3.httpurl_to_s3uri(dc.info['S3Origin']['DNSName']))
pretty_output("DistId", d.uri())
pretty_output("DomainName", d.info['DomainName'])
pretty_output("Status", d.info['Status'])
Something went wrong with that request. Please try again.