-
Notifications
You must be signed in to change notification settings - Fork 220
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
Fixes #6396: an error removing a DHCP record (record doesn't exist) stop... #174
Conversation
…tops the delete process for a host
[test] There's a check above in dhcp_api.rb for records that don't exist, any idea why that isn't matching? The correct response for a record that doesn't exist should be a 404, which Foreman itself handles and ignores. |
I believe this behavior is actually due to #175 (6412?) - when the host being checked is marked as 'deleted' in the dhcp data, but was originally from a different subnet than the subnet under evaluation, it is not found, and throws this error. |
@@ -113,6 +113,8 @@ def load_subnet | |||
else | |||
redirect "/dhcp/#{params[:network]}" | |||
end | |||
rescue Proxy::DHCP::InvalidRecord | |||
# Record doesn't exist, no need to do anything |
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.
I think this should log_halt 404.
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.
Hmm, would a 404 here not cause much the same issue? The foreman code parses proxy responses with this:
if response and response.code >= 200 and response.code < 300
So a 404 will still trigger the same result as the catchall 400 below.
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.
I'm expecting this to ignore it: https://github.com/theforeman/foreman/blob/develop/lib/proxy_api/dhcp.rb#L75-L77
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.
Ah true, in that case, +1 for a 404, for consistency
@greg I'll try and think one up, I only thing that occurs to me is find_record_by_hostname method to make sire it is zero or one host object, and not an array. Do you have any other suggestions?
|
@pccowboy i think we want to stub out some methods and then check that delete actually raises a Proxy::DHCP::InvalidRecord error. Something like https://github.com/theforeman/smart-proxy/blob/develop/test/tftp/tftp_test.rb#L35-L42 where we check the raise type of a piece of tftp code. Ping me on IRC if you need a hand, I'd like to get this merged :) |
[test] |
...s the delete process for a host