Skip to content

Commit

Permalink
Don't restrict the zone to the embedded ansible manager zone for CRUD
Browse files Browse the repository at this point in the history
There's nothing special about the zone with the appliance that has the
embedded ansible role. If we're targeting the role we should target it
without regard for zone since it's region scoped.

If we leave embedded ansible only usable on one appliance at a time
then this is an unnecessary restriction as the manager zone is set
to the server's zone when the role is assigned.

If we add the ability to use multiple servers then this will ensure
that work is only completed in the zone where the server was assigned
the embedded ansible role most recently. Which will be a very difficult
to diagnose bug.
  • Loading branch information
carbonin committed Jul 23, 2019
1 parent f238ea1 commit 34eac12
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 21 deletions.
9 changes: 4 additions & 5 deletions app/models/manageiq/providers/embedded_ansible/crud_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ManageIQ::Providers::EmbeddedAnsible::CrudCommon
extend ActiveSupport::Concern

module ClassMethods
def queue(zone, instance_id, method_name, args, action, auth_user)
def queue(instance_id, method_name, args, action, auth_user)
task_opts = {
:action => action,
:userid => auth_user || "system"
Expand All @@ -13,8 +13,7 @@ def queue(zone, instance_id, method_name, args, action, auth_user)
:priority => MiqQueue::HIGH_PRIORITY,
:class_name => name,
:method_name => method_name,
:role => "embedded_ansible",
:zone => zone
:role => "embedded_ansible"
}
queue_opts[:instance_id] = instance_id if instance_id
MiqTask.generic_action_with_callback(task_opts, queue_opts)
Expand Down Expand Up @@ -53,7 +52,7 @@ def create_in_provider_queue(manager_id, params, auth_user = nil)
manager = parent.find(manager_id)
action = "Creating #{self::FRIENDLY_NAME}"
action << " (name=#{params[:name]})" if params[:name]
queue(manager.my_zone, nil, "create_in_provider", [manager_id, encrypt_queue_params(params)], action, auth_user)
queue(nil, "create_in_provider", [manager_id, encrypt_queue_params(params)], action, auth_user)
end

private
Expand Down Expand Up @@ -116,7 +115,7 @@ def delete_in_provider_queue(auth_user = nil)
def queue(method_name, args, action_prefix, auth_user)
action = "#{action_prefix} #{self.class::FRIENDLY_NAME}"
action << " (name=#{name})" if respond_to?(:name)
self.class.queue(manager.my_zone, id, method_name, args, action, auth_user)
self.class.queue(id, method_name, args, action, auth_user)
end

def notify(op_type, params = {}, &block)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ def files_in_repository(git_repo_dir)
:class_name => described_class.name,
:method_name => "create_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "embedded_ansible",
:zone => manager.my_zone
:role => "embedded_ansible"
)
end
end
Expand Down Expand Up @@ -176,8 +175,7 @@ def files_in_repository(git_repo_dir)
:class_name => described_class.name,
:method_name => "update_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "embedded_ansible",
:zone => manager.my_zone
:role => "embedded_ansible"
)
end
end
Expand Down Expand Up @@ -209,8 +207,7 @@ def files_in_repository(git_repo_dir)
:class_name => described_class.name,
:method_name => "delete_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "embedded_ansible",
:zone => manager.my_zone
:role => "embedded_ansible"
)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@
:class_name => described_class.name,
:method_name => "create_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "embedded_ansible",
:zone => manager.zone.name
:role => "embedded_ansible"
)
end

Expand All @@ -200,8 +199,7 @@
:class_name => described_class.name,
:method_name => "update_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "embedded_ansible",
:zone => manager.my_zone
:role => "embedded_ansible"
)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@
:class_name => credential_class.name,
:method_name => "create_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "embedded_ansible",
:zone => manager.my_zone
:role => "embedded_ansible"
)
end

Expand Down Expand Up @@ -107,8 +106,7 @@
:class_name => credential_class.name,
:method_name => "update_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "embedded_ansible",
:zone => manager.my_zone
:role => "embedded_ansible"
)
end
end
Expand All @@ -132,8 +130,7 @@
:class_name => credential_class.name,
:method_name => "delete_in_provider",
:priority => MiqQueue::HIGH_PRIORITY,
:role => "embedded_ansible",
:zone => manager.my_zone
:role => "embedded_ansible"
)
end
end
Expand Down

0 comments on commit 34eac12

Please sign in to comment.