metwork-framework / mfext

metwork/mfext module
http://metwork-framework.org/mfext
BSD 3-Clause "New" or "Revised" License
4 stars 5 forks source link

tmp/ini_to_env_<module>.cache not refreshed #1903

Open matthieumarrast opened 5 months ago

matthieumarrast commented 5 months ago

Today during a move into production, we face an issue caused by the tmp/ini_to_env_<module>.cache which seems to not being refreshed when the config file (/etc/metwork.config.d/<module>/config.ini) is updated while the module is stopped.

So, our environement variables were not up to date.

matthieumarrast commented 5 months ago

Analysis of ini_to_env_<module>.cache usage

In script https://github.com/metwork-framework/mfext/blob/master/adm/templates/config_profile command cache_get /home/<module>/tmp/ini_to_env_<module>.cache 1440 is executed to know if a cache exists and must be used. The cache_get function (https://github.com/metwork-framework/mfext/blob/master/adm/bash_utils.sh#L74) will execute the command: find /home/<module>/tmp/ini_to_env_<module>.cache -type f -mmin -1440 -newer /etc/metwork.config.d/<module>/config.ini

So the file ini_to_env_<module>.cache must

to be taken into account.

matthieumarrast commented 5 months ago

Additional analysis

It appears some teams (I'm part of it) extract the config files (under /etc/metwork.config.d) using archives (.tar, .tar.gz, .zip) or rpm. It's a good way to extract many file in a raw. It avoids multiplicating the operations for the operator.

But while extracting the archive or rpm, the modification date of the files is kept ! so metwork can consider the cache ini_to_env_<module>.cache is newer than the config file !

Possible solution

Consider using option -m --touch while using the commande tar for extracting file.