-
Notifications
You must be signed in to change notification settings - Fork 897
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
Add more ConversionHost validations #18264
Conversation
@@ -38,7 +47,7 @@ def source_transport_method | |||
def ipaddress(family = 'ipv4') | |||
return address if address && IPAddr.new(address).send("#{family}?") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now address
is enforced to be present
and in the format of IP and coming from the resource.ipaddresses
, do we still need this ipaddress
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, but let's refactor in a separate PR. :)
…h changes to ConversionHost.
…d update service template specs.
Checked commits https://github.com/djberg96/manageiq/compare/58bc0e469ba91e6448e3db42d6e95938097cc9e4~...a519f75360034e13d064ac0ab5d6ff78b9ee143a with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 app/models/conversion_host.rb
spec/models/service_template_transformation_plan_request_spec.rb
spec/models/service_template_transformation_plan_task_spec.rb
|
As I was doing some general testing with various POST operations with the REST API for conversion hosts, I realized there were almost no validations on the model. This PR adds some validations to a few columns, specifically the following:
name
- must be presentresource_type
- must be present and "Vm" or "Host"resource_id
- must be presentaddress
- must be present, unique, and be a valid IP addressI'm not sure about the uniqueness constraint on the
address
field and/or if there are any other validations that we would like to see added, so a WIP for now.