Guest User

Untitled

a guest
Nov 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. diff --git a/container/docker/engine.py b/container/docker/engine.py
  2. index 1b6ebea..486781d 100644
  3. --- a/container/docker/engine.py
  4. +++ b/container/docker/engine.py
  5. @@ -318,16 +318,24 @@ class Engine(BaseEngine, DockerSecretsMixin):
  6. pswd_file = params.get('vault_password_file') or config.get('settings', {}).get('vault_password_file')
  7. if pswd_file:
  8. pswd_file_path = os.path.normpath(os.path.abspath(os.path.expanduser(pswd_file)))
  9. - volumes[pswd_file_path] = {
  10. - 'bind': pswd_file_path,
  11. - 'mode': 'ro'
  12. - }
  13. - params['vault_password_file'] = pswd_file_path
  14. + if not os.path.exists(pswd_file_path):
  15. + logger.warning(u'Vault file %s specified but does not exist. Ignoring it.',
  16. + pswd_file_path)
  17. + else:
  18. + volumes[pswd_file_path] = {
  19. + 'bind': pswd_file_path,
  20. + 'mode': 'ro'
  21. + }
  22. + params['vault_password_file'] = pswd_file_path
  23.  
  24. vaults = params.get('vault_files') or config.get('settings', {}).get('vault_files')
  25. if vaults:
  26. vault_paths = [os.path.normpath(os.path.abspath(os.path.expanduser(v))) for v in vaults]
  27. for vault_path in vault_paths:
  28. + if not os.path.exists(vault_path):
  29. + logger.warning(u'Vault file %s specified but does not exist. Ignoring it.',
  30. + vault_path)
  31. + continue
  32. volumes[vault_path] = {
  33. 'bind': vault_path,
  34. 'mode': 'ro'
Add Comment
Please, Sign In to add comment