-
Notifications
You must be signed in to change notification settings - Fork 141
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 support for Physical Servers refresh #189
Add support for Physical Servers refresh #189
Conversation
@agrare @imtayadeway Could you take a look on this PR? |
@MaysaMacedo unrecognized command 'add_lab', ignoring... Accepted commands are: add_label, assign, close_issue, move_issue, remove_label, rm_label, set_milestone |
@miq-bot add_label gaprindashvili/yes,enhancement |
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.
will also need specs, both single resource and bulk
@@ -40,6 +40,24 @@ def restart_mgmt_controller_resource(type, id, _data) | |||
change_resource_state(:restart_mgmt_controller, type, id) | |||
end | |||
|
|||
def refresh_physical_server(physical_server) |
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.
maybe move this to private section
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.
@abellotti @jntullo Thanks for your feedback, just fixed it.
1c4caaf
to
2076fac
Compare
@abellotti @jntullo Thanks for your feedback, I've updated it. |
@abellotti @jntullo Could anyone review this PR? |
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.
@MaysaMacedo this looks great! Just a few requests above. Thanks!
@@ -40,6 +40,16 @@ def restart_mgmt_controller_resource(type, id, _data) | |||
change_resource_state(:restart_mgmt_controller, type, id) | |||
end | |||
|
|||
def refresh_resource(type, id = nil, _data = nil) | |||
raise BadRequestError, "Must specify an id for refreshing a #{type} resource" unless id |
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.
Can you add a test for this condition?
@@ -40,6 +40,16 @@ def restart_mgmt_controller_resource(type, id, _data) | |||
change_resource_state(:restart_mgmt_controller, type, id) | |||
end | |||
|
|||
def refresh_resource(type, id = nil, _data = nil) |
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.
Is there a reason for the default id = nil
here? Does anything call this without the second argument?
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.
You are right. No need for this here.
|
||
describe "Physical Server refresh action" do | ||
context "with an invalid id" do | ||
it "fails to refresh a physical server" do |
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.
Nit, but it "fails..."
suggests that something is wrong....possibly "it responds with 404 Not Found" or similar?
end | ||
|
||
context "without an appropriate role" do | ||
it "fails to refresh a physical server" do |
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.
Similarly....avoid variations of it "fails...."
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.
Minor nit, but looks good! ✨
context "without an appropriate role" do | ||
it "fails to refresh a physical server" do | ||
ps = FactoryGirl.create(:physical_server) | ||
|
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.
nit - can you remove this empty line? setting up the authorization and creating the factory are both part of the setup, they can be together. Same with similar instances below.
008baed
to
49deac3
Compare
49deac3
to
b285cf8
Compare
Checked commit MaysaMacedo@b285cf8 with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 **
|
@imtayadeway @jntullo Thanks! Just updated. |
LGTM!! Thanks @MaysaMacedo for the API Enhancement!! 👍 |
Add support for Physical Servers refresh (cherry picked from commit 2311c73)
Gaprindashvili backport details:
|
This PR enables:
Related to #2547