Skip to content
Open
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
16 changes: 8 additions & 8 deletions mig/server/checkconf.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# checkconf - check MiGserver.conf file
# Copyright (C) 2003-2024 The MiG Project lead by Brian Vinter
# Copyright (C) 2003-2026 The MiG Project by the Science HPC Center at UCPH
#
# This file is part of MiG.
#
Expand All @@ -20,7 +20,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# -- END_HEADER ---
#
Expand All @@ -39,7 +40,6 @@
import os
import re
import sys
import types

from mig.shared.configuration import Configuration, ConfigParser
from mig.shared.configuration import fix_missing
Expand All @@ -53,7 +53,7 @@
"""Print usage help"""

return """Usage: checkconf.py [server_conf]
The script checks the default MiG server configuration or server_conf for errors."""

Check warning on line 56 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (84 > 80 characters)

Check warning on line 56 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (84 > 80 characters)


def ask_reply(question):
Expand Down Expand Up @@ -115,9 +115,7 @@

# Search object attributes for possible paths

attrs = []
ignore_attrs = ['__class__', '__doc__', '__module__']
path_re = re.compile('(' + os.sep + "[\w\._-]*)+$")

Check warning on line 118 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

invalid escape sequence '\.'

Check warning on line 118 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

invalid escape sequence '\w'

Check warning on line 118 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

invalid escape sequence '\.'

Check warning on line 118 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

invalid escape sequence '\w'

_logger = conf.logger
_logger.info('Checking configuration paths in %s ...', conf_file)
Expand Down Expand Up @@ -158,7 +156,7 @@
else:
_logger.warning('%s: %s does not exist!', name, val)
print('* WARNING *: %s: %s does not exist!' % (name, val))
if not path in missing_paths:
if path not in missing_paths:
missing_paths.append(path)
warnings += 1

Expand All @@ -175,16 +173,18 @@
missing_paths.sort()

for path in missing_paths:
# Initialise path_type to a bogus value
path_type = False
if ALWAYS == answer:

# 'always' answer reults in default type for all missing entries
# 'always' answer results in default type for all missing entries

Check warning on line 180 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (85 > 80 characters)

Check warning on line 180 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (85 > 80 characters)

path_type = None
elif YES == answer:
path_type = \
ask_reply('Create %s as a (d)irectory, (f)ile or (p)ipe? [D/f/p] '

Check warning on line 185 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (90 > 80 characters)

Check warning on line 185 in mig/server/checkconf.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (90 > 80 characters)
% path)
if not path_type or 'D' == path_type.upper():
if path_type is None or 'D' == path_type.upper():
try:
os.makedirs(path)
print('created directory %s' % path)
Expand Down
Loading