Expand ~ in the credentials file path - #243
Open
Pawansingh3889 (Pawansingh3889) wants to merge 1 commit into
Open
Expand ~ in the credentials file path#243Pawansingh3889 (Pawansingh3889) wants to merge 1 commit into
Pawansingh3889 (Pawansingh3889) wants to merge 1 commit into
Conversation
Closes octopus-energy#97. _load_from_file opened the secrets path directly, so a path like ~/secrets.yaml (e.g. from TENTACLIO__SECRETS_FILE) was treated as a literal ~ file and failed. Expand it with os.path.expanduser first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #97.
_load_from_filepassed the credentials path straight toopen(), so a leading~was never expanded. A path likeTENTACLIO__SECRETS_FILE=~/secrets.yamlwas therefore treated as a literal~/secrets.yamlin the working directory and raisedTentaclioFileError, even though the file existed in the user's home.Expanding with
os.path.expanduserbefore opening fixes it, matching how a shell would resolve the path. Environment-variable interpolation was already handled; this adds the home-directory case.Added a unit test that points a
~/secrets.yamlpath at a temporary home and asserts the credentials load.