Skip to content

Conversation

@kcgthb
Copy link
Contributor

@kcgthb kcgthb commented Aug 3, 2022

Introduce $CLUSTERSHELL_CFGDIR as an alternate location for configuration files.

This is basically a revisit of #191. This original issue led to #111, which allows per-user configuration file overrides, but doesn't provide a way to define system-wide configuration files (not per-user), which are not stored in /etc.

The use case is a multi-node cluster, where ClusterShell could be provided as a user-facing tool, installed on a shared file system (like a NFS mount point), and not as a local package on each node. In that case, providing system defaults for all users would requiring distributing configuration files on each and every of the cluster node's local /etc/ directory. A more flexible approach would be to define an environment variable (the proposed $CLUSTERSHELL_CFGDIR) to point to the global configuration directory, which could be co-located with the shared ClusterShell installation.

When $CLUSTERSHELL_CFGDIR is not defined, the default /etc/clustershell is used as a fallback to keep compatibility with existing configurations.

This PR:

  • updates lib/ClusterShell/Defaults.py
  • updates (text) documentation files in doc/
  • adds a test in tests/CLIConfigTest.py

configuration files. Keep the default `/etc/clustershell` when the
environment variable is not defined.
@thiell thiell self-requested a review August 3, 2022 21:15
@thiell thiell added this to the 1.9 milestone Aug 3, 2022
@thiell thiell requested a review from degremont August 6, 2022 00:03
Copy link
Collaborator

@degremont degremont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just ensure the new variable name matches other possible variables we already support, if they exist. (CLUSTERSHELL_ prefix).

@kcgthb
Copy link
Contributor Author

kcgthb commented Aug 8, 2022

Just ensure the new variable name matches other possible variables we already support, if they exist. (CLUSTERSHELL_ prefix).

Yes. The only other environment variables I could find are the CLUSTERSHELL_GW_* env vars, so we should be god.
https://github.com/cea-hpc/clustershell/blob/master/lib/ClusterShell/Worker/Tree.py#L179-L182

@thiell thiell merged commit ac542f6 into cea-hpc:master Aug 8, 2022
@kcgthb kcgthb deleted the conf_dir branch August 8, 2022 18:02
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

Successfully merging this pull request may close these issues.

3 participants