Skip to content

Commit

Permalink
Merge pull request #118 from lfu/credential_in_service_dialog_1452557
Browse files Browse the repository at this point in the history
OrderAnsiblePlaybook method should collect machine credential.
(cherry picked from commit eae08b4)

https://bugzilla.redhat.com/show_bug.cgi?id=1460293
  • Loading branch information
gmcculloug authored and simaishi committed Jun 9, 2017
1 parent c8f7604 commit 6c87b04
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ def initialize(handle = $evm)
end

def main
request = @handle.create_service_provision_request(service_template, extra_vars.merge(:hosts => hosts))
request = @handle.create_service_provision_request(
service_template,
extra_vars.merge(:credential => machine_credential, :hosts => hosts)
)
@handle.log(:info, "Submitted provision request #{request.id} for service template #{service_template_name}")
end

Expand Down Expand Up @@ -73,6 +76,10 @@ def service_template_name
end
@handle.root['service_template_name']
end

def machine_credential
@handle.root['dialog_credential']
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@

context "with no host" do
let(:extra_vars) do
{ :hosts => nil,
{ :credential => nil,
:hosts => nil,
'param_var1' => 'A',
'param_var2' => 'B' }
end
Expand Down Expand Up @@ -72,6 +73,47 @@
end
end

context "with no machine credential" do
let(:attributes) do
{ 'service_template_name' => svc_service_template.name,
'dialog_param_var1' => 'A',
'dialog_param_var2' => 'B',
'hosts' => 'vmdb_object',
'vmdb_object_type' => 'vm',
'vm' => svc_vm }
end

let(:extra_vars) do
{ :credential => nil,
:hosts => ip1,
'param_var1' => 'A',
'param_var2' => 'B' }
end

it_behaves_like "order playbook"
end

context "with machine credential" do
let(:attributes) do
{ 'service_template_name' => svc_service_template.name,
'dialog_param_var1' => 'A',
'dialog_param_var2' => 'B',
'dialog_credential' => '12',
'hosts' => 'vmdb_object',
'vmdb_object_type' => 'vm',
'vm' => svc_vm }
end

let(:extra_vars) do
{ :credential => '12',
:hosts => ip1,
'param_var1' => 'A',
'param_var2' => 'B' }
end

it_behaves_like "order playbook"
end

context "with vm host" do
let(:attributes) do
{ 'service_template_name' => svc_service_template.name,
Expand All @@ -83,7 +125,8 @@
end

let(:extra_vars) do
{ :hosts => ip1,
{ :credential => nil,
:hosts => ip1,
'param_var1' => 'A',
'param_var2' => 'B' }
end
Expand Down

0 comments on commit 6c87b04

Please sign in to comment.