Skip to content

Commit

Permalink
Enable adding extra environment variable to site.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-ntrf committed Jul 17, 2023
1 parent 804396d commit 7b9daad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ profile::accounts:::skel_archives:
| ------------------------------------------------ | :------------ | :--------------------------------------------- | -------------------------------------------------------------------- |
| `profile::cvmfs::client::quota_limit` | Integer | Instance local cache directory soft quota (MB) | 4096 |
| `profile::cvmfs::client::initial_profile` | String | Path to shell script initializing software stack environment variables | Depends on the chosen software stack |
| `profile::cvmfs::client::extra_site_env_vars` | Hash[String, String] | Map of environment variables that will be exported before sourcing profile shell scripts. | `{ }` |
| `profile::cvmfs::client::repositories` | Array[String] | List of CVMFS repositories to mount | Depends on the chosen software stack |
| `profile::cvmfs::client::alien_cache_repositories`| Array[String] | List of CVMFS repositories that need an alien cache | `[]` |
| `profile::cvmfs::client::lmod_default_modules` | Array[String] | List of lmod default modules | Depends on the chosen software stack |
Expand Down
3 changes: 2 additions & 1 deletion site/profile/manifests/cvmfs.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Array[String] $repositories,
Array[String] $lmod_default_modules,
Array[String] $alien_cache_repositories = [],

Hash[String, String] $extra_site_env_vars = {},
) {
include consul_template
include profile::cvmfs::local_user
Expand Down Expand Up @@ -84,6 +84,7 @@
{
'lmod_default_modules' => $lmod_default_modules,
'initial_profile' => $initial_profile,
'extra_site_env_vars' => $extra_site_env_vars,
}
),
}
Expand Down
5 changes: 5 additions & 0 deletions site/profile/templates/cvmfs/z-01-site.sh.epp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

if [[ $UID -gt <%= $::uid_max %> ]]; then
export LMOD_SYSTEM_DEFAULT_MODULES="<%= $lmod_default_modules.join(' ') %>"

<% $extra_site_env_vars.each | $key, $value| { -%>
export <%= $key %>=<%= $value %>
<% } -%>

if [[ -r <%= $initial_profile %> ]]; then
source <%= $initial_profile %>
fi
Expand Down

0 comments on commit 7b9daad

Please sign in to comment.