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

Remove prepend_namespace #551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ def self.miq_parse_provider_category(obj, _inputs)
ATTRIBUTE_LIST.detect { |attr| provider_category = category_for_key(obj, attr) }
$miq_ae_logger.info("Setting provider_category to: #{provider_category}", :resource_id => obj.workspace.find_miq_request_id)
obj.workspace.root["ae_provider_category"] = provider_category || UNKNOWN

prepend_vendor(obj)
end

def self.miq_parse_automation_request(obj, _inputs)
Expand Down Expand Up @@ -219,16 +217,6 @@ def self.category_for_key(obj, key)
end
private_class_method :category_for_key

def self.prepend_vendor(obj)
vendor = nil
ATTRIBUTE_LIST.detect { |attr| vendor = detect_vendor(obj.workspace.root[attr], attr) }
if vendor
$miq_ae_logger.info("Setting prepend_namespace to: #{vendor}", :resource_id => obj.workspace.find_miq_request_id)
obj.workspace.prepend_namespace = vendor.downcase
end
end
private_class_method :prepend_vendor

def self.detect_vendor(src_obj, attr)
return unless src_obj

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
module MiqAeEngine
class MiqAeDomainSearch
def initialize
@prepend_namespace = nil
end

def prepend_namespace=(namespace)
@prepend_namespace = namespace.chomp('/').sub(%r{^/}, '')
$miq_ae_logger.info("Prepend namespace [#{@prepend_namespace}] during domain search")
end

def ae_user=(obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def initialize(options = {})
initialize_obj_entries
end

delegate :prepend_namespace=, :to => :@dom_search

def readonly?
@readonly
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ def delete_service_var(name)
service_object.root_service.delete_service_vars_option(name)
end

def prepend_namespace=(namespace)
@workspace.prepend_namespace = namespace
end

def instantiate(uri)
obj = @workspace.instantiate(uri, @workspace.ae_user, @workspace.current_object)
return nil if obj.nil?
Expand Down
16 changes: 0 additions & 16 deletions spec/miq_ae_domain_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,4 @@ def create_vendor_ae_methods
ns = search.get_alternate_domain_method('miqaedb', '/FRED/WILMA/OBELIX', 'FRED', 'WILMA', 'OBELIX')
expect(ns).to eq('BARNEY/FRED')
end

it "#get_alternate_domain with vendor" do
create_vendor_ae_instances
search.ae_user = user
search.prepend_namespace = "/AMAZON/"
ns = search.get_alternate_domain('miqaedb', '/TEST/PROV/ONE', 'TEST', 'PROV', 'ONE')
expect(ns).to eq('AMAZON/AMAZON/TEST')
end

it "#get_alternate_domain_method with vendor" do
create_vendor_ae_methods
search.ae_user = user
search.prepend_namespace = "/OPENSTACK/"
ns = search.get_alternate_domain_method('miqaedb', '/TEST/WILMA/OBELIX', 'TEST', 'WILMA', 'OBELIX')
expect(ns).to eq('OPENSTACK/OPENSTACK/TEST')
end
end
14 changes: 0 additions & 14 deletions spec/miq_ae_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,20 +221,6 @@ def invoke_ae
end

describe MiqAeMethodService::MiqAeService do
context "#prepend_namespace=" do
let(:options) { {} }
let(:workspace) { double("MiqAeEngine::MiqAeWorkspaceRuntime", :root => options) }
let(:miq_ae_service) { described_class.new(workspace) }
let(:ns) { "fred" }

it "set namespace" do
allow(workspace).to receive(:disable_rbac)
allow(workspace).to receive(:persist_state_hash).and_return(MiqAeEngine::StateVarHash.new)
expect(workspace).to receive(:prepend_namespace=).with(ns)

miq_ae_service.prepend_namespace = ns
end
end
context "create notifications" do
before do
NotificationType.seed
Expand Down