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

Allow pausing/resuming foreman and ansible tower providers #5173

Merged
merged 11 commits into from
Feb 26, 2019

Conversation

skateman
Copy link
Member

@skateman skateman commented Jan 21, 2019

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 into X_BUTTON_ALLOWED_ACTIONS and then define the pause/resume methods in the controllers.

screenshot from 2019-01-22 13-28-52
screenshot from 2019-01-22 13-29-15

If a provider is disabled, it shows for every its child a warning:
screenshot from 2019-01-22 13-29-34

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

@miq-bot
Copy link
Member

miq-bot commented Jan 21, 2019

@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
Copy link
Member Author

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?

Copy link
Contributor

@himdel himdel Jan 21, 2019

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 :)

@miq-bot miq-bot added the wip label Jan 21, 2019
@skateman skateman changed the title [WIP] Add buttons for pausing/resuming foreman and ansible tower providers [WIP] Allow pausing/resuming foreman and ansible tower providers Jan 21, 2019
@skateman skateman force-pushed the pause-resume-foreman-ansible branch 5 times, most recently from f73e9ad to 82509f2 Compare January 21, 2019 18:19
@skateman skateman changed the title [WIP] Allow pausing/resuming foreman and ansible tower providers Allow pausing/resuming foreman and ansible tower providers Jan 21, 2019
@miq-bot miq-bot removed the wip label Jan 21, 2019
@@ -8,6 +8,7 @@ class AutomationManagerController < ApplicationController
include Mixins::GenericSessionMixin
include Mixins::ManagerControllerMixin
include Mixins::ExplorerPresenterMixin
include EmsCommon
Copy link
Member

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.

if defined?(textual_group_list)
helper_method :textual_group_list
private :textual_group_list
end
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup

@skateman
Copy link
Member Author

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

@miq-bot miq-bot changed the title Allow pausing/resuming foreman and ansible tower providers [WIP] Allow pausing/resuming foreman and ansible tower providers Jan 22, 2019
@miq-bot miq-bot added the wip label Jan 22, 2019
@skateman skateman changed the title [WIP] Allow pausing/resuming foreman and ansible tower providers Allow pausing/resuming foreman and ansible tower providers Jan 22, 2019
@miq-bot miq-bot removed the wip label Jan 22, 2019
@skateman
Copy link
Member Author

@slemrmartin can you please test this?

@skateman
Copy link
Member Author

@martinpovolny I hope you can reset your red lights, this should be okay now.

@miq-bot
Copy link
Member

miq-bot commented Jan 31, 2019

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
28 files checked, 42 offenses detected

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

@slemrmartin
Copy link
Contributor

slemrmartin commented Feb 4, 2019

@skateman
Now cloud and infra managers can be updated (through edit dialog) when paused, with no side-effects, that's correct.
Ansible tower is not working in the same way, it's not possible to update, validation error is still there.
EDIT: I missed your comment, I'll check it where is zone added to update

@slemrmartin
Copy link
Contributor

@skateman zone's update of EMS by provider fixed in ManageIQ/manageiq-providers-ansible_tower#155

@skateman
Copy link
Member Author

@slemrmartin after your provider fix, does it work as it should?

@slemrmartin
Copy link
Contributor

@skateman yes, now waiting for review

@skateman
Copy link
Member Author

skateman commented Feb 20, 2019

@miq-bot rm_label pending core
@slemrmartin please retest if it works as you wanted it


return if emss.empty?

if task == "destroy"
Copy link
Member

@martinpovolny martinpovolny Feb 20, 2019

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"
Copy link
Member

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

Copy link
Member Author

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
Copy link
Member

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

Copy link
Member Author

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
Copy link
Member

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?

Copy link
Member Author

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...

@skateman
Copy link
Member Author

@martinpovolny your questions have been answered, can you please merge this?

@martinpovolny martinpovolny merged commit 8f187f3 into ManageIQ:master Feb 26, 2019
@martinpovolny martinpovolny self-assigned this Feb 26, 2019
@martinpovolny martinpovolny added this to the Sprint 106 Ending Mar 4, 2019 milestone Feb 26, 2019
@skateman skateman deleted the pause-resume-foreman-ansible branch February 26, 2019 09:13
Hyperkid123 pushed a commit to Hyperkid123/manageiq-ui-classic that referenced this pull request Jun 11, 2019
…mixin)

this was moved to mixins/ems_common/angular.rb in ManageIQ#5173

the file is dead now, removing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants