-
Notifications
You must be signed in to change notification settings - Fork 900
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 orchestration stack targeted refresh method #15936
Merged
agrare
merged 2 commits into
ManageIQ:master
from
Ladas:add_targeted_refresh_to_orchestration_stack
Sep 7, 2017
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,4 +139,34 @@ def raw_exists? | |
rescue MiqException::MiqOrchestrationStackNotExistError | ||
false | ||
end | ||
|
||
def refresh_ems | ||
self.class.refresh_ems(ext_management_system.id, ems_ref) | ||
end | ||
|
||
def self.refresh_ems(manager_id, manager_ref) | ||
manager = ExtManagementSystem.find_by(:id => manager_id) | ||
|
||
unless manager | ||
raise _("No %{table} defined") % {:table => ui_lookup(:table => "ext_management_systems")} | ||
end | ||
unless manager.has_credentials? | ||
raise _("No %{table} credentials defined") % {:table => ui_lookup(:table => "ext_management_systems")} | ||
end | ||
unless manager.authentication_status_ok? | ||
raise _("%{table} failed last authentication check") % {:table => ui_lookup(:table => "ext_management_systems")} | ||
end | ||
|
||
manager_settings = Settings.ems_refresh[manager.class.ems_type] | ||
if manager_settings[:inventory_object_refresh] && manager_settings[:allow_targeted_refresh] | ||
# Queue new targeted refresh if allowed | ||
orchestration_stack_target = ManagerRefresh::Target.new(:manager => manager, | ||
:association => :orchestration_stacks, | ||
:manager_ref => {:ems_ref => manager_ref}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Much better than |
||
EmsRefresh.queue_refresh(orchestration_stack_target) | ||
else | ||
# Otherwise queue a full refresh | ||
EmsRefresh.queue_refresh(manager) | ||
end | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should move these conditions to a common method, the same code pattern is in
ext_management_system
,host
, and two places invm_or_template
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, I plan to extract it