From c506c7ab247773321199e5cf13be93bb92eb1df4 Mon Sep 17 00:00:00 2001 From: Jonas Bardino Date: Mon, 8 Sep 2025 11:55:45 +0200 Subject: [PATCH] More work on the migration to `mig/lib/` for code, `bin/` for scripts and tools and `sbin/` for services. Added symlinks in `bin/` and `sbin/` to most scripts, tools and services pending migration. We want to gradually replace those links by migrating the source to the new location and cleaning them up in the process as described in the included README files. Synced all active `__init__.py` files for consistency and working links. Tweaked `addheader.py` helper to avoid exceeding our 80-char line length limit. --- bin/README | 25 +++++++++--- bin/addheader.py | 10 ++--- bin/checkcloud.py | 1 + bin/checktwofactor.py | 1 + bin/chkenabled.py | 1 + bin/cleansessions.py | 1 + bin/createresource.py | 1 + bin/createuser.py | 1 + bin/deleteuser.py | 1 + bin/editgdpuser.py | 1 + bin/editmeta.py | 1 + bin/edituser.py | 1 + bin/genoiddiscovery.py | 1 + bin/importdoi.py | 1 + bin/importusers.py | 1 + bin/indexdoi.py | 1 + bin/managecloud.py | 1 + bin/notifyexpire.py | 1 + bin/notifymigoid.py | 1 + bin/notifypassword.py | 1 + bin/refreshusers.py | 1 + bin/rejectuser.py | 1 + bin/reqacceptpeer.py | 1 + bin/reset2fakey.py | 1 + bin/sftpfailinfo.py | 1 + bin/usagestats.py | 1 + bin/verifyarchives.py | 1 + mig/__init__.py | 13 +++--- mig/cgi-bin/__init__.py | 25 ++++++++---- mig/lib/README | 12 ++++-- mig/lib/__init__.py | 40 +++++++++++++++++++ mig/server/__init__.py | 13 +++--- mig/shared/__init__.py | 17 ++++---- mig/shared/functionality/__init__.py | 27 ++++++++----- mig/shared/gdp/__init__.py | 19 ++++----- mig/shared/griddaemons/__init__.py | 18 +++++---- .../pylustrequota/pylustrequota/__init__.py | 8 ++-- mig/unittest/__init__.py | 40 +++++++++++++++++++ mig/user/__init__.py | 13 +++--- mig/user/selenium/__init__.py | 15 +++---- sbin/README | 23 +++++++++++ sbin/chksidroot.py | 1 + sbin/chkuserroot.py | 1 + sbin/grid_cron.py | 1 + sbin/grid_events.py | 1 + sbin/grid_ftps.py | 1 + sbin/grid_imnotify.py | 1 + sbin/grid_imnotify_stdout.py | 1 + sbin/grid_monitor.py | 1 + sbin/grid_notify.py | 1 + sbin/grid_openid.py | 1 + sbin/grid_script.py | 1 + sbin/grid_sftp.py | 1 + sbin/grid_sshmux.py | 1 + sbin/grid_transfers.py | 1 + sbin/grid_vmproxy.py | 1 + sbin/grid_webdavs.py | 1 + sbin/sftp_subsys.py | 1 + 58 files changed, 274 insertions(+), 86 deletions(-) create mode 120000 bin/checkcloud.py create mode 120000 bin/checktwofactor.py create mode 120000 bin/chkenabled.py create mode 120000 bin/cleansessions.py create mode 120000 bin/createresource.py create mode 120000 bin/createuser.py create mode 120000 bin/deleteuser.py create mode 120000 bin/editgdpuser.py create mode 120000 bin/editmeta.py create mode 120000 bin/edituser.py create mode 120000 bin/genoiddiscovery.py create mode 120000 bin/importdoi.py create mode 120000 bin/importusers.py create mode 120000 bin/indexdoi.py create mode 120000 bin/managecloud.py create mode 120000 bin/notifyexpire.py create mode 120000 bin/notifymigoid.py create mode 120000 bin/notifypassword.py create mode 120000 bin/refreshusers.py create mode 120000 bin/rejectuser.py create mode 120000 bin/reqacceptpeer.py create mode 120000 bin/reset2fakey.py create mode 120000 bin/sftpfailinfo.py create mode 120000 bin/usagestats.py create mode 120000 bin/verifyarchives.py create mode 100644 mig/lib/__init__.py create mode 100644 sbin/README create mode 120000 sbin/chksidroot.py create mode 120000 sbin/chkuserroot.py create mode 120000 sbin/grid_cron.py create mode 120000 sbin/grid_events.py create mode 120000 sbin/grid_ftps.py create mode 120000 sbin/grid_imnotify.py create mode 120000 sbin/grid_imnotify_stdout.py create mode 120000 sbin/grid_monitor.py create mode 120000 sbin/grid_notify.py create mode 120000 sbin/grid_openid.py create mode 120000 sbin/grid_script.py create mode 120000 sbin/grid_sftp.py create mode 120000 sbin/grid_sshmux.py create mode 120000 sbin/grid_transfers.py create mode 120000 sbin/grid_vmproxy.py create mode 120000 sbin/grid_webdavs.py create mode 120000 sbin/sftp_subsys.py diff --git a/bin/README b/bin/README index 794d8b089..063dca7b4 100644 --- a/bin/README +++ b/bin/README @@ -1,10 +1,23 @@ -= Intro = -We are moving various scripts and tools into a more logical location and will -as a start just link to the existing paths in this folder so that one can use -them as += Modernization and Clean Up = +We are cleaning up and moving various scripts and tools into a more logical +location and will as a start just link to the existing paths in this folder so +that one can use them as /path/to/bin/X Long term we will likely move them there instead and perhaps only preserve symlinks to still support the original paths for a while. -Some scripts and tools may still expect certain relative paths to e.g. the MiGserver.conf file but you can always override it with something like: -MIG_CONF=/path/to/my/MiGserver.conf ./bin/searchusers.py +Some scripts and tools may still expect certain relative paths to e.g. the +MiGserver.conf file but you can always override it with something like: +MIG_CONF=/path/to/my/MiGserver.conf /path/to/bin/searchusers.py + +The clean up also means that any code placed here MUST comply with the project +style guides, be lint clean, documented and have decent unit test coverage. + +You may want to use autopep8, pylint, flake8, ruff or 'make lint' targets once +available to help verify. +The black code formatter and isort may also come in handy. To apply them on +the code in $TARGET file please run: +black --line-length=80 $TARGET +isort --line-length=80 -m=HANGING_INDENT $TARGET +in that order on code files to preserve our existing hanging indent imports +instead of the exotic black import style with parentheses. diff --git a/bin/addheader.py b/bin/addheader.py index 0376d048e..bb6efdcdd 100755 --- a/bin/addheader.py +++ b/bin/addheader.py @@ -19,9 +19,8 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # --- END_HEADER --- # @@ -92,9 +91,8 @@ # GNU General Public License for more details. # # 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.""" +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.""" def check_header(path, var_dict, preamble_lines=100): diff --git a/bin/checkcloud.py b/bin/checkcloud.py new file mode 120000 index 000000000..9a1931a50 --- /dev/null +++ b/bin/checkcloud.py @@ -0,0 +1 @@ +../mig/server/checkcloud.py \ No newline at end of file diff --git a/bin/checktwofactor.py b/bin/checktwofactor.py new file mode 120000 index 000000000..a005172a3 --- /dev/null +++ b/bin/checktwofactor.py @@ -0,0 +1 @@ +../mig/server/checktwofactor.py \ No newline at end of file diff --git a/bin/chkenabled.py b/bin/chkenabled.py new file mode 120000 index 000000000..69e410d99 --- /dev/null +++ b/bin/chkenabled.py @@ -0,0 +1 @@ +../mig/server/chkenabled.py \ No newline at end of file diff --git a/bin/cleansessions.py b/bin/cleansessions.py new file mode 120000 index 000000000..95b8fa45d --- /dev/null +++ b/bin/cleansessions.py @@ -0,0 +1 @@ +../mig/server/cleansessions.py \ No newline at end of file diff --git a/bin/createresource.py b/bin/createresource.py new file mode 120000 index 000000000..5f6ef8171 --- /dev/null +++ b/bin/createresource.py @@ -0,0 +1 @@ +../mig/server/createresource.py \ No newline at end of file diff --git a/bin/createuser.py b/bin/createuser.py new file mode 120000 index 000000000..c14309d02 --- /dev/null +++ b/bin/createuser.py @@ -0,0 +1 @@ +../mig/server/createuser.py \ No newline at end of file diff --git a/bin/deleteuser.py b/bin/deleteuser.py new file mode 120000 index 000000000..314e282fd --- /dev/null +++ b/bin/deleteuser.py @@ -0,0 +1 @@ +../mig/server/deleteuser.py \ No newline at end of file diff --git a/bin/editgdpuser.py b/bin/editgdpuser.py new file mode 120000 index 000000000..d06c0bb9b --- /dev/null +++ b/bin/editgdpuser.py @@ -0,0 +1 @@ +../mig/server/editgdpuser.py \ No newline at end of file diff --git a/bin/editmeta.py b/bin/editmeta.py new file mode 120000 index 000000000..270f7b632 --- /dev/null +++ b/bin/editmeta.py @@ -0,0 +1 @@ +../mig/server/editmeta.py \ No newline at end of file diff --git a/bin/edituser.py b/bin/edituser.py new file mode 120000 index 000000000..5f54d80be --- /dev/null +++ b/bin/edituser.py @@ -0,0 +1 @@ +../mig/server/edituser.py \ No newline at end of file diff --git a/bin/genoiddiscovery.py b/bin/genoiddiscovery.py new file mode 120000 index 000000000..4ce12a5e7 --- /dev/null +++ b/bin/genoiddiscovery.py @@ -0,0 +1 @@ +../mig/server/genoiddiscovery.py \ No newline at end of file diff --git a/bin/importdoi.py b/bin/importdoi.py new file mode 120000 index 000000000..88208c02f --- /dev/null +++ b/bin/importdoi.py @@ -0,0 +1 @@ +../mig/server/importdoi.py \ No newline at end of file diff --git a/bin/importusers.py b/bin/importusers.py new file mode 120000 index 000000000..1cbac4e9c --- /dev/null +++ b/bin/importusers.py @@ -0,0 +1 @@ +../mig/server/importusers.py \ No newline at end of file diff --git a/bin/indexdoi.py b/bin/indexdoi.py new file mode 120000 index 000000000..305026a2c --- /dev/null +++ b/bin/indexdoi.py @@ -0,0 +1 @@ +../mig/server/indexdoi.py \ No newline at end of file diff --git a/bin/managecloud.py b/bin/managecloud.py new file mode 120000 index 000000000..c13220651 --- /dev/null +++ b/bin/managecloud.py @@ -0,0 +1 @@ +../mig/server/managecloud.py \ No newline at end of file diff --git a/bin/notifyexpire.py b/bin/notifyexpire.py new file mode 120000 index 000000000..0c7bb8d3c --- /dev/null +++ b/bin/notifyexpire.py @@ -0,0 +1 @@ +../mig/server/notifyexpire.py \ No newline at end of file diff --git a/bin/notifymigoid.py b/bin/notifymigoid.py new file mode 120000 index 000000000..45e87d81f --- /dev/null +++ b/bin/notifymigoid.py @@ -0,0 +1 @@ +../mig/server/notifymigoid.py \ No newline at end of file diff --git a/bin/notifypassword.py b/bin/notifypassword.py new file mode 120000 index 000000000..b107aa91f --- /dev/null +++ b/bin/notifypassword.py @@ -0,0 +1 @@ +../mig/server/notifypassword.py \ No newline at end of file diff --git a/bin/refreshusers.py b/bin/refreshusers.py new file mode 120000 index 000000000..9b97dd8fe --- /dev/null +++ b/bin/refreshusers.py @@ -0,0 +1 @@ +../mig/server/refreshusers.py \ No newline at end of file diff --git a/bin/rejectuser.py b/bin/rejectuser.py new file mode 120000 index 000000000..402b34f84 --- /dev/null +++ b/bin/rejectuser.py @@ -0,0 +1 @@ +../mig/server/rejectuser.py \ No newline at end of file diff --git a/bin/reqacceptpeer.py b/bin/reqacceptpeer.py new file mode 120000 index 000000000..62acf78f9 --- /dev/null +++ b/bin/reqacceptpeer.py @@ -0,0 +1 @@ +../mig/server/reqacceptpeer.py \ No newline at end of file diff --git a/bin/reset2fakey.py b/bin/reset2fakey.py new file mode 120000 index 000000000..c4c35ffc2 --- /dev/null +++ b/bin/reset2fakey.py @@ -0,0 +1 @@ +../mig/server/reset2fakey.py \ No newline at end of file diff --git a/bin/sftpfailinfo.py b/bin/sftpfailinfo.py new file mode 120000 index 000000000..f100027d5 --- /dev/null +++ b/bin/sftpfailinfo.py @@ -0,0 +1 @@ +../mig/server/sftpfailinfo.py \ No newline at end of file diff --git a/bin/usagestats.py b/bin/usagestats.py new file mode 120000 index 000000000..e3ff8231a --- /dev/null +++ b/bin/usagestats.py @@ -0,0 +1 @@ +../mig/server/usagestats.py \ No newline at end of file diff --git a/bin/verifyarchives.py b/bin/verifyarchives.py new file mode 120000 index 000000000..8f4c0165c --- /dev/null +++ b/bin/verifyarchives.py @@ -0,0 +1 @@ +../mig/server/verifyarchives.py \ No newline at end of file diff --git a/mig/__init__.py b/mig/__init__.py index 072418376..b3beb5b80 100644 --- a/mig/__init__.py +++ b/mig/__init__.py @@ -3,8 +3,8 @@ # # --- BEGIN_HEADER --- # -# __init__ - package marker -# Copyright (C) 2003-2020 The MiG Project lead by Brian Vinter +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,15 +19,16 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # """This file is needed to tell python that this dir is a package -so that other modules can call, say, import mig.shared.base -Please refer to http://www.network-theory.co.uk/docs/pytut/tut_51.html +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages and https://www.python.org/dev/peps/pep-0008/#imports for details diff --git a/mig/cgi-bin/__init__.py b/mig/cgi-bin/__init__.py index d35d4b6bd..b3beb5b80 100644 --- a/mig/cgi-bin/__init__.py +++ b/mig/cgi-bin/__init__.py @@ -3,8 +3,8 @@ # # --- BEGIN_HEADER --- # -# __init__ - [insert a few words of module description on this line] -# Copyright (C) 2003-2009 The MiG Project lead by Brian Vinter +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,13 +19,22 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # -# This file is needed to tell python that this dir is a package -# so that other modules can call, say, import shared.editing -# Please refer to http://www.network-theory.co.uk/docs/pytut/tut_51.html -# for details. +"""This file is needed to tell python that this dir is a package +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages +and +https://www.python.org/dev/peps/pep-0008/#imports +for details +""" + +__dummy = True + +# above line is only to make python tidy behave and not +# move module doc string inside header diff --git a/mig/lib/README b/mig/lib/README index caa680a21..664e6e173 100644 --- a/mig/lib/README +++ b/mig/lib/README @@ -4,7 +4,11 @@ efforts. That also means that any code placed here MUST comply with the project style guides, be lint clean, documented and have decent unit test coverage. -You may want to use autopep8, pylint, ruff or any available make lint targets -to help verify. -The black code formatter and isort may also come in handy. You can see usage -hints in `.github/workflows/python-stylecheck.yml`. +You may want to use autopep8, pylint, flake8, ruff or 'make lint' targets once +available to help verify. +The black code formatter and isort may also come in handy. To apply them on +the code in $TARGET file please run: +black --line-length=80 $TARGET +isort --line-length=80 -m=HANGING_INDENT $TARGET +in that order on code files to preserve our existing hanging indent imports +instead of the exotic black import style with parentheses. diff --git a/mig/lib/__init__.py b/mig/lib/__init__.py new file mode 100644 index 000000000..ac6422993 --- /dev/null +++ b/mig/lib/__init__.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# --- BEGIN_HEADER --- +# +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH +# +# This file is part of MiG. +# +# MiG is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# MiG is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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. +# +# -- END_HEADER --- +# + +"""This file is needed to tell python that this dir is a package +so that all modules can call, say, import mig.lib.daemon +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages +and +https://www.python.org/dev/peps/pep-0008/#imports +for details +""" + +__dummy = True + +# above line is only to make python tidy behave and not +# move module doc string inside header diff --git a/mig/server/__init__.py b/mig/server/__init__.py index 8bb43d9a9..b3beb5b80 100644 --- a/mig/server/__init__.py +++ b/mig/server/__init__.py @@ -3,8 +3,8 @@ # # --- BEGIN_HEADER --- # -# __init__ - package marker -# Copyright (C) 2003-2020 The MiG Project lead by Brian Vinter +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,15 +19,16 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # """This file is needed to tell python that this dir is a package -so that other modules can call, say, import mig.server.jobscriptgenerator -Please refer to http://www.network-theory.co.uk/docs/pytut/tut_51.html +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages and https://www.python.org/dev/peps/pep-0008/#imports for details diff --git a/mig/shared/__init__.py b/mig/shared/__init__.py index 8645c4ef9..b3beb5b80 100644 --- a/mig/shared/__init__.py +++ b/mig/shared/__init__.py @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # # --- BEGIN_HEADER --- # -# __init__ - [insert a few words of module description on this line] -# Copyright (C) 2003-2009 The MiG Project lead by Brian Vinter +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,15 +19,18 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # """This file is needed to tell python that this dir is a package -so that other modules can call, say, import shared.editing -Please refer to http://www.network-theory.co.uk/docs/pytut/tut_51.html +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages +and +https://www.python.org/dev/peps/pep-0008/#imports for details """ diff --git a/mig/shared/functionality/__init__.py b/mig/shared/functionality/__init__.py index c781e6307..b3beb5b80 100644 --- a/mig/shared/functionality/__init__.py +++ b/mig/shared/functionality/__init__.py @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # # --- BEGIN_HEADER --- # -# __init__ - [insert a few words of module description on this line] -# Copyright (C) 2003-2009 The MiG Project lead by Brian Vinter +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,13 +19,22 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # -# This file is needed to tell python that this dir is a package -# so that other modules can call, say, import shared.editing -# Please refer to http://www.network-theory.co.uk/docs/pytut/tut_51.html -# for details. +"""This file is needed to tell python that this dir is a package +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages +and +https://www.python.org/dev/peps/pep-0008/#imports +for details +""" + +__dummy = True + +# above line is only to make python tidy behave and not +# move module doc string inside header diff --git a/mig/shared/gdp/__init__.py b/mig/shared/gdp/__init__.py index 796bf9d3e..b3beb5b80 100644 --- a/mig/shared/gdp/__init__.py +++ b/mig/shared/gdp/__init__.py @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # # --- BEGIN_HEADER --- # -# __init__ - [insert a few words of module description on this line] -# Copyright (C) 2010-2020 The MiG Project lead by Brian Vinter +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,16 +19,18 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # - """This file is needed to tell python that this dir is a package -so that other modules can call, say, import shared.editing -Please refer to http://www.network-theory.co.uk/docs/pytut/tut_51.html +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages +and +https://www.python.org/dev/peps/pep-0008/#imports for details """ @@ -36,4 +38,3 @@ # above line is only to make python tidy behave and not # move module doc string inside header - diff --git a/mig/shared/griddaemons/__init__.py b/mig/shared/griddaemons/__init__.py index 13c5918bb..b3beb5b80 100644 --- a/mig/shared/griddaemons/__init__.py +++ b/mig/shared/griddaemons/__init__.py @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # # --- BEGIN_HEADER --- # -# __init__ - [insert a few words of module description on this line] -# Copyright (C) 2010-2020 The MiG Project lead by Brian Vinter +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,15 +19,18 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # """This file is needed to tell python that this dir is a package -so that other modules can call, say, import shared.editing -Please refer to http://www.network-theory.co.uk/docs/pytut/tut_51.html +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages +and +https://www.python.org/dev/peps/pep-0008/#imports for details """ @@ -35,4 +38,3 @@ # above line is only to make python tidy behave and not # move module doc string inside header - diff --git a/mig/src/pylustrequota/pylustrequota/__init__.py b/mig/src/pylustrequota/pylustrequota/__init__.py index 77df6844c..10abf6cd7 100644 --- a/mig/src/pylustrequota/pylustrequota/__init__.py +++ b/mig/src/pylustrequota/pylustrequota/__init__.py @@ -1,10 +1,10 @@ -#!/usr/bin/python3 +#!/usr/bin/env python # -*- coding: utf-8 -*- # # --- BEGIN_HEADER --- # # __init__ - luste quota python extensions -# Copyright (C) 2003-2024 The MiG Project lead by Brian Vinter +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,8 +19,8 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # diff --git a/mig/unittest/__init__.py b/mig/unittest/__init__.py index e69de29bb..b3beb5b80 100644 --- a/mig/unittest/__init__.py +++ b/mig/unittest/__init__.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# --- BEGIN_HEADER --- +# +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH +# +# This file is part of MiG. +# +# MiG is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# MiG is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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. +# +# -- END_HEADER --- +# + +"""This file is needed to tell python that this dir is a package +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages +and +https://www.python.org/dev/peps/pep-0008/#imports +for details +""" + +__dummy = True + +# above line is only to make python tidy behave and not +# move module doc string inside header diff --git a/mig/user/__init__.py b/mig/user/__init__.py index 4de42af13..b3beb5b80 100644 --- a/mig/user/__init__.py +++ b/mig/user/__init__.py @@ -3,8 +3,8 @@ # # --- BEGIN_HEADER --- # -# __init__ - package marker -# Copyright (C) 2003-2021 The MiG Project lead by Brian Vinter +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,15 +19,16 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # """This file is needed to tell python that this dir is a package -so that other modules can call, say, import mig.server.jobscriptgenerator -Please refer to http://www.network-theory.co.uk/docs/pytut/tut_51.html +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages and https://www.python.org/dev/peps/pep-0008/#imports for details diff --git a/mig/user/selenium/__init__.py b/mig/user/selenium/__init__.py index 43e5c01ee..b3beb5b80 100644 --- a/mig/user/selenium/__init__.py +++ b/mig/user/selenium/__init__.py @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # # --- BEGIN_HEADER --- # -# __init__ - package marker -# Copyright (C) 2003-2021 The MiG Project lead by Brian Vinter +# __init__ - package init +# Copyright (C) 2003-2025 The MiG Project by the Science HPC Center at UCPH # # This file is part of MiG. # @@ -19,15 +19,16 @@ # GNU General Public License for more details. # # 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. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # -- END_HEADER --- # """This file is needed to tell python that this dir is a package -so that other modules can call, say, import mig.server.jobscriptgenerator -Please refer to http://www.network-theory.co.uk/docs/pytut/tut_51.html +so that all modules can call, say, import mig.shared.base +Please refer e.g. to +https://docs.python.org/3/tutorial/modules.html#packages and https://www.python.org/dev/peps/pep-0008/#imports for details diff --git a/sbin/README b/sbin/README new file mode 100644 index 000000000..427a6d7e0 --- /dev/null +++ b/sbin/README @@ -0,0 +1,23 @@ += Modernization and Clean Up = +We are cleaning up and moving various daemons into a more logical location and +will as a start just link to the existing paths in this folder so that one can +use them as +/path/to/sbin/X +Long term we will likely move them there instead and perhaps only preserve +symlinks to still support the original paths for a while. + +Some daemons may still expect certain relative paths to e.g. the MiGserver.conf +file but you can always override it with something like: +MIG_CONF=/path/to/my/MiGserver.conf /path/to/sbin/grid_janitor + +The clean up also means that any code placed here MUST comply with the project +style guides, be lint clean, documented and have decent unit test coverage. + +You may want to use autopep8, pylint, flake8, ruff or 'make lint' targets once +available to help verify. +The black code formatter and isort may also come in handy. To apply them on +the code in $TARGET file please run: +black --line-length=80 $TARGET +isort --line-length=80 -m=HANGING_INDENT $TARGET +in that order on code files to preserve our existing hanging indent imports +instead of the exotic black import style with parentheses. diff --git a/sbin/chksidroot.py b/sbin/chksidroot.py new file mode 120000 index 000000000..45863bed6 --- /dev/null +++ b/sbin/chksidroot.py @@ -0,0 +1 @@ +../mig/server/chksidroot.py \ No newline at end of file diff --git a/sbin/chkuserroot.py b/sbin/chkuserroot.py new file mode 120000 index 000000000..13e9004e8 --- /dev/null +++ b/sbin/chkuserroot.py @@ -0,0 +1 @@ +../mig/server/chkuserroot.py \ No newline at end of file diff --git a/sbin/grid_cron.py b/sbin/grid_cron.py new file mode 120000 index 000000000..74d0ac119 --- /dev/null +++ b/sbin/grid_cron.py @@ -0,0 +1 @@ +../mig/server/grid_cron.py \ No newline at end of file diff --git a/sbin/grid_events.py b/sbin/grid_events.py new file mode 120000 index 000000000..2927548fc --- /dev/null +++ b/sbin/grid_events.py @@ -0,0 +1 @@ +../mig/server/grid_events.py \ No newline at end of file diff --git a/sbin/grid_ftps.py b/sbin/grid_ftps.py new file mode 120000 index 000000000..347c135cb --- /dev/null +++ b/sbin/grid_ftps.py @@ -0,0 +1 @@ +../mig/server/grid_ftps.py \ No newline at end of file diff --git a/sbin/grid_imnotify.py b/sbin/grid_imnotify.py new file mode 120000 index 000000000..bd76ec440 --- /dev/null +++ b/sbin/grid_imnotify.py @@ -0,0 +1 @@ +../mig/server/grid_imnotify.py \ No newline at end of file diff --git a/sbin/grid_imnotify_stdout.py b/sbin/grid_imnotify_stdout.py new file mode 120000 index 000000000..cd05147ff --- /dev/null +++ b/sbin/grid_imnotify_stdout.py @@ -0,0 +1 @@ +../mig/server/grid_imnotify_stdout.py \ No newline at end of file diff --git a/sbin/grid_monitor.py b/sbin/grid_monitor.py new file mode 120000 index 000000000..6857453ed --- /dev/null +++ b/sbin/grid_monitor.py @@ -0,0 +1 @@ +../mig/server/grid_monitor.py \ No newline at end of file diff --git a/sbin/grid_notify.py b/sbin/grid_notify.py new file mode 120000 index 000000000..593d141fd --- /dev/null +++ b/sbin/grid_notify.py @@ -0,0 +1 @@ +../mig/server/grid_notify.py \ No newline at end of file diff --git a/sbin/grid_openid.py b/sbin/grid_openid.py new file mode 120000 index 000000000..99e03e106 --- /dev/null +++ b/sbin/grid_openid.py @@ -0,0 +1 @@ +../mig/server/grid_openid.py \ No newline at end of file diff --git a/sbin/grid_script.py b/sbin/grid_script.py new file mode 120000 index 000000000..fed79e14e --- /dev/null +++ b/sbin/grid_script.py @@ -0,0 +1 @@ +../mig/server/grid_script.py \ No newline at end of file diff --git a/sbin/grid_sftp.py b/sbin/grid_sftp.py new file mode 120000 index 000000000..4cbdcf1bf --- /dev/null +++ b/sbin/grid_sftp.py @@ -0,0 +1 @@ +../mig/server/grid_sftp.py \ No newline at end of file diff --git a/sbin/grid_sshmux.py b/sbin/grid_sshmux.py new file mode 120000 index 000000000..75a983b9c --- /dev/null +++ b/sbin/grid_sshmux.py @@ -0,0 +1 @@ +../mig/server/grid_sshmux.py \ No newline at end of file diff --git a/sbin/grid_transfers.py b/sbin/grid_transfers.py new file mode 120000 index 000000000..820796ad2 --- /dev/null +++ b/sbin/grid_transfers.py @@ -0,0 +1 @@ +../mig/server/grid_transfers.py \ No newline at end of file diff --git a/sbin/grid_vmproxy.py b/sbin/grid_vmproxy.py new file mode 120000 index 000000000..49adb2ccf --- /dev/null +++ b/sbin/grid_vmproxy.py @@ -0,0 +1 @@ +../mig/server/grid_vmproxy.py \ No newline at end of file diff --git a/sbin/grid_webdavs.py b/sbin/grid_webdavs.py new file mode 120000 index 000000000..4cf14275d --- /dev/null +++ b/sbin/grid_webdavs.py @@ -0,0 +1 @@ +../mig/server/grid_webdavs.py \ No newline at end of file diff --git a/sbin/sftp_subsys.py b/sbin/sftp_subsys.py new file mode 120000 index 000000000..4b505524b --- /dev/null +++ b/sbin/sftp_subsys.py @@ -0,0 +1 @@ +../mig/server/sftp_subsys.py \ No newline at end of file