diff --git a/bin/setacls b/bin/setacls index adf32ed1643f4a58869df864a89dfe6b57d9a970..0eae3ea7b39b7c3c12762c5daab184bc4699e0ac 100755 --- a/bin/setacls +++ b/bin/setacls @@ -29,7 +29,7 @@ logging.basicConfig( LOGGER = logging.getLogger('setacls') config_file = 'acls.yml' -config_path = f'{os.getenv("FASTDATA_jsc")}/swmanage/EasyBuild/{os.getenv("STAGE")}/{config_file})' +config_path = f'{os.getenv("FASTDATA_jsc")}/swmanage/EasyBuild/{os.getenv("STAGE")}/{config_file}' executed_cmds = 0 @@ -299,7 +299,11 @@ def run(): # The syntax commented below is more convenient, but just works with PyYAML >5.1 # l_config = yaml.load(args.config[0], Loader=yaml.FullLoader) - with open(args.config[0].name) as config: + if isinstance(args.config, list): + config_file_path = args.config[0].name + else: + config_file_path = args.config.name + with open(config_file_path) as config: l_config = yaml.safe_load(config) log_file = '<stderr>' @@ -316,7 +320,7 @@ def run(): if args.debug: LOGGER.setLevel(logging.DEBUG) LOGGER.debug(f'{bcolors.HEADER}{bcolors.UNDERLINE}Configuration:{bcolors.ENDC}') - LOGGER.debug(f'* {bcolors.CYAN}Config file:{bcolors.ENDC} {args.config[0].name}') + LOGGER.debug(f'* {bcolors.CYAN}Config file:{bcolors.ENDC} {config_file_path}') LOGGER.debug(f'* {bcolors.CYAN}Debug:{bcolors.ENDC} {args.debug}') LOGGER.debug(f'* {bcolors.CYAN}Log file:{bcolors.ENDC} {log_file}') LOGGER.debug(f'* {bcolors.CYAN}Check:{bcolors.ENDC} {args.check}')