Skip to content
Snippets Groups Projects
Commit 6cda7c1b authored by Anne Philipp's avatar Anne Philipp
Browse files

moved check install coditions to install module

parent 2d56c04d
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,8 @@ _VERSION_STR = '7.1'
QUEUES_LIST = ['ecgate', 'cca', 'ccb']
INSTALL_TARGETS = ['local', 'ecgate', 'cca']
# up-to-date available maximum level numbers at ECMWF, 05.10.2018
MAX_LEVEL_LIST = [16, 19, 31, 40, 50, 60, 62, 91, 137]
......
......@@ -503,52 +503,6 @@ class ControlFile(object):
return
def check_install_conditions(self):
'''Checks a couple of necessary attributes and conditions
for the installation such as if they exist and contain values.
Otherwise set default values.
Parameters
----------
Return
------
'''
if self.install_target and \
self.install_target not in ['local', 'ecgate', 'cca']:
print('ERROR: unknown or missing installation target ')
print('target: ', self.install_target)
print('please specify correct installation target ' +
'(local | ecgate | cca)')
print('use -h or --help for help')
sys.exit(1)
if self.install_target and self.install_target != 'local':
if not self.ecgid or not self.ecuid or \
not self.gateway or not self.destination:
print('Please enter your ECMWF user id and group id as well ' +
'as the \nname of the local gateway and the ectrans ' +
'destination ')
print('with command line options --ecuid --ecgid \
--gateway --destination')
print('Try "' + sys.argv[0].split('/')[-1] + \
' -h" to print usage information')
print('Please consult ecaccess documentation or ECMWF user \
support for further details')
sys.exit(1)
if not self.flexpart_root_scripts:
self.flexpart_root_scripts = '${HOME}'
else:
self.flexpart_root_scripts = self.flexpart_root_scripts
else: # local
if not self.flexpart_root_scripts:
self.flexpart_root_scripts = _config.PATH_FLEXEXTRACT_DIR
return
def to_list(self):
'''Just generates a list of strings containing the attributes and
assigned values except the attributes "_expanded", "exedir",
......
......@@ -79,7 +79,7 @@ def main():
args = get_install_cmdline_arguments()
c = ControlFile(args.controlfile)
c.assign_args_to_control(args)
c.check_install_conditions()
check_install_conditions(c)
install_via_gateway(c)
......@@ -218,6 +218,57 @@ def install_via_gateway(c):
return
def check_install_conditions(c):
'''Checks a couple of necessary attributes and conditions
for the installation such as if they exist and contain values.
Otherwise set default values.
Parameters
----------
c : :obj:`ControlFile`
Contains all the parameters of CONTROL file and
command line.
Return
------
'''
if c.install_target and \
c.install_target not in _config.INSTALL_TARGETS:
print('ERROR: unknown or missing installation target ')
print('target: ', c.install_target)
print('please specify correct installation target ' +
str(INSTALL_TARGETS))
print('use -h or --help for help')
sys.exit(1)
if c.install_target and c.install_target != 'local':
if not c.ecgid or not c.ecuid or \
not c.gateway or not c.destination:
print('Please enter your ECMWF user id and group id as well ' +
'as the \nname of the local gateway and the ectrans ' +
'destination ')
print('with command line options --ecuid --ecgid \
--gateway --destination')
print('Try "' + sys.argv[0].split('/')[-1] + \
' -h" to print usage information')
print('Please consult ecaccess documentation or ECMWF user \
support for further details')
sys.exit(1)
if not c.flexpart_root_scripts:
c.flexpart_root_scripts = '${HOME}'
else:
c.flexpart_root_scripts = c.flexpart_root_scripts
else: # local
if not c.flexpart_root_scripts:
c.flexpart_root_scripts = _config.PATH_FLEXEXTRACT_DIR
return
def mk_tarball(tarball_path, target):
'''Creates a tarball with all necessary files which need to be sent to the
installation directory.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment