Skip to content
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

Assigning priority weight on values to set to variables #186

Open
xdelaruelle opened this issue Aug 19, 2018 · 0 comments
Open

Assigning priority weight on values to set to variables #186

xdelaruelle opened this issue Aug 19, 2018 · 0 comments

Comments

@xdelaruelle
Copy link
Member

xdelaruelle commented Aug 19, 2018

Coming from the need to make a value persist on a variable that could be set from multiple modulefiles.

Priority weight is a solution often used when a given "stuff" can be obtained from multiple providers. Priority weight helps to select the primary provider. This solution is used for instance when dealing with package repositories to configure the repository that has the precedence over everything else when installing a system.

Applied to an environment variable domain, priority weight could help to determine what variable value to retain among multiple possibilities.

When using setenv command, a --priority argument could be added to assign a priority weight to the value set.

  • Values with no specific priority weight set owns a default priority weight (default weight value to be defined)
  • For two values with same priority weight, lastly set will take the high ground
  • Top priority value is kept if new assignment has a lesser priority.
  • When top priority value is unset, variable is set to the newly top priority value if any (which means lesser-priority values are stacked in the environment to get able to get set to the variable if top priority is unloaded)
setenv --priority 100 VAR val1
setenv VAR val2

In this example, resulting VAR equals val1.

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

No branches or pull requests

1 participant