Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matthieumarrast opened this issue Jul 4, 2024 · 2 comments
Open

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

matthieumarrast opened this issue Jul 4, 2024 · 2 comments
Assignees

Comments

@matthieumarrast
Copy link
Contributor

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 matthieumarrast self-assigned this Jul 5, 2024
@matthieumarrast
Copy link
Contributor Author

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

  • have been modified in the last 24hours (1440min)
    AND
  • be more recent than file /etc/metwork.config.d/<module>/config.ini

to be taken into account.

@matthieumarrast
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant