Skip to content

Make sourcing lib.sh side-effect free

Silvio Ankermann requested to merge change/lib-side-effects into devel

Version Control Information

Source branch: change/lib-side-effects
Target branch: devel

Commits:

* Make sourcing lib.sh side-effect free

Currently, sourcing lib.sh has side effects:

1. It tries to access multiple files (eg. config.toml) and fails if they
are not present
2. It creates a file in vault/container-name (which is not even needed
in production clusters)

That's not typical behaviour for a library and makes it hard to re-use.

This commit capsules all commands that read from certain files into the
new function load_conf_vars that is now run immediately after each
import of lib.sh where the variables are needed.

It also introduces a new function load_vault_container_name that is only
run when the container name is actually needed.

Description

Feel free to add further information about your MR in this section

Closes: #


Merge Prerequisites

  • MR title (and description) are descriptive
  • Code is readable and syntactically correct
  • Code is understandable
  • Documentation has been updated, if necessary
  • Commit messages look good
  • Release note file in RST format added in latest commit

As a developer: please do not tick these boxes yourself. As a reviewer: please get yourself a hot cold beverage.

Merge request reports