Browse code

Allow acl_public = True/False to be in config file

Normally acl_public = None and it's not present, nor read from,
the config file. If a user wants to set it in the config file though,
we need to be able to read it from the config file.

We also need to _not_ have the lack of command line options
unintentionally set it back to None.

Add special handling for acl_public, when reading in the
config file, and when handling --acl-public and --acl-private options.

Matt Domsch authored on 2015/12/11 11:13:05
Showing 2 changed files
... ...
@@ -253,6 +253,11 @@ class Config(object):
253 253
                 _option = _option.strip()
254 254
             self.update_option(option, _option)
255 255
 
256
+        # allow acl_public to be set from the config file too, even though by
257
+        # default it is set to None, and not present in the config file.
258
+        if cp.get('acl_public'):
259
+            self.update_option('acl_public', cp.get('acl_public'))
260
+
256 261
         if cp.get('add_headers'):
257 262
             for option in cp.get('add_headers').split(","):
258 263
                 (key, value) = option.split(':')
... ...
@@ -2726,7 +2726,8 @@ def main():
2726 2726
 
2727 2727
     ## Special handling for tri-state options (True, False, None)
2728 2728
     cfg.update_option("enable", options.enable)
2729
-    cfg.update_option("acl_public", options.acl_public)
2729
+    if options.acl_public is not None:
2730
+        cfg.update_option("acl_public", options.acl_public)
2730 2731
 
2731 2732
     ## Check multipart chunk constraints
2732 2733
     if cfg.multipart_chunk_size_mb < MultiPartUpload.MIN_CHUNK_SIZE_MB: