core: cleanup config dir/file handling #666
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
creating/guessing config dirs and config files has been quite wild (and not always consistent) throughout shng, and not all methods were prepared to honor extern_conf_dir or config_etc.
get_config_dir(config)
get_config_file(basename)
both use existing methods or variables and create a single centralized point to access shng's config dirs and files (no more accessing
sh._etc_dir
oros.path.join
-ing chains, mostly)exceptions are
sh.get_basedir
andsh.get_confdir
(for extern_conf_dir) as I see these to be special cases. They could be adjusted quite easily, thoughRunning different setups and tests all went smoothly, threw/logged no errors and functioned as intended, so no obvious errors
All "legacy" methods and vars are still available, so not using the new methods will still function (non-breaking change); we might designate the old methods deprecated at some later time.
I intend to merge this soon; though non-breaking, I offer the PR up for testing on other setups beforehand.