Add function for parsing a list from a config option
This commit is contained in:
		@@ -40,7 +40,7 @@ def get_files_by_suffix(suffix):
 | 
				
			|||||||
    yield from CONFIG_DIR.glob(f"*{suffix}")
 | 
					    yield from CONFIG_DIR.glob(f"*{suffix}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def load_list_from_option(parser, *, section="", option="", fallback=list()):
 | 
					def load_list_from_option(parser, *, section="", option="", fallback=None):
 | 
				
			||||||
    """Using a combination of ``ConfigParser`` and JSON, load a
 | 
					    """Using a combination of ``ConfigParser`` and JSON, load a
 | 
				
			||||||
    list from a configuration file option.
 | 
					    list from a configuration file option.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -53,7 +53,7 @@ def load_list_from_option(parser, *, section="", option="", fallback=list()):
 | 
				
			|||||||
    :returns: the list parsed by JSON
 | 
					    :returns: the list parsed by JSON
 | 
				
			||||||
    :param fallback: the fallback value to return if the option is empty
 | 
					    :param fallback: the fallback value to return if the option is empty
 | 
				
			||||||
    :type fallback: list
 | 
					    :type fallback: list
 | 
				
			||||||
    :rtype: list
 | 
					    :rtype: list or type of fallback value
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        return json.loads(parser[section][option])
 | 
					        return json.loads(parser[section][option])
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,12 +12,9 @@ _RSYNC_BIN = "/usr/bin/rsync"
 | 
				
			|||||||
DEFAULT_RSYNC_OPTS = [
 | 
					DEFAULT_RSYNC_OPTS = [
 | 
				
			||||||
    "--acls",
 | 
					    "--acls",
 | 
				
			||||||
    "--archive",
 | 
					    "--archive",
 | 
				
			||||||
    "--backup",
 | 
					 | 
				
			||||||
    "--backup-dir=backup",
 | 
					 | 
				
			||||||
    "--hard-links",
 | 
					    "--hard-links",
 | 
				
			||||||
    "--ignore-missing-args",
 | 
					    "--ignore-missing-args",
 | 
				
			||||||
    "--prune-empty-dirs",
 | 
					    "--prune-empty-dirs",
 | 
				
			||||||
    "--suffix=.old",
 | 
					 | 
				
			||||||
    "--recursive",
 | 
					    "--recursive",
 | 
				
			||||||
    "--xattrs",
 | 
					    "--xattrs",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user