git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@417 830e0280-6d2a-0410-9c65-932aecc39d9d
Michal Ludvig authored on 2010/06/12 22:13:21... | ... |
@@ -1,5 +1,10 @@ |
1 | 1 |
2010-06-13 Michal Ludvig <mludvig@logix.net.nz> |
2 | 2 |
|
3 |
+ * s3cmd, S3/CloudFront.py: Both [accesslog] and [cfmodify] |
|
4 |
+ access logging can now be disabled with --no-access-logging |
|
5 |
+ |
|
6 |
+2010-06-13 Michal Ludvig <mludvig@logix.net.nz> |
|
7 |
+ |
|
3 | 8 |
* S3/CloudFront.py: Allow s3:// URI as well as cf:// URI |
4 | 9 |
for most CloudFront-related commands. |
5 | 10 |
|
... | ... |
@@ -213,7 +213,7 @@ class CloudFront(object): |
213 | 213 |
for cname in cnames_add: |
214 | 214 |
if dist_config.info['CNAME'].count(cname) == 0: |
215 | 215 |
dist_config.info['CNAME'].append(cname) |
216 |
- if logging != None: |
|
216 |
+ if logging: |
|
217 | 217 |
dist_config.info['Logging'] = S3UriS3(logging) |
218 | 218 |
request_body = str(dist_config) |
219 | 219 |
debug("CreateDistribution(): request_body: %s" % request_body) |
... | ... |
@@ -240,7 +240,10 @@ class CloudFront(object): |
240 | 240 |
while dc.info['CNAME'].count(cname) > 0: |
241 | 241 |
dc.info['CNAME'].remove(cname) |
242 | 242 |
if logging != None: |
243 |
- dc.info['Logging'] = S3UriS3(logging) |
|
243 |
+ if logging == False: |
|
244 |
+ dc.info['Logging'] = False |
|
245 |
+ else: |
|
246 |
+ dc.info['Logging'] = S3UriS3(logging) |
|
244 | 247 |
response = self.SetDistConfig(cfuri, dc, response['headers']['etag']) |
245 | 248 |
return response |
246 | 249 |
|
... | ... |
@@ -1167,14 +1167,14 @@ def cmd_accesslog(args): |
1167 | 1167 |
bucket_uri = S3Uri(args.pop()) |
1168 | 1168 |
if bucket_uri.object(): |
1169 | 1169 |
raise ParameterError("Only bucket name is required for [accesslog] command") |
1170 |
- if cfg.enable == True: |
|
1170 |
+ if cfg.log_target_prefix == False: |
|
1171 |
+ accesslog, response = s3.set_accesslog(bucket_uri, enable = False) |
|
1172 |
+ elif cfg.log_target_prefix: |
|
1171 | 1173 |
log_target_prefix_uri = S3Uri(cfg.log_target_prefix) |
1172 | 1174 |
if log_target_prefix_uri.type != "s3": |
1173 | 1175 |
raise ParameterError("--log-target-prefix must be a S3 URI") |
1174 | 1176 |
accesslog, response = s3.set_accesslog(bucket_uri, enable = True, log_target_prefix_uri = log_target_prefix_uri, acl_public = cfg.acl_public) |
1175 |
- elif cfg.enable == False: |
|
1176 |
- accesslog, response = s3.set_accesslog(bucket_uri, enable = False) |
|
1177 |
- else: # cfg.enable == None |
|
1177 |
+ else: # cfg.log_target_prefix == None |
|
1178 | 1178 |
accesslog = s3.get_accesslog(bucket_uri) |
1179 | 1179 |
|
1180 | 1180 |
output(u"Access logging for: %s" % bucket_uri.uri()) |
... | ... |
@@ -1599,7 +1599,8 @@ def main(): |
1599 | 1599 |
optparser.add_option( "--bucket-location", dest="bucket_location", help="Datacentre to create bucket in. As of now the datacenters are: US (default), EU, us-west-1, and ap-southeast-1") |
1600 | 1600 |
optparser.add_option( "--reduced-redundancy", "--rr", dest="reduced_redundancy", action="store_true", help="Store object with 'Reduced redundancy'. Lower per-GB price. [put, cp, mv]") |
1601 | 1601 |
|
1602 |
- optparser.add_option( "--log-target-prefix", dest="log_target_prefix", help="Target prefix for access logs (S3 URI) (for [cfmodify] and [accesslog] commands)") |
|
1602 |
+ optparser.add_option( "--access-logging-target-prefix", dest="log_target_prefix", help="Target prefix for access logs (S3 URI) (for [cfmodify] and [accesslog] commands)") |
|
1603 |
+ optparser.add_option( "--no-access-logging", dest="log_target_prefix", action="store_false", help="Disable access logging (for [cfmodify] and [accesslog] commands)") |
|
1603 | 1604 |
|
1604 | 1605 |
optparser.add_option("-m", "--mime-type", dest="default_mime_type", type="mimetype", metavar="MIME/TYPE", help="Default MIME-type to be set for objects stored.") |
1605 | 1606 |
optparser.add_option("-M", "--guess-mime-type", dest="guess_mime_type", action="store_true", help="Guess MIME-type of files by their extension. Falls back to default MIME-Type as specified by --mime-type option") |
... | ... |
@@ -1614,8 +1615,8 @@ def main(): |
1614 | 1614 |
|
1615 | 1615 |
optparser.add_option( "--progress", dest="progress_meter", action="store_true", help="Display progress meter (default on TTY).") |
1616 | 1616 |
optparser.add_option( "--no-progress", dest="progress_meter", action="store_false", help="Don't display progress meter (default on non-TTY).") |
1617 |
- optparser.add_option( "--enable", dest="enable", action="store_true", help="Enable given CloudFront distribution (for [cfmodify] command) or access logging (for [accesslog] command)") |
|
1618 |
- optparser.add_option( "--disable", dest="enable", action="store_false", help="Enable given CloudFront distribution (only for [cfmodify] command) or access logging (for [accesslog] command)") |
|
1617 |
+ optparser.add_option( "--enable", dest="enable", action="store_true", help="Enable given CloudFront distribution (only for [cfmodify] command)") |
|
1618 |
+ optparser.add_option( "--disable", dest="enable", action="store_false", help="Enable given CloudFront distribution (only for [cfmodify] command)") |
|
1619 | 1619 |
optparser.add_option( "--cf-add-cname", dest="cf_cnames_add", action="append", metavar="CNAME", help="Add given CNAME to a CloudFront distribution (only for [cfcreate] and [cfmodify] commands)") |
1620 | 1620 |
optparser.add_option( "--cf-remove-cname", dest="cf_cnames_remove", action="append", metavar="CNAME", help="Remove given CNAME from a CloudFront distribution (only for [cfmodify] command)") |
1621 | 1621 |
optparser.add_option( "--cf-comment", dest="cf_comment", action="store", metavar="COMMENT", help="Set COMMENT for a given CloudFront distribution (only for [cfcreate] and [cfmodify] commands)") |