Advertisement
Guest User

Untitled

a guest
Aug 27th, 2020
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. DEFAULT_POLICY_FILE = 'policy.yaml'
  2. OLD_POLICY_FILE = 'policy.json'
  3.  
  4.  
  5. def pick_file(policy_file):
  6. if policy_file:
  7. return policy file
  8.  
  9. if CONF.policy_file == DEFAULT_POLICY_FILE:
  10. if os.path.exists(CONF.policy_file):
  11. return CONF.policy_file
  12. elif CONF.policy_file == OLD_POLICY_FILE:
  13. # Do this smarter
  14. json_backup = CONF.policy_file.replace('yaml', 'json')
  15. if os.path.exists(json_backup):
  16. return json_backup
  17. # Same behavior if no overrides
  18. return CONF.policy_file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement