Skip to content

Commit

Permalink
Fix rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed Jan 17, 2019
1 parent 0df58e8 commit f1b6080
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
11 changes: 7 additions & 4 deletions app/models/service_orchestration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def orchestration_stack_status
def deploy_orchestration_stack
creation_options = stack_options
@orchestration_stack = ManageIQ::Providers::CloudManager::OrchestrationStack.create_stack(
orchestration_manager, stack_name, orchestration_template, creation_options)
orchestration_manager, stack_name, orchestration_template, creation_options
)
ensure
# create options may never be saved before unless they were overridden
save_create_options
Expand Down Expand Up @@ -145,9 +146,11 @@ def pick_orchestration_template(dialog_options)
end

def save_create_options
stack_attributes = @orchestration_stack ?
@orchestration_stack.attributes.compact :
{:name => stack_name}
stack_attributes = if @orchestration_stack
@orchestration_stack.attributes.compact
else
{:name => stack_name}
end
stack_attributes.delete('id')
options.merge!(:orchestration_stack => stack_attributes,
:create_options => dup_and_process_password(stack_options))
Expand Down
21 changes: 11 additions & 10 deletions spec/models/service_orchestration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

let(:service_template) do
FactoryBot.create(:service_template_orchestration,
:orchestration_manager => manager_in_st,
:orchestration_template => template_in_st)
:orchestration_manager => manager_in_st,
:orchestration_template => template_in_st)
end

let(:dialog_options) do
Expand All @@ -27,11 +27,11 @@

let(:service) do
FactoryBot.create(:service_orchestration,
:service_template => service_template,
:orchestration_manager => manager_in_st,
:orchestration_template => template_in_st,
:evm_owner => FactoryBot.create(:user),
:miq_group => FactoryBot.create(:miq_group))
:service_template => service_template,
:orchestration_manager => manager_in_st,
:orchestration_template => template_in_st,
:evm_owner => FactoryBot.create(:user),
:miq_group => FactoryBot.create(:miq_group))
end

let(:service_with_dialog_options) do
Expand Down Expand Up @@ -93,7 +93,8 @@
describe "#stack_options" do
before do
allow_any_instance_of(ManageIQ::Providers::Amazon::CloudManager::OrchestrationServiceOptionConverter).to(
receive(:stack_create_options).and_return(dialog_options))
receive(:stack_create_options).and_return(dialog_options)
)
end

it "gets stack options set by dialog" do
Expand Down Expand Up @@ -261,8 +262,8 @@

describe '#post_provision_configure' do
before do
allow(ManageIQ::Providers::Amazon::CloudManager::OrchestrationStack).to receive(
:raw_create_stack).and_return("ems_ref")
allow(ManageIQ::Providers::Amazon::CloudManager::OrchestrationStack)
.to receive(:raw_create_stack).and_return("ems_ref")
@resulting_stack = service.deploy_orchestration_stack

service.miq_request_task = FactoryBot.create(:service_template_provision_task)
Expand Down

0 comments on commit f1b6080

Please sign in to comment.