-
Notifications
You must be signed in to change notification settings - Fork 358
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
Allow pausing/resuming foreman and ansible tower providers #5173
Allow pausing/resuming foreman and ansible tower providers #5173
Conversation
@skateman Cannot apply the following labels because they are not recognized: providers/ansible_tower, providers/foreman |
@@ -189,6 +189,18 @@ def provider_active_tree? | |||
|
|||
private | |||
|
|||
def provider_foreman_pause | |||
@record = find_record(ExtManagementSystem, params[:id]) | |||
@record.pause! # TODO: reload toolbar button enablement after the pause |
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.
@martinpovolny I need your help about this, if it is even possible and if not, how else should I do this?
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 need to queue it. There should be plenty of examples using initiate_wait_for_task
;).
EDIT: looks like I was wrong in this case, sorry :)
f73e9ad
to
82509f2
Compare
@@ -8,6 +8,7 @@ class AutomationManagerController < ApplicationController | |||
include Mixins::GenericSessionMixin | |||
include Mixins::ManagerControllerMixin | |||
include Mixins::ExplorerPresenterMixin | |||
include EmsCommon |
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.
This one frightens me. EmsCommon
is a hydra. I am more for splitting it and cleaning up rather then adding it to more places.
app/controllers/ems_common.rb
Outdated
if defined?(textual_group_list) | ||
helper_method :textual_group_list | ||
private :textual_group_list | ||
end |
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.
This is it. You are adding exception to a stuff that is included into far too many places :-(
My red light is on.
@@ -8,6 +8,7 @@ class ProviderForemanController < ApplicationController | |||
include Mixins::GenericSessionMixin | |||
include Mixins::ManagerControllerMixin | |||
include Mixins::ExplorerPresenterMixin | |||
include EmsCommon |
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.
auch
# end | ||
|
||
# provider.try(:enabled?) == false | ||
# end |
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.
forgot to remove this?
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.
yup
82509f2
to
a8434f1
Compare
Okay @martinpovolny I'll move around and split up the EmsCommon, extract the pause/resume into a submodule and load only that wen it is possible. @miq-bot add_label wip |
adc76b0
to
2b12a65
Compare
bee6095
to
f5d5c3a
Compare
@slemrmartin can you please test this? |
@martinpovolny I hope you can reset your red lights, this should be okay now. |
0f86afd
to
6b14c5a
Compare
Checked commits skateman/manageiq-ui-classic@c48d637~...6b14c5a with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 app/controllers/mixins/ems_common.rb
app/controllers/mixins/ems_common/angular.rb
app/controllers/mixins/ems_common/core.rb
app/controllers/mixins/ems_common/pause_resume.rb
app/helpers/application_helper/toolbar/automation_manager_provider_center.rb
app/helpers/application_helper/toolbar/automation_manager_providers_center.rb
app/helpers/application_helper/toolbar/configuration_manager_provider_center.rb
app/helpers/application_helper/toolbar/configuration_manager_providers_center.rb
|
@skateman |
@skateman zone's update of EMS by provider fixed in ManageIQ/manageiq-providers-ansible_tower#155 |
@slemrmartin after your provider fix, does it work as it should? |
@skateman yes, now waiting for review |
@miq-bot rm_label pending core |
|
||
return if emss.empty? | ||
|
||
if task == "destroy" |
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.
10 ... 28 should be a new method
:product => Vmdb::Appliance.PRODUCT_NAME, | ||
:model => ui_lookup(:table => table_name), | ||
:models => ui_lookup(:tables => table_name)}) if @flash_array.nil? | ||
elsif task == "pause_ems" || task == "resume_ems" |
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.
28 ... 43 should be a new 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.
Yes, it should be 😉 but definitely not in this PR, if you look at the commits, this is just reorganizing some pieces of code, not inventing anything new.
ems.pause! if action == "pause" | ||
ems.resume! if action == "resume" | ||
end | ||
else |
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.
43 .. 62 should be a new 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.
Same as above
@@ -1352,4 +1352,47 @@ def controller | |||
expect(calculate_toolbars).to include("center_tb" => "container_projects_center") | |||
end | |||
end | |||
|
|||
describe '#provider_paused?' 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.
So there's test coverage for the new method.
Do you think that is sufficient for such a big 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.
As the size of the PR comes from cut&paste, I don't think this is such a big PR...
@martinpovolny your questions have been answered, can you please merge this? |
…mixin) this was moved to mixins/ems_common/angular.rb in ManageIQ#5173 the file is dead now, removing
First I split up the
EmsCommon
a little and reorganized it into submodules, so the pause/resume can included into the Foreman/Ansible code separately. After this I was able to add the actions intoX_BUTTON_ALLOWED_ACTIONS
and then define the pause/resume methods in the controllers.If a provider is disabled, it shows for every its child a warning:
Depends on: ManageIQ/manageiq#18375
Parent issue: ManageIQ/manageiq#17489
@miq-bot add_label hammer/no, providers/ansible_tower, providers/foreman, pending core
@miq-bot add_reviewer @martinpovolny
@miq-bot add_reviewer @himdel
@miq-bot add_reviewer @mzazrivec