Commit 9cf886c1 authored by Maiken's avatar Maiken

Merge branch 'arcctl-ARC_COFNIG' into 'master'

Implement ARC_CONFIG environment variable handling in arcctl (BUGZ-3854)

See merge request nordugrid/arc!831
parents 4dfe3309 fe0b74f1
......@@ -22,20 +22,35 @@ def get_parsed_arcconf(conf_f):
# handle default
def_conf_f = config.arcconf_defpath()
runconf_load = False
# if not overrided by command line --config argument (passed as a parameter to this function)
if conf_f is None:
if os.path.exists(def_conf_f):
# check location is defined by ARC_CONFIG
if 'ARC_CONFIG' in os.environ:
conf_f = os.environ['ARC_CONFIG']
logger.debug('Will use ARC configuration file %s as defined by ARC_CONFIG environmental variable', conf_f)
if not os.path.exists(conf_f):
logger.error('Cannot find ARC configuration file %s (defined by ARC_CONFIG environmental variable)',
return None
# use installation prefix location
elif os.path.exists(def_conf_f):
conf_f = def_conf_f
runconf_load = True
# or fallback to /etc/arc.conf
elif def_conf_f != '/etc/arc.conf' and os.path.exists('/etc/arc.conf'):
conf_f = '/etc/arc.conf'
logger.warning('There is no arc.conf in ARC installation prefix (%s). '
'Using /etc/arc.conf that exists.', def_conf_f)
runconf_load = True
logger.error('Cannot find ARC configuration file in the default location.')
return None
if runconf_load:
if arcctl_runtime_config is not None:
runconf_load = os.path.exists(arcctl_runtime_config)
logger.debug('Custom ARC configuration file location used. Runtime configuration will not be used.')
logger.debug('Custom ARC configuration file location is specified. Ignoring cached runtime configuration usage.')
logger.debug('Getting ARC configuration (config file: %s)', conf_f)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment