Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions mig/install/MiGserver-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,6 @@ update_interval = __ACCOUNTING_UPDATE_INTERVAL__

[SITE]
# Web site appearance
# Whether to use Python 3 for all Python invocations
prefer_python3 = __PREFER_PYTHON3__
# Dynamic entry page to pick user default with fallback to site landing page
autolaunch_page = __AUTOLAUNCH_PAGE__
# Entry page if not explictly provided or overriden by user
Expand Down
1 change: 0 additions & 1 deletion mig/install/apache-mimic-deb-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ __APACHE_RECENT__ LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule version_module modules/mod_version.so

# Optional WSGI if requested
__WSGI_PY2_COMMENTED__ LoadModule wsgi_module modules/mod_wsgi.so
__WSGI_PY3_COMMENTED__ LoadModule wsgi_module modules/mod_wsgi_python3.so

# Optional OpenID support if requested
Expand Down
1 change: 0 additions & 1 deletion mig/install/generateconfs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
Expand Down Expand Up @@ -48,7 +48,7 @@

# NOTE: moved mig imports into try/except to avoid autopep8 moving to top!
try:
from mig.shared.defaults import MIG_BASE, MIG_ENV

Check failure on line 51 in mig/install/generateconfs.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'MIG_ENV' (90% confidence)

Check failure on line 51 in mig/install/generateconfs.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'MIG_ENV' (90% confidence)
from mig.shared.install import generate_confs
except ImportError:
print("ERROR: the migrid modules must be in PYTHONPATH")
Expand Down Expand Up @@ -306,12 +306,11 @@
'seafile_ro_access',
'public_use_https',
'jupyter_services_enable_proxy_https',
'prefer_python3',
'io_account_expire',
'gdp_email_notify',
]
names = str_names + int_names + bool_names
settings, options, result = {}, {}, {}

Check failure on line 313 in mig/install/generateconfs.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'result' (60% confidence)

Check failure on line 313 in mig/install/generateconfs.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'result' (60% confidence)
default_val = 'DEFAULT'
# Force values to expected type
for key in names:
Expand Down Expand Up @@ -387,7 +386,7 @@
if val == 'DEFAULT':
del settings[key]

(options, result) = _generate_confs(output_path, **settings)

Check failure on line 389 in mig/install/generateconfs.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'result' (60% confidence)

Check failure on line 389 in mig/install/generateconfs.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'result' (60% confidence)

# TODO: avoid reconstructing this path (also done inside generate_confs)
instructions_path = os.path.join(options['destination_dir'],
Expand Down
11 changes: 3 additions & 8 deletions mig/shared/configuration.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
Expand Down Expand Up @@ -32,13 +32,13 @@
from __future__ import print_function
from future import standard_library
from builtins import range
from builtins import object

Check failure on line 35 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'object' (90% confidence)

Check failure on line 35 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'object' (90% confidence)

import base64
import copy
import datetime
from enum import Enum
import functools

Check failure on line 41 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'functools' (90% confidence)

Check failure on line 41 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'functools' (90% confidence)
import inspect
import os
import pwd
Expand Down Expand Up @@ -73,7 +73,7 @@
valid_filter_methods, default_twofactor_auth_apps, \
mig_conf_section_dirname
from mig.shared.logger import Logger, SYSLOG_GDP
from mig.shared.htmlgen import menu_items, vgrid_items

Check failure on line 76 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'vgrid_items' (90% confidence)

Check failure on line 76 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused import 'vgrid_items' (90% confidence)
from mig.shared.fileio import read_file, load_json, write_file
except ImportError as ioe:
print("could not import migrid modules")
Expand Down Expand Up @@ -147,7 +147,7 @@
return val
# logger.debug("expand any ENV and FILE content in %r" % val)
env_pattern = "[a-zA-Z][a-zA-Z0-9_]+"
cache_pattern = file_pattern = "[^ ]+"

Check failure on line 150 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'cache_pattern' (60% confidence)

Check failure on line 150 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

unused variable 'cache_pattern' (60% confidence)
expanded = val
expand_pairs = [(keyword_env, env_pattern), (keyword_file, file_pattern)]
for (key, pattern) in expand_pairs:
Expand Down Expand Up @@ -175,7 +175,7 @@
# "reading conf content from file in %r" % cache)
content = read_file(path, logger)
if cache and content:
# logger.debug("caching conf content salt in %r" % cache)

Check warning on line 178 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)

Check warning on line 178 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
write_file(content, cache, logger)
if not content:
logger.warning("salt file not found or empty: %s" % path)
Expand Down Expand Up @@ -249,7 +249,7 @@
'server_home': '~/state/server_home/',
'webserver_home': '~/state/webserver_home/',
'sessid_to_mrsl_link_home': '~/state/sessid_to_mrsl_link_home/',
'sessid_to_jupyter_mount_link_home': '~/state/sessid_to_jupyter_mount_link_home/',

Check warning on line 252 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (90 > 80 characters)

Check warning on line 252 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (90 > 80 characters)
'mig_system_files': '~/state/mig_system_files/',
'mig_system_storage': '~/state/mig_system_storage',
'mig_system_run': '~/state/mig_system_run/',
Expand Down Expand Up @@ -384,7 +384,7 @@
'architectures': 'X86 AMD64 IA64 SPARC SPARC64 ITANIUM SUN4U SPARC-T1',
'scriptlanguages': 'sh python java',
'jobtypes': 'batch bulk all',
'lrmstypes': 'Native Native-execution-leader Batch Batch-execution-leader',

Check warning on line 387 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)

Check warning on line 387 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (83 > 80 characters)
}
scheduler_section = {'algorithm': 'FairFit',
'expire_after': '99999999999',
Expand Down Expand Up @@ -461,7 +461,7 @@

modified = False
for (section, settings) in _FIX_MISSING_DEFINITIONS.items():
if not section in config.sections():

Check warning on line 464 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

test for membership should be 'not in'

Check warning on line 464 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

test for membership should be 'not in'
config.add_section(section)

for (option, value) in settings.items():
Expand All @@ -480,7 +480,7 @@
modified = True
if modified:
backup_path = '%s.%d' % (config_file, time.time())
print('Backing up existing configuration to %s as update removes all comments'

Check warning on line 483 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (86 > 80 characters)

Check warning on line 483 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (86 > 80 characters)
% backup_path)
fd = open(config_file, 'r')
backup_fd = open(backup_path, 'w')
Expand Down Expand Up @@ -576,7 +576,6 @@
'workflows_vgrid_recipes_home': '',
'workflows_vgrid_history_home': '',
'site_user_id_format': DEFAULT_USER_ID_FORMAT,
'site_prefer_python3': False,
'site_autolaunch_page': '',
'site_landing_page': '',
'site_skin': '',
Expand Down Expand Up @@ -772,7 +771,7 @@
'VERIFYFILES', 'VGRID'],
'job_cond_yellow': ['DISK', 'MEMORY', 'CPUTIME'],
'job_cond_orange': ['CPUCOUNT', 'NODECOUNT'],
'job_cond_red': ['EXECUTABLES', 'INPUTFILES', 'REGISTERED', 'SEEN_WITHIN_X'],

Check warning on line 774 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)

Check warning on line 774 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
'enable_suggest': False,
'suggest_threshold': 'GREEN',

Expand Down Expand Up @@ -887,7 +886,7 @@
self.log_dir = config.get('GLOBAL', 'log_dir')
self.logfile = config.get('GLOBAL', 'logfile')
self.loglevel = config.get('GLOBAL', 'loglevel')
except:

Check warning on line 889 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'

Check warning on line 889 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'

# Fall back to file in current dir

Expand Down Expand Up @@ -1039,7 +1038,7 @@
self.jobtypes = config.get('GLOBAL', 'jobtypes').split()
self.lrmstypes = config.get('GLOBAL', 'lrmstypes').split()
self.sessid_to_mrsl_link_home = config.get('GLOBAL',
'sessid_to_mrsl_link_home')

Check warning on line 1041 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (82 > 80 characters)

Check warning on line 1041 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (82 > 80 characters)
self.mig_system_files = config.get('GLOBAL',
'mig_system_files')
self.mig_system_storage = config.get('GLOBAL',
Expand Down Expand Up @@ -1067,7 +1066,7 @@
except Exception as err:
try:
self.logger.error('Error in reloading configuration: %s' % err)
except:

Check warning on line 1069 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'

Check warning on line 1069 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'
pass
raise Exception('Failed to parse configuration: %s' % err)

Expand Down Expand Up @@ -1130,7 +1129,7 @@
try:
fqdn = socket.getfqdn()
user = os.environ['USER']
except:

Check warning on line 1132 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'

Check warning on line 1132 in mig/shared/configuration.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

do not use bare 'except'
pass
self.admin_email = '%s@%s' % (user, fqdn)
# Let support_email be optional with fallback to admin_email
Expand Down Expand Up @@ -2006,11 +2005,6 @@
self.site_assets = config.get('SITE', 'assets')
else:
self.site_assets = "/assets"
if config.has_option('SITE', 'prefer_python3'):
self.site_prefer_python3 = config.getboolean('SITE',
'prefer_python3')
else:
self.site_prefer_python3 = False
if config.has_option('SITE', 'user_id_format'):
self.site_user_id_format = config.get('SITE', 'user_id_format')
if not self.site_user_id_format in valid_user_id_formats:
Expand Down Expand Up @@ -2808,8 +2802,9 @@
def apply_loaded_config_to_division(self, division, config):
defaults = _FIX_MISSING_DEFINITIONS[division]
relevant = {k: config.get(division, k, fallback=defaults[k])
for k in defaults}
normalise_division = getattr(self, "division_normalise_%s" % (division,))
for k in defaults}
normalise_division = getattr(
self, "division_normalise_%s" % (division,))
normalise_division(relevant)

def division_normalise_TEMPLATES(self, candidates):
Expand Down
12 changes: 1 addition & 11 deletions mig/shared/install.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
Expand Down Expand Up @@ -405,7 +405,6 @@
enable_sitestatus=True,
enable_quota=False,
enable_accounting=False,
prefer_python3=False,
io_account_expire=False,
gdp_email_notify=False,
user_interface="V3 V2",
Expand Down Expand Up @@ -738,7 +737,6 @@
enable_sitestatus,
enable_quota,
enable_accounting,
prefer_python3,
io_account_expire,
gdp_email_notify,
user_interface,
Expand Down Expand Up @@ -998,7 +996,6 @@
user_dict['__ENABLE_SITESTATUS__'] = "%s" % enable_sitestatus
user_dict['__ENABLE_QUOTA__'] = "%s" % enable_quota
user_dict['__ENABLE_ACCOUNTING__'] = "%s" % enable_accounting
user_dict['__PREFER_PYTHON3__'] = "%s" % prefer_python3
user_dict['__IO_ACCOUNT_EXPIRE__'] = "%s" % io_account_expire
user_dict['__GDP_EMAIL_NOTIFY__'] = "%s" % gdp_email_notify
user_dict['__USER_INTERFACE__'] = user_interface
Expand Down Expand Up @@ -1352,18 +1349,11 @@
# WSGI shares auth and bin and only discriminates in backend
xgi_bin = xgi_auth = 'wsgi-bin'
user_dict['__WSGI_COMMENTED__'] = ''
# Switch between python 2 and 3 wsgi module on request
if prefer_python3:
user_dict['__WSGI_PY3_COMMENTED__'] = ''
user_dict['__WSGI_PY2_COMMENTED__'] = '#'
else:
user_dict['__WSGI_PY2_COMMENTED__'] = ''
user_dict['__WSGI_PY3_COMMENTED__'] = '#'
user_dict['__WSGI_PY3_COMMENTED__'] = ''
else:
xgi_bin = 'cgi-bin'
xgi_auth = 'cgi-auth'
user_dict['__WSGI_COMMENTED__'] = '#'
user_dict['__WSGI_PY2_COMMENTED__'] = '#'
user_dict['__WSGI_PY3_COMMENTED__'] = '#'

# Enable HSTS security improvement only if explicitly requested
Expand Down
2 changes: 0 additions & 2 deletions tests/data/MiGserver--customised-include_sections.conf
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,6 @@ update_interval = 3600

[SITE]
# Web site appearance
# Whether to use Python 3 for all Python invocations
prefer_python3 = False
# Dynamic entry page to pick user default with fallback to site landing page
autolaunch_page = /wsgi-bin/autolaunch.py
# Entry page if not explictly provided or overriden by user
Expand Down
2 changes: 0 additions & 2 deletions tests/data/MiGserver--customised.conf
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,6 @@ update_interval = 3600

[SITE]
# Web site appearance
# Whether to use Python 3 for all Python invocations
prefer_python3 = False
# Dynamic entry page to pick user default with fallback to site landing page
autolaunch_page = /wsgi-bin/autolaunch.py
# Entry page if not explictly provided or overriden by user
Expand Down
2 changes: 0 additions & 2 deletions tests/data/MiGserver--default_templates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,6 @@ update_interval = 3600

[SITE]
# Web site appearance
# Whether to use Python 3 for all Python invocations
prefer_python3 = False
# Dynamic entry page to pick user default with fallback to site landing page
autolaunch_page = /wsgi-bin/autolaunch.py
# Entry page if not explictly provided or overriden by user
Expand Down
2 changes: 0 additions & 2 deletions tests/data/MiGserver--empty_templates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,6 @@ update_interval = 3600

[SITE]
# Web site appearance
# Whether to use Python 3 for all Python invocations
prefer_python3 = False
# Dynamic entry page to pick user default with fallback to site landing page
autolaunch_page = /wsgi-bin/autolaunch.py
# Entry page if not explictly provided or overriden by user
Expand Down
2 changes: 0 additions & 2 deletions tests/data/MiGserver--templates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,6 @@ update_interval = 3600

[SITE]
# Web site appearance
# Whether to use Python 3 for all Python invocations
prefer_python3 = False
# Dynamic entry page to pick user default with fallback to site landing page
autolaunch_page = /wsgi-bin/autolaunch.py
# Entry page if not explictly provided or overriden by user
Expand Down
2 changes: 0 additions & 2 deletions tests/fixture/confs-stdlocal/MiGserver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,6 @@ update_interval = 3600

[SITE]
# Web site appearance
# Whether to use Python 3 for all Python invocations
prefer_python3 = False
# Dynamic entry page to pick user default with fallback to site landing page
autolaunch_page = /wsgi-bin/autolaunch.py
# Entry page if not explictly provided or overriden by user
Expand Down
3 changes: 1 addition & 2 deletions tests/fixture/confs-stdlocal/mimic-deb.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule version_module modules/mod_version.so

# Optional WSGI if requested
LoadModule wsgi_module modules/mod_wsgi.so
#LoadModule wsgi_module modules/mod_wsgi_python3.so
LoadModule wsgi_module modules/mod_wsgi_python3.so

# Optional OpenID support if requested
# Please note that fully functional OpenID cert_redirect requires reverse
Expand Down
1 change: 0 additions & 1 deletion tests/fixture/mig_shared_configuration--new.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@
".*"
]
],
"site_prefer_python3": false,
"site_signup_hint": "",
"site_signup_methods": [
"extcert"
Expand Down
Loading