Commit Graph

5666 Commits

Author SHA1 Message Date
Xavier Delaruelle
a8d49bf3e8 install: add check_and_get_package_value in configure 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
48cb4884d5 install: add check_and_get_package_value_list in configure 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
0a9f76979f Add getConfList helper procedure 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
7200e01845 Change all_eval event into auto_eval
Change the all_eval event into auto_eval, an event dedicated to
automatically triggered evaluations. This way no event name surrounds
multiple events.
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
d502e05010 Rename req_* events into requested_* for clarity 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
9a01871d09 Log req_eval and all_eval events 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
70ecd34698 Add requested argument to execute-modulefile
Update execute-modulefile procedure to add requested argument. This
piece of information tells if the evaluation has been requested by user
or if it is an automatically triggered evaluation.

Internal evaluation (refresh, scan and whatis) are considered auto
evaluations.
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
ebc21a40b6 Log req_cmd event
Record command (module or ml) requested by user in log (command name and
its arguments).
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
d27764a9ed Add ability to send message to log during modfile eval
Update "puts" command available during modulefile evaluation context to
be able to send text to the log system. Use "log" channel string to
direct text to the logging mechanism.
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
864693aea0 Add helper procedures to log events
An event is effectively logged if it is defined in the logged_events
configuration option. The "all_eval" value matches both "req_eval" and
"all_eval" events.
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
972f455345 ts: adapt existing tests for logfd/logging new states 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
dc482644a0 Log messages at end of modulecmd processing
Create logfd and logging states to manage respectively logger pipe file
descriptor and log enablement. Logging is disabled is logger command is
an empty string or if there is no message to log.

Logs are sent during the termination phase of the modulecmd process.
Logger pipe is started for the duration of the flush operation only.
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
9bea136e5c rpm: requires util-linux-core for log feature 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
2d6cfa25a8 Make logged_events/logger config options lockable 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
d5dfe6caaa doc: desc. logged_events config in man/changes 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
5ebbebe2b5 doc: desc. MODULES_LOGGED_EVENTS in man/changes 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
99552f56ef doc: desc --with-logged-events in INSTALL 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
2f817cdede ts: test logged_events config option 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
256f08bec8 init: add logged_events config to completion script 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
f086234448 install: add --with-logged-events configure option
Introduce the --with-logged-events configure option to choose at
installation time the default list of events to log. Default is ''.
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
10fbeb575e Add logged_events configuration option
Add logged_events configuration option that defines the kind of events
to log. Nothing is logged by default. When configuration is modified it
sets the MODULES_LOGGED_EVENTS environment variable.
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
d9c31bcbbc ts: test logger config option 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
9dc985c88a doc: desc. MODULES_LOGGER in man/changes 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
2093b72241 doc: desc. logger config in man/changes 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
9569aebcfe doc: desc --with-logger{,-opts} in INSTALL 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
45270de214 init: add logger config to completion script 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
8d44da1b3e install: add --with-logger{,-opts} configure options
Introduce the --with-logger and --with-logger-opts configure options to
choose at installation time the default logger command and its options
to use to log information. Default logger is 'logger' and its default
options are '-t modules'.
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
d910e48287 Add logger configuration option
Add logger configuration option that defines the command to execute to
log some information about module evaluations. Set to "logger -t
modules" by default. When configuration is modified it sets the
MODULES_LOGGER environment variable.
2024-06-13 04:55:13 +02:00
Xavier Delaruelle
6f0686da1a cirrus: add lsb-release package to one Ubuntu test case 2024-06-13 04:55:13 +02:00
Xavier Delaruelle
6f1a32a7e5 ts: add tests for lsb-release modulefile command 2024-06-13 04:55:12 +02:00
Xavier Delaruelle
31401de76e doc: desc. lsb-release command in NEWS/man/changes 2024-06-12 07:08:53 +02:00
Xavier Delaruelle
93eb1f7b7d ts: adapt existing tests after addition of lsb_* states 2024-06-12 07:08:53 +02:00
Xavier Delaruelle
6392c48fa9 Add "lsb-release" modulefile command
Add "lsb-release" modulefile command available from modulerc and
modulefile evaluation context. This command accepts a sub-command as
argument among id, description, release and codename. This new modulefile
command relies on the corresponding "lsb_*" new states, which in turns
rely on the result of the lsb_release external command.
2024-06-12 07:08:53 +02:00
Xavier Delaruelle
72d8b9bcc3 contrib: add lsb-release cmd to module-info example modulefile 2024-06-12 07:08:53 +02:00
Xavier Delaruelle
2f88a30970 vim: add lsb-release modulefile cmd 2024-06-12 07:08:53 +02:00
Xavier Delaruelle
a33803f9d5 lint: add lsb-release command to syntaxdbs
Update Nagelfar syntax databases to add new lsb modulefile command.
2024-06-12 07:08:53 +02:00
Xavier Delaruelle
33a46627f8 ts: adapt existing scan tests after new modfile addition 2024-06-12 06:43:01 +02:00
Xavier Delaruelle
3bb0a14bb1 doc: add modulepath-option design doc 2024-06-12 06:43:01 +02:00
Xavier Delaruelle
c9b0f0b4eb doc: desc. --modulepath option in NEWS 2024-06-12 06:43:01 +02:00
Xavier Delaruelle
0b2f58b9f1 doc: desc. --modulepath option in man/changes 2024-06-12 06:43:01 +02:00
Xavier Delaruelle
ea325b12b1 Add isLoadedMatchSpecificPath helper procedure 2024-06-12 06:43:01 +02:00
Xavier Delaruelle
9ec65da51f ts: add modulepath-constrained auto load tests 2024-06-12 06:43:01 +02:00
Xavier Delaruelle
817dacf4f7 Load requirement with constrained modulepath list
When auto handling mode is enabled and module requirement has to be
loaded, pass down the constrained modulepath list toward cmdModuleLoad
and getPathToModule in order to obtain resolve modulefile location
within the constrained list.

The list of modulepaths set on --modulepath prereq option is converted.
These entries are left as-is if not found in the list of enabled
modulepaths. These entries are converted into the enabled modulepaths
they match otherwise.

If required module is already loaded from a modulepath not part of
constrained list, an error is raised. This error is similar to the load
of an already loaded module with a different variant set.
2024-06-12 06:43:01 +02:00
Xavier Delaruelle
667883c2e4 ts: add first --modulepath option tests in 50/640 2024-06-12 06:43:01 +02:00
Xavier Delaruelle
5f9e298603 Ensure load{ed,ing} modules match specified modulepath
When resolving module requirement (in no-auto mode), verify the loaded
or loading modules match one of the specified modulepaths if any.

Update getLoadedMatchingName procedure to pass it specified modulepaths
then verify matching module also match one of these modulepaths.

Add isModulefileInModulepathList and getModulefileFromLoadingModule
helper procedures.
2024-06-12 06:43:01 +02:00
Xavier Delaruelle
71eb541483 Ensure eval mods match specified modulepath
Adapt isModuleEvaluated procedure to verify checked module is part of
one of the specified modulepaths, if a modulepath list is specified.
2024-06-12 06:43:01 +02:00
Xavier Delaruelle
484823941f Adapt prereq error msg if specific modulepath set
When reporting requirement issue, mention that this module requirement
has a specific modulepath defined.
2024-06-12 06:43:01 +02:00
Xavier Delaruelle
1b9322fd49 ts: adapt prereq usage msg in existing tests 2024-06-12 06:43:01 +02:00
Xavier Delaruelle
0d0f50dfb9 Introduce --modulepath option to prereq commands
Add --modulepath option to prereq, prereq-all and always-load commands.
This commit adds management of the new option.

Later commits will make this option reduce the scope of the requirement
search to the sole defined modulepaths.
2024-06-12 06:43:01 +02:00
Xavier Delaruelle
416c26a72a Record modfile when registering mod evaluation attempt 2024-06-12 06:43:01 +02:00