Commit 3aefddf5 authored by Andrii Salnikov's avatar Andrii Salnikov

Generalize common part of arcctl arc.conf-based ops naming to avoid limiting to CE only

parent 4c4105b6
......@@ -80,11 +80,11 @@ debian/tmp/usr/lib/python?.?/site-packages/arc/control/AccountingPublishing.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/Accounting.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/Cache.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/Config.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/CECommon.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/Jobs.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/JuraArchive.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/JuraArchiveSQLite.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/RunTimeEnvironment.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/ServiceCommon.py*
debian/tmp/usr/lib/python?.?/site-packages/arc/control/Services.py*
debian/tmp/usr/lib/arc/arccandypond
......
......@@ -1480,11 +1480,11 @@ service arc-infosys-ldap condrestart > /dev/null 2>&1 || :
%{python3_sitearch}/%{pkgdir}/control/Accounting.py
%{python3_sitearch}/%{pkgdir}/control/Cache.py
%{python3_sitearch}/%{pkgdir}/control/Config.py
%{python3_sitearch}/%{pkgdir}/control/CECommon.py
%{python3_sitearch}/%{pkgdir}/control/Jobs.py
%{python3_sitearch}/%{pkgdir}/control/JuraArchive.py
%{python3_sitearch}/%{pkgdir}/control/JuraArchiveSQLite.py
%{python3_sitearch}/%{pkgdir}/control/RunTimeEnvironment.py
%{python3_sitearch}/%{pkgdir}/control/ServiceCommon.py
%{python3_sitearch}/%{pkgdir}/control/Services.py
%dir %{python3_sitearch}/%{pkgdir}/control/__pycache__
%{python3_sitearch}/%{pkgdir}/control/__pycache__/AccountingDB.*
......@@ -1493,11 +1493,11 @@ service arc-infosys-ldap condrestart > /dev/null 2>&1 || :
%{python3_sitearch}/%{pkgdir}/control/__pycache__/Accounting.*
%{python3_sitearch}/%{pkgdir}/control/__pycache__/Cache.*
%{python3_sitearch}/%{pkgdir}/control/__pycache__/Config.*
%{python3_sitearch}/%{pkgdir}/control/__pycache__/CECommon.*
%{python3_sitearch}/%{pkgdir}/control/__pycache__/Jobs.*
%{python3_sitearch}/%{pkgdir}/control/__pycache__/JuraArchive.*
%{python3_sitearch}/%{pkgdir}/control/__pycache__/JuraArchiveSQLite.*
%{python3_sitearch}/%{pkgdir}/control/__pycache__/RunTimeEnvironment.*
%{python3_sitearch}/%{pkgdir}/control/__pycache__/ServiceCommon.*
%{python3_sitearch}/%{pkgdir}/control/__pycache__/Services.*
%else
%{python2_sitearch}/%{pkgdir}/ssm
......@@ -1508,11 +1508,11 @@ service arc-infosys-ldap condrestart > /dev/null 2>&1 || :
%{python2_sitearch}/%{pkgdir}/control/Accounting.py*
%{python2_sitearch}/%{pkgdir}/control/Cache.py*
%{python2_sitearch}/%{pkgdir}/control/Config.py*
%{python2_sitearch}/%{pkgdir}/control/CECommon.py*
%{python2_sitearch}/%{pkgdir}/control/Jobs.py*
%{python2_sitearch}/%{pkgdir}/control/JuraArchive.py*
%{python2_sitearch}/%{pkgdir}/control/JuraArchiveSQLite.py*
%{python2_sitearch}/%{pkgdir}/control/RunTimeEnvironment.py*
%{python2_sitearch}/%{pkgdir}/control/ServiceCommon.py*
%{python2_sitearch}/%{pkgdir}/control/Services.py*
%endif
%{_libexecdir}/%{pkgdir}/arccandypond
......
......@@ -9,11 +9,11 @@ from arc.utils import config
logger = logging.getLogger('ARCCTL.Common')
try:
from .CECommon import *
from .ServiceCommon import *
except ImportError:
arcctl_runtime_config = None
def arcctl_ce_mode():
def arcctl_server_mode():
return False
def remove_runtime_config():
......@@ -94,7 +94,7 @@ def get_parsed_arcconf(conf_f):
'Using /etc/arc.conf that exists.', def_conf_f)
runconf_load = True
else:
if arcctl_ce_mode():
if arcctl_server_mode():
logger.error('Cannot find ARC configuration file in the default location.')
return None
......@@ -126,7 +126,7 @@ def get_parsed_arcconf(conf_f):
arcconfig = config
arcconfig.conf_f = conf_f
except IOError:
if arcctl_ce_mode():
if arcctl_server_mode():
logger.error('Failed to open ARC configuration file %s', conf_f)
else:
logger.debug('arcctl is working in config-less mode relying on defaults only')
......
ACCOUNTINGCTLPY = Accounting.py AccountingDB.py AccountingPublishing.py AccountingLegacy.py JuraArchive.py JuraArchiveSQLite.py
SERVICESCTLPY = OSPackage.py OSService.py Services.py
SERVICESCTLPY = OSPackage.py OSService.py Services.py ServiceCommon.py
CACTLPY = TestCA.py CertificateGenerator.py
pkgpythondir = $(PYTHON_SITE_ARCH)/arc/control
pkgpython_PYTHON = __init__.py ControlCommon.py CECommon.py Config.py Jobs.py RunTimeEnvironment.py CommunityRTE.py Cache.py ThirdPartyDeployment.py $(ACCOUNTINGCTLPY) $(SERVICESCTLPY) $(CACTLPY)
pkgpython_PYTHON = __init__.py ControlCommon.py Config.py Jobs.py RunTimeEnvironment.py CommunityRTE.py Cache.py ThirdPartyDeployment.py $(ACCOUNTINGCTLPY) $(SERVICESCTLPY) $(CACTLPY)
import logging
from arc.paths import *
logger = logging.getLogger('ARCCTL.CECommon')
logger = logging.getLogger('ARCCTL.ServiceCommon')
# Runtime configuration (used for root only)
......@@ -10,13 +10,13 @@ if os.geteuid() != 0:
arcctl_runtime_config = None
def arcctl_ce_mode():
"""Just return True indicating that we are working in ARC CE mode with arc.conf in place"""
def arcctl_server_mode():
"""Just return True indicating that we are working in server mode with arc.conf in place"""
return True
def remove_runtime_config():
"""Remove ARC CE runtime configuration if defined"""
"""Remove ARC runtime configuration if defined"""
if arcctl_runtime_config is not None:
if os.path.exists(arcctl_runtime_config):
os.unlink(arcctl_runtime_config)
......@@ -50,7 +50,7 @@ class TestCAControl(ComponentControl):
# Use values from arc.conf if possible
self.arcconfig = arcconfig
if arcconfig is None:
if arcctl_ce_mode():
if arcctl_server_mode():
self.logger.info('Failed to parse arc.conf, using default CA certificates directory')
else:
self.logger.debug('Working in config-less mode. Default paths will be used.')
......@@ -253,7 +253,7 @@ class TestCAControl(ComponentControl):
usercertfiles.keyLocation,
os.getcwd()))
# add subject to allowed list
if arcctl_ce_mode():
if arcctl_server_mode():
if not args.no_auth:
try:
self.logger.info('Adding certificate subject name (%s) to allowed list at %s',
......@@ -323,5 +323,5 @@ class TestCAControl(ComponentControl):
testca_user.add_argument('-t', '--export-tar', action='store_true',
help='Export tar archive to use from another host')
testca_user.add_argument('-f', '--force', action='store_true', help='Overwrite files if exist')
if arcctl_ce_mode():
if arcctl_server_mode():
testca_user.add_argument('--no-auth', action='store_true', help='Do not add user subject to allowed list')
......@@ -28,7 +28,7 @@ class ThirdPartyControl(ComponentControl):
self.x509_cert_dir = '/etc/grid-security/certificates'
self.arcconfig = arcconfig
if arcconfig is None:
if arcctl_ce_mode():
if arcctl_server_mode():
self.logger.debug('Working in config-less mode. Default paths will be used.')
else:
self.logger.info('Failed to parse arc.conf, using default CA certificates path')
......@@ -530,7 +530,7 @@ deb http://dist.eugridpma.info/distribution/igtf/current igtf accredited
deploy_voms_lsc.add_argument('--pythonssl', action='store_true',
help='Use Python SSL module to establish TLS connection '
'(default is to call external OpenSSL binary)')
if arcctl_ce_mode():
if arcctl_server_mode():
iptables = deploy_actions.add_parser('iptables-config',
help='Generate iptables config to allow ARC CE configured services')
iptables.add_argument('--any-state', action='store_true',
......
......@@ -45,7 +45,7 @@ class ArgumentParserHelpOnError(argparse.ArgumentParser):
def get_parser():
parser = ArgumentParserHelpOnError(description='NorduGrid ARC Control Tool')
config_help = 'config file location (default is {0})'.format(config.arcconf_defpath())
if not ControlCommon.arcctl_ce_mode():
if not ControlCommon.arcctl_server_mode():
config_help = argparse.SUPPRESS
parser.add_argument('-c', '--config', action='store', help=config_help)
parser.add_argument('-d', '--debug', action='store',
......
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