Skip to content

config: fix SPACK_DISABLE_LOCAL_CONFIG, remove $user_config_path#27022

Merged
tgamblin merged 1 commit intodevelopfrom
bugfix/disable-local-config
Oct 28, 2021
Merged

config: fix SPACK_DISABLE_LOCAL_CONFIG, remove $user_config_path#27022
tgamblin merged 1 commit intodevelopfrom
bugfix/disable-local-config

Conversation

@tgamblin
Copy link
Copy Markdown
Member

@tgamblin tgamblin commented Oct 28, 2021

Closes #27010.

There were some loose ends left in ##26735 that cause errors when using SPACK_DISABLE_LOCAL_CONFIG.

  • Fix hard-coded ~/.spack references in install_test.py and monitor.py

Also, if SPACK_DISABLE_LOCAL_CONFIG is used, there is the issue that $user_config_path, when used in configuration files, makes no sense, because there is no user config scope.

Since we already have $user_cache_path in configuration files, and since there really shouldn't be any data stored in a configuration scope (which is what you'd configure in config.yaml/bootstrap.yaml/etc., this just removes $user_config_path.

There will always be a $user_cache_path, as Spack needs to write files, but we shouldn't rely on the existence of a particular configuration scope in the Spack code, as scopes are configurable, both in number and location.

  • Remove $user_config_path substitution.
  • Fix reference to $user_config_path in etc/spack/deaults/bootstrap.yaml to refer to $user_cache_path, which is where it was intended to be.

@tgamblin tgamblin requested review from haampie and trws October 28, 2021 18:10
@spackbot-app spackbot-app bot added defaults documentation Improvements or additions to documentation tests General test capability(ies) utilities labels Oct 28, 2021
@tgamblin
Copy link
Copy Markdown
Member Author

@mathstuf: does this fix your issue?

@tgamblin tgamblin changed the title config: fix SPACK_DISABLE_LOCAL_CONFIG remove $user_config_path config: fix SPACK_DISABLE_LOCAL_CONFIG, remove $user_config_path Oct 28, 2021
There were some loose ends left in ##26735 that cause errors when
using `SPACK_DISABLE_LOCAL_CONFIG`.

- [x] Fix hard-coded `~/.spack` references in `install_test.py` and `monitor.py`

Also, if `SPACK_DISABLE_LOCAL_CONFIG` is used, there is the issue that
`$user_config_path`, when used in configuration files, makes no sense,
because there is no user config scope.

Since we already have `$user_cache_path` in configuration files, and since there
really shouldn't be *any* data stored in a configuration scope (which is what
you'd configure in `config.yaml`/`bootstrap.yaml`/etc., this just removes
`$user_config_path`.

There will *always* be a `$user_cache_path`, as Spack needs to write files, but
we shouldn't rely on the existence of a particular configuration scope in the
Spack code, as scopes are configurable, both in number and location.

- [x] Remove `$user_config_path` substitution.
- [x] Fix reference to `$user_config_path` in `etc/spack/deaults/bootstrap.yaml`
      to refer to `$user_cache_path`, which is where it was intended to be.
@trws
Copy link
Copy Markdown
Contributor

trws commented Oct 28, 2021

I think this should do it. Am I reading correctly that this still allows the user_config_path to be set, and that will be used as the user config directory, but there's no way to name it in the config files? I mean that's probably ok, it just means we can't do things like refer to a subdirectory of it for another chunk of config or similar.

@tgamblin
Copy link
Copy Markdown
Member Author

Am I reading correctly that this still allows the user_config_path to be set, and that will be used as the user config directory, but there's no way to name it in the config files?

Yep that's correct. We don't name any other config directories and I think we shouldn't -- the way the config system is designed (for testing, in production, etc.) any config scope could go away, so I think we shouldn't refer to them. Instead, refer to $user_cache_path, which guarantees you a location for data.

@tgamblin tgamblin requested a review from becker33 October 28, 2021 18:31
@trws
Copy link
Copy Markdown
Contributor

trws commented Oct 28, 2021

Ok. Honestly I think we should actually have a data path, separate from a cache path, as well but that's a discussion for later post-0.17 PR.

@haampie
Copy link
Copy Markdown
Member

haampie commented Oct 28, 2021

I think I'm happy with this solution too, I didn't go for it because I thought some felt strongly about having the bootstrap dir shared among instances by default, whereas provider cache must be different between instances. My only hesitation is that it may be unexpected that spack writes to $spack/etc/spack, but then again, alternative one can set spack_user_[config|cache]_path (and /etc/spack is almost never set anyways), and those dirs are easy to delete. ($spack/etc/spack is not "easy" to delete, since defaults/ is a subdir that must not be removed, and $spack/etc/spack/<platform>/ should be, but you may not know <platform>).

@trws
Copy link
Copy Markdown
Contributor

trws commented Oct 28, 2021

Much as it's true it's not easy to delete, it is easy to revert it with a bit of git reset and/or git clean -df -- $spack/etc.

@tgamblin
Copy link
Copy Markdown
Member Author

We should probably one day move the "site" config scope (which I also want to rename the "spack" config scope) to a subdirectory of $spack/etc/spack.

@tgamblin tgamblin enabled auto-merge (squash) October 28, 2021 21:28
@tgamblin tgamblin merged commit a121613 into develop Oct 28, 2021
@tgamblin tgamblin deleted the bugfix/disable-local-config branch October 28, 2021 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

defaults documentation Improvements or additions to documentation tests General test capability(ies) utilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants