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

Missing schema validation when loading registration config from file #226

Open
anmazzotti opened this issue Oct 17, 2024 · 3 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@anmazzotti
Copy link

This is related to: rancher/elemental-operator#869

I created this (incorrect) config file:

config:
  #cloud-config:
  users:
  - name: root
    passwd: root

And used the "Read from file" button on the UI when creating a new MachineRegistration. Despite the schema being invalid, the UI did not error out and still proceeded creating the registration with an empty config.

Would it be possible to validate the schema and error out instead?
In this case it would fail as MachineRegistration.spec.config.users does not exist.

@anmazzotti anmazzotti changed the title Missing schema validation when loading registration config from file. Missing schema validation when loading registration config from file Oct 17, 2024
@aalves08
Copy link
Member

@anmazzotti we don't do schema validation in UI, generally, afaik. It's a task usually handled by the backend. Probably the general Rancher backend has already a module/code to handle this, that the elemental-operator could re-use.

@aalves08 aalves08 added the enhancement New feature or request label Nov 29, 2024
@aalves08 aalves08 self-assigned this Nov 29, 2024
@anmazzotti
Copy link
Author

The schema is already invalid backend side and will fail to apply, but the "Read from file" UI button seems to behave differently, leading to an empty config instead of erroring out when creating the MachineRegistration.

@aalves08
Copy link
Member

But the "read from file" is a purely frontend action to get the contents of the file and transform it to YAML. If the content is not "transformable" I imagine that the lib used https://github.com/nodeca/js-yaml will throw some error.

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

No branches or pull requests

2 participants