Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Validate config/cache paths #8

Open
nsg opened this issue May 3, 2019 · 0 comments
Open

Validate config/cache paths #8

nsg opened this issue May 3, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@nsg
Copy link
Member

nsg commented May 3, 2019

If --cache-path is specified but it's not a valid path, this will come to the users attention first when the cache is written. This could take a while if there are a lot of files. For example:

Got 612 FSM:s. 0 from cache. 612 freshly generated.
FSM generation took: 399.18s
Path collision check took: 145.09s
Writing FSM cache to cache/external.pkl
Traceback (most recent call last):
  File "/home/c/git/orm-rules/env/bin/orm", line 11, in <module>
    sys.exit(main())
  File "/home/c/git/orm-rules/env/lib/python3.7/site-packages/orm/__main__.py", line 78, in main
    cache_path=args.cache_path):
  File "/home/c/git/orm-rules/env/lib/python3.7/site-packages/orm/validator.py", line 48, in validate_rule_files
    return validate_rule_constraints(yml_files, cache_path=cache_path)
  File "/home/c/git/orm-rules/env/lib/python3.7/site-packages/orm/validator.py", line 573, in validate_rule_constraints
    cache_path=cache_path):
  File "/home/c/git/orm-rules/env/lib/python3.7/site-packages/orm/validator.py", line 558, in validate_constraints_rule_collision
    with open(cache_path, 'wb') as fsm_cache_file:
FileNotFoundError: [Errno 2] No such file or directory: 'cache/external.pkl'
make: *** [Makefile:38: ci-output-file] Error 1

It would be better to validate --cache-path as early as possible, for example in __main__.py.

(imported from internal issue)

@ghost ghost added the bug Something isn't working label May 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant