Skip to content
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

Schema are loaded strictly based from the current directory #6

Open
alexander-bauer opened this issue Nov 27, 2019 · 1 comment
Open

Comments

@alexander-bauer
Copy link

This affects the current master of this repository, as well as my pull request (#3). Using config push against a UCSM instance triggers a function that tries to load schema/ucs/ucsm/master.json relative to the current directory. This means that it must be run from the repository root (or the package root, in my branch).

The relevant line is

        json_file = open("schema/ucs/ucsm/master.json")

@vesposito is it reasonable to assume that schemas could be packaged with EasyUCS and not change without package updates, or is it necessary to support that users could retrieve schemas and store them somewhere that EasyUCS would subsequently use? Would it be sensible to add an optional --schema flag that is a path to a "schema root", that defaults to the one distributed with EasyUCS?

alexander-bauer added a commit to alexander-bauer/easyucs that referenced this issue Nov 27, 2019
This ensures that the `easyucs/schema/` directory is included as-is and
installed within the package root. This is necessary to address issue vesposito#6.
alexander-bauer added a commit to alexander-bauer/easyucs that referenced this issue Dec 2, 2019
This makes it so that all config schemas are loaded from
`schema/ucs/<devicetype>/master.json` relative to the `EASYUCS_ROOT`,
defined as the EasyUCS Python package root.

This resolves issue vesposito#6, though it does not add an option for specifying
custom schema paths.
@vesposito
Copy link
Owner

Yes, we can assume that schemas are packaged with EasyUCS and not change without package updates. They are intimately linked to the features EasyUCS support, so being able to modify/update them without modifying the EasyUCS engine would not make much sense IMHO.
So adding an optional --schema flag should not be very useful and would complicate things for regular users.

I think loading the schemas from a relative path to the EASYUCS_ROOT is a good idea and should be a good fix for this issue.

Maybe this issue should be fixed in a specific pull request, separate from your "pip package management" modifications?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants