-
-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Check config script: various fixes #2967
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
check_config: --info all, --secrets & --files fixes
- Loading branch information
commit 54072f7bd519811c5bfec6f25639e941754edfdf
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,9 +149,13 @@ def _env_var_yaml(loader: SafeLineLoader, | |
|
||
def _load_secret_yaml(secret_path: str) -> Dict: | ||
"""Load the secrets yaml from path.""" | ||
_LOGGER.debug('Loading %s', os.path.join(secret_path, _SECRET_YAML)) | ||
secret_path = os.path.join(secret_path, _SECRET_YAML) | ||
if secret_path in __SECRET_CACHE: | ||
return __SECRET_CACHE[secret_path] | ||
|
||
_LOGGER.debug('Loading %s', secret_path) | ||
try: | ||
secrets = load_yaml(os.path.join(secret_path, _SECRET_YAML)) | ||
secrets = load_yaml(secret_path) | ||
if 'logger' in secrets: | ||
logger = str(secrets['logger']).lower() | ||
if logger == 'debug': | ||
|
@@ -160,9 +164,11 @@ def _load_secret_yaml(secret_path: str) -> Dict: | |
_LOGGER.error("secrets.yaml: 'logger: debug' expected," | ||
" but 'logger: %s' found", logger) | ||
del secrets['logger'] | ||
return secrets | ||
except FileNotFoundError: | ||
secrets = {} | ||
return {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unneeded return |
||
__SECRET_CACHE[secret_path] = secrets | ||
return secrets | ||
|
||
|
||
# pylint: disable=protected-access | ||
|
@@ -171,8 +177,8 @@ def _secret_yaml(loader: SafeLineLoader, | |
"""Load secrets and embed it into the configuration YAML.""" | ||
secret_path = os.path.dirname(loader.name) | ||
while True: | ||
secrets = __SECRET_CACHE.get(secret_path, | ||
_load_secret_yaml(secret_path)) | ||
secrets = _load_secret_yaml(secret_path) | ||
|
||
if node.value in secrets: | ||
_LOGGER.debug('Secret %s retrieved from secrets.yaml in ' | ||
'folder %s', node.value, secret_path) | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See line comment for 169