Created
November 17, 2017 17:50
-
-
Save j00bar/ae3408a0f49fa1ac71fd266d51340e07 to your computer and use it in GitHub Desktop.
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
diff --git a/container/docker/engine.py b/container/docker/engine.py | |
index 1b6ebea..486781d 100644 | |
--- a/container/docker/engine.py | |
+++ b/container/docker/engine.py | |
@@ -318,16 +318,24 @@ class Engine(BaseEngine, DockerSecretsMixin): | |
pswd_file = params.get('vault_password_file') or config.get('settings', {}).get('vault_password_file') | |
if pswd_file: | |
pswd_file_path = os.path.normpath(os.path.abspath(os.path.expanduser(pswd_file))) | |
- volumes[pswd_file_path] = { | |
- 'bind': pswd_file_path, | |
- 'mode': 'ro' | |
- } | |
- params['vault_password_file'] = pswd_file_path | |
+ if not os.path.exists(pswd_file_path): | |
+ logger.warning(u'Vault file %s specified but does not exist. Ignoring it.', | |
+ pswd_file_path) | |
+ else: | |
+ volumes[pswd_file_path] = { | |
+ 'bind': pswd_file_path, | |
+ 'mode': 'ro' | |
+ } | |
+ params['vault_password_file'] = pswd_file_path | |
vaults = params.get('vault_files') or config.get('settings', {}).get('vault_files') | |
if vaults: | |
vault_paths = [os.path.normpath(os.path.abspath(os.path.expanduser(v))) for v in vaults] | |
for vault_path in vault_paths: | |
+ if not os.path.exists(vault_path): | |
+ logger.warning(u'Vault file %s specified but does not exist. Ignoring it.', | |
+ vault_path) | |
+ continue | |
volumes[vault_path] = { | |
'bind': vault_path, | |
'mode': 'ro' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment