knife-openstack 1.3.2.pre → 1.3.2.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/Rakefile +7 -28
- data/knife-openstack.gemspec +16 -16
- data/lib/chef/knife/cloud/openstack_server_create_options.rb +44 -44
- data/lib/chef/knife/cloud/openstack_service.rb +27 -31
- data/lib/chef/knife/cloud/openstack_service_options.rb +25 -26
- data/lib/chef/knife/openstack_flavor_list.rb +9 -10
- data/lib/chef/knife/openstack_floating_ip_allocate.rb +4 -4
- data/lib/chef/knife/openstack_floating_ip_associate.rb +5 -5
- data/lib/chef/knife/openstack_floating_ip_disassociate.rb +4 -4
- data/lib/chef/knife/openstack_group_list.rb +9 -11
- data/lib/chef/knife/openstack_helpers.rb +14 -2
- data/lib/chef/knife/openstack_image_list.rb +14 -15
- data/lib/chef/knife/openstack_network_list.rb +8 -9
- data/lib/chef/knife/openstack_server_create.rb +81 -84
- data/lib/chef/knife/openstack_server_delete.rb +25 -26
- data/lib/chef/knife/openstack_server_list.rb +13 -19
- data/lib/chef/knife/openstack_server_show.rb +11 -12
- data/lib/chef/knife/openstack_volume_list.rb +10 -12
- data/lib/knife-openstack/version.rb +1 -1
- data/spec/functional/flavor_list_func_spec.rb +11 -11
- data/spec/functional/floating_ip_list_func_spec.rb +11 -11
- data/spec/functional/group_list_func_spec.rb +27 -31
- data/spec/functional/image_list_func_spec.rb +14 -14
- data/spec/functional/network_list_func_spec.rb +10 -10
- data/spec/functional/server_create_func_spec.rb +23 -24
- data/spec/functional/server_delete_func_spec.rb +16 -17
- data/spec/functional/server_list_func_spec.rb +39 -39
- data/spec/functional/server_show_func_spec.rb +4 -5
- data/spec/functional/volume_list_func_spec.rb +9 -9
- data/spec/integration/cleanup.rb +8 -11
- data/spec/integration/openstack_spec.rb +377 -347
- data/spec/spec_context.rb +10 -10
- data/spec/spec_helper.rb +23 -27
- data/spec/unit/openstack_flavor_list_spec.rb +1 -1
- data/spec/unit/openstack_floating_ip_allocate_spec.rb +2 -3
- data/spec/unit/openstack_floating_ip_associate_spec.rb +2 -2
- data/spec/unit/openstack_floating_ip_disassociate_spec.rb +3 -3
- data/spec/unit/openstack_floating_ip_release_spec.rb +1 -1
- data/spec/unit/openstack_group_list_spec.rb +7 -7
- data/spec/unit/openstack_image_list_spec.rb +2 -2
- data/spec/unit/openstack_network_list_spec.rb +4 -4
- data/spec/unit/openstack_server_create_spec.rb +117 -118
- data/spec/unit/openstack_server_delete_spec.rb +4 -4
- data/spec/unit/openstack_server_list_spec.rb +2 -2
- data/spec/unit/openstack_server_show_spec.rb +6 -6
- data/spec/unit/openstack_service_spec.rb +20 -20
- data/spec/unit/openstack_volume_list_spec.rb +1 -1
- metadata +30 -2
@@ -32,37 +32,31 @@ class Chef
|
|
32
32
|
include OpenstackServiceOptions
|
33
33
|
include ServerListOptions
|
34
34
|
|
35
|
-
banner
|
35
|
+
banner 'knife openstack server list (options)'
|
36
36
|
|
37
37
|
def before_exec_command
|
38
|
-
#set columns_with_info map
|
38
|
+
# set columns_with_info map
|
39
39
|
@columns_with_info = [
|
40
|
-
{:
|
41
|
-
{:
|
42
|
-
{:
|
43
|
-
{:
|
44
|
-
{:
|
45
|
-
{:
|
46
|
-
{:
|
47
|
-
{:
|
48
|
-
{:label => 'Availability Zone', :key => 'availability_zone'}
|
40
|
+
{ label: 'Name', key: 'name' },
|
41
|
+
{ label: 'Instance ID', key: 'id' },
|
42
|
+
{ label: 'Addresses', key: 'addresses', value_callback: method(:addresses) },
|
43
|
+
{ label: 'Flavor', key: 'flavor', value_callback: method(:get_id) },
|
44
|
+
{ label: 'Image', key: 'image', value_callback: method(:get_id) },
|
45
|
+
{ label: 'Keypair', key: 'key_name' },
|
46
|
+
{ label: 'State', key: 'state' },
|
47
|
+
{ label: 'Availability Zone', key: 'availability_zone' }
|
49
48
|
]
|
50
|
-
@sort_by_field =
|
49
|
+
@sort_by_field = 'name'
|
51
50
|
super
|
52
51
|
end
|
53
52
|
|
54
|
-
def
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
def get_private_ip_address (addresses)
|
59
|
-
primary_private_ip_address(addresses)
|
53
|
+
def addresses(addresses)
|
54
|
+
instance_addresses(addresses)
|
60
55
|
end
|
61
56
|
|
62
57
|
def get_id(value)
|
63
58
|
value['id']
|
64
59
|
end
|
65
|
-
|
66
60
|
end
|
67
61
|
end
|
68
62
|
end
|
@@ -30,21 +30,20 @@ class Chef
|
|
30
30
|
include OpenstackServiceOptions
|
31
31
|
include ServerShowOptions
|
32
32
|
|
33
|
-
banner
|
33
|
+
banner 'knife openstack server show (options)'
|
34
34
|
|
35
35
|
def before_exec_command
|
36
|
-
#set columns_with_info map
|
36
|
+
# set columns_with_info map
|
37
37
|
@columns_with_info = [
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
]
|
38
|
+
{ label: 'Instance ID', key: 'id' },
|
39
|
+
{ label: 'Name', key: 'name' },
|
40
|
+
{ label: 'Addresses', key: 'addresses', value_callback: method(:instance_addresses) },
|
41
|
+
{ label: 'Flavor', key: 'flavor', value_callback: method(:get_id) },
|
42
|
+
{ label: 'Image', key: 'image', value_callback: method(:get_id) },
|
43
|
+
{ label: 'Keypair', key: 'key_name' },
|
44
|
+
{ label: 'State', key: 'state' },
|
45
|
+
{ label: 'Availability Zone', key: 'availability_zone' }
|
46
|
+
]
|
48
47
|
super
|
49
48
|
end
|
50
49
|
|
@@ -26,19 +26,17 @@ class Chef
|
|
26
26
|
class Knife
|
27
27
|
class Cloud
|
28
28
|
class OpenstackVolumeList < ResourceListCommand
|
29
|
-
|
30
|
-
|
29
|
+
include OpenstackHelpers
|
30
|
+
include OpenstackServiceOptions
|
31
31
|
|
32
|
-
banner
|
32
|
+
banner 'knife openstack volume list (options)'
|
33
33
|
|
34
34
|
def query_resource
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
raise e
|
41
|
-
end
|
35
|
+
@service.connection.volumes
|
36
|
+
rescue Excon::Errors::BadRequest => e
|
37
|
+
response = Chef::JSONCompat.from_json(e.response.body)
|
38
|
+
ui.fatal("Unknown server error (#{response['badRequest']['code']}): #{response['badRequest']['message']}")
|
39
|
+
raise e
|
42
40
|
end
|
43
41
|
|
44
42
|
def list(volumes)
|
@@ -47,14 +45,14 @@ class Chef
|
|
47
45
|
ui.color('ID', :bold),
|
48
46
|
ui.color('Status', :bold),
|
49
47
|
ui.color('Size', :bold),
|
50
|
-
ui.color('Description', :bold)
|
48
|
+
ui.color('Description', :bold)
|
51
49
|
]
|
52
50
|
begin
|
53
51
|
volumes.sort_by(&:name).each do |volume|
|
54
52
|
volume_list << volume.name
|
55
53
|
volume_list << volume.id.to_s
|
56
54
|
volume_list << volume.status
|
57
|
-
volume_list << "#{volume.size
|
55
|
+
volume_list << "#{volume.size} GB"
|
58
56
|
volume_list << volume.description
|
59
57
|
end
|
60
58
|
rescue Excon::Errors::BadRequest => e
|
@@ -22,25 +22,25 @@ require 'chef/knife/cloud/openstack_service'
|
|
22
22
|
require 'support/shared_examples_for_command'
|
23
23
|
|
24
24
|
describe Chef::Knife::Cloud::OpenstackFlavorList do
|
25
|
-
let (:instance) {Chef::Knife::Cloud::OpenstackFlavorList.new}
|
25
|
+
let (:instance) { Chef::Knife::Cloud::OpenstackFlavorList.new }
|
26
26
|
|
27
|
-
context
|
27
|
+
context 'functionality' do
|
28
28
|
before do
|
29
|
-
resources = [
|
30
|
-
|
31
|
-
|
29
|
+
resources = [TestResource.new(id: 'resource-1', name: 'm1.tiny', vcpus: '1', ram: 512, disk: 0),
|
30
|
+
TestResource.new(id: 'resource-2', name: 'm1-xlarge-bigdisk', vcpus: '8', ram: 16_384, disk: 50)
|
31
|
+
]
|
32
32
|
allow(instance).to receive(:query_resource).and_return(resources)
|
33
33
|
allow(instance).to receive(:puts)
|
34
34
|
allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
|
35
35
|
allow(instance).to receive(:validate!)
|
36
|
-
instance.config[:format] =
|
36
|
+
instance.config[:format] = 'summary'
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
40
|
-
expect(instance.ui).to receive(:list).with([
|
41
|
-
|
42
|
-
|
39
|
+
it 'lists formatted list of resources' do
|
40
|
+
expect(instance.ui).to receive(:list).with(['Name', 'ID', 'Virtual CPUs', 'RAM', 'Disk',
|
41
|
+
'm1-xlarge-bigdisk', 'resource-2', '8', '16384 MB', '50 GB',
|
42
|
+
'm1.tiny', 'resource-1', '1', '512 MB', '0 GB'], :uneven_columns_across, 5)
|
43
43
|
instance.run
|
44
44
|
end
|
45
45
|
end
|
46
|
-
end
|
46
|
+
end
|
@@ -21,27 +21,27 @@ require 'chef/knife/cloud/openstack_service'
|
|
21
21
|
require 'support/shared_examples_for_command'
|
22
22
|
|
23
23
|
describe Chef::Knife::Cloud::OpenstackFloatingIpList do
|
24
|
-
let (:instance) {Chef::Knife::Cloud::OpenstackFloatingIpList.new}
|
24
|
+
let (:instance) { Chef::Knife::Cloud::OpenstackFloatingIpList.new }
|
25
25
|
|
26
26
|
context 'functionality' do
|
27
27
|
before do
|
28
|
-
resources = [
|
29
|
-
),
|
30
|
-
|
31
|
-
)
|
32
|
-
|
28
|
+
resources = [TestResource.new('id' => 'floatingip1', 'instance_id' => 'daed9e86-4b69-4242-993a-926a39352783', 'ip' => '173.236.251.98', 'fixed_ip' => '', 'pool' => 'test-pool'
|
29
|
+
),
|
30
|
+
TestResource.new('id' => 'floatingip2', 'instance_id' => '', 'ip' => '67.205.60.122', 'fixed_ip' => '10.10.10.1', 'pool' => 'test-pool'
|
31
|
+
)
|
32
|
+
]
|
33
33
|
allow(instance).to receive(:query_resource).and_return(resources)
|
34
34
|
allow(instance).to receive(:puts)
|
35
35
|
allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
|
36
36
|
allow(instance).to receive(:validate!)
|
37
|
-
instance.config[:format] =
|
37
|
+
instance.config[:format] = 'summary'
|
38
38
|
end
|
39
39
|
|
40
|
-
it
|
40
|
+
it 'lists formatted list of resources' do
|
41
41
|
expect(instance.ui).to receive(:list).with(['ID', 'Instance ID', 'IP Address', 'Fixed IP', 'Floating IP Pool',
|
42
|
-
|
43
|
-
|
42
|
+
'floatingip1', 'daed9e86-4b69-4242-993a-926a39352783', '173.236.251.98', '', 'test-pool',
|
43
|
+
'floatingip2', '', '67.205.60.122', '10.10.10.1', 'test-pool'], :uneven_columns_across, 5)
|
44
44
|
instance.run
|
45
45
|
end
|
46
46
|
end
|
47
|
-
end
|
47
|
+
end
|
@@ -22,46 +22,42 @@ require 'chef/knife/openstack_group_list'
|
|
22
22
|
require 'chef/knife/cloud/openstack_service'
|
23
23
|
|
24
24
|
describe Chef::Knife::Cloud::OpenstackGroupList do
|
25
|
-
let (:instance) {Chef::Knife::Cloud::OpenstackGroupList.new}
|
25
|
+
let (:instance) { Chef::Knife::Cloud::OpenstackGroupList.new }
|
26
26
|
|
27
|
-
context
|
27
|
+
context 'functionality' do
|
28
28
|
before do
|
29
|
-
resources = [
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
"id" => 2
|
50
|
-
})
|
51
|
-
]
|
52
|
-
})
|
29
|
+
resources = [TestResource.new('name' => 'Unrestricted',
|
30
|
+
'description' => 'All ports open',
|
31
|
+
'security_group_rules' => [TestResource.new('from_port' => 1,
|
32
|
+
'group' => {},
|
33
|
+
'ip_protocol' => 'tcp',
|
34
|
+
'to_port' => 636,
|
35
|
+
'parent_group_id' => 14,
|
36
|
+
'ip_range' => { 'cidr' => '0.0.0.0/0' },
|
37
|
+
'id' => 1)
|
38
|
+
]),
|
39
|
+
TestResource.new('name' => 'WindowsDomain',
|
40
|
+
'description' => 'Allows common protocols useful in a Windows domain',
|
41
|
+
'security_group_rules' => [TestResource.new('from_port' => 22,
|
42
|
+
'group' => {},
|
43
|
+
'ip_protocol' => 'tcp',
|
44
|
+
'to_port' => 636,
|
45
|
+
'parent_group_id' => 14,
|
46
|
+
'ip_range' => { 'cidr' => '0.0.0.0/0' },
|
47
|
+
'id' => 2)
|
48
|
+
])
|
53
49
|
]
|
54
50
|
allow(instance).to receive(:query_resource).and_return(resources)
|
55
51
|
allow(instance).to receive(:puts)
|
56
52
|
allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
|
57
53
|
allow(instance).to receive(:validate!)
|
58
|
-
instance.config[:format] =
|
54
|
+
instance.config[:format] = 'summary'
|
59
55
|
end
|
60
56
|
|
61
|
-
it
|
62
|
-
expect(instance.ui).to receive(:list).with([
|
63
|
-
|
64
|
-
|
57
|
+
it 'lists formatted list of resources' do
|
58
|
+
expect(instance.ui).to receive(:list).with(['Name', 'Protocol', 'From', 'To', 'CIDR', 'Description',
|
59
|
+
'Unrestricted', 'tcp', '1', '636', '0.0.0.0/0', 'All ports open',
|
60
|
+
'WindowsDomain', 'tcp', '22', '636', '0.0.0.0/0', 'Allows common protocols useful in a Windows domain'], :uneven_columns_across, 6)
|
65
61
|
instance.run
|
66
62
|
end
|
67
63
|
end
|
@@ -21,32 +21,32 @@ require 'chef/knife/openstack_image_list'
|
|
21
21
|
require 'chef/knife/cloud/openstack_service'
|
22
22
|
|
23
23
|
describe Chef::Knife::Cloud::OpenstackImageList do
|
24
|
-
let (:instance) {Chef::Knife::Cloud::OpenstackImageList.new}
|
24
|
+
let (:instance) { Chef::Knife::Cloud::OpenstackImageList.new }
|
25
25
|
|
26
|
-
context
|
26
|
+
context 'functionality' do
|
27
27
|
before do
|
28
|
-
resources = [
|
29
|
-
|
30
|
-
|
28
|
+
resources = [TestResource.new(id: 'resource-1', name: 'image01', metadata: {}),
|
29
|
+
TestResource.new(id: 'resource-2', name: 'initrd', metadata: {})
|
30
|
+
]
|
31
31
|
allow(instance).to receive(:query_resource).and_return(resources)
|
32
32
|
allow(instance).to receive(:puts)
|
33
33
|
allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
|
34
34
|
allow(instance).to receive(:validate!)
|
35
|
-
instance.config[:format] =
|
35
|
+
instance.config[:format] = 'summary'
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
39
|
-
expect(instance.ui).to receive(:list).with([
|
40
|
-
|
38
|
+
it 'displays formatted list of images, filtered by default' do
|
39
|
+
expect(instance.ui).to receive(:list).with(['Name', 'ID', 'Snapshot',
|
40
|
+
'image01', 'resource-1', 'no'], :uneven_columns_across, 3)
|
41
41
|
instance.run
|
42
42
|
end
|
43
43
|
|
44
|
-
it
|
44
|
+
it 'lists all images when disable_filter = true' do
|
45
45
|
instance.config[:disable_filter] = true
|
46
|
-
expect(instance.ui).to receive(:list).with([
|
47
|
-
|
48
|
-
|
46
|
+
expect(instance.ui).to receive(:list).with(['Name', 'ID', 'Snapshot',
|
47
|
+
'image01', 'resource-1', 'no',
|
48
|
+
'initrd', 'resource-2', 'no'], :uneven_columns_across, 3)
|
49
49
|
instance.run
|
50
50
|
end
|
51
51
|
end
|
52
|
-
end
|
52
|
+
end
|
@@ -21,25 +21,25 @@ require 'chef/knife/cloud/openstack_service'
|
|
21
21
|
require 'support/shared_examples_for_command'
|
22
22
|
|
23
23
|
describe Chef::Knife::Cloud::OpenstackNetworkList do
|
24
|
-
let (:instance) {Chef::Knife::Cloud::OpenstackNetworkList.new}
|
24
|
+
let (:instance) { Chef::Knife::Cloud::OpenstackNetworkList.new }
|
25
25
|
|
26
|
-
context
|
26
|
+
context 'functionality' do
|
27
27
|
before do
|
28
|
-
resources = [
|
29
|
-
|
28
|
+
resources = [TestResource.new(id: 'resource-1', name: 'external', tenant_id: '1', shared: true),
|
29
|
+
TestResource.new(id: 'resource-2', name: 'internal', tenant_id: '2', shared: false)
|
30
30
|
]
|
31
31
|
allow(instance).to receive(:query_resource).and_return(resources)
|
32
32
|
allow(instance).to receive(:puts)
|
33
33
|
allow(instance).to receive(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
|
34
34
|
allow(instance).to receive(:validate!)
|
35
|
-
instance.config[:format] =
|
35
|
+
instance.config[:format] = 'summary'
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
39
|
-
expect(instance.ui).to receive(:list).with([
|
40
|
-
|
41
|
-
|
38
|
+
it 'lists formatted list of network resources' do
|
39
|
+
expect(instance.ui).to receive(:list).with(['Name', 'ID', 'Tenant', 'Shared',
|
40
|
+
'external', 'resource-1', '1', 'true',
|
41
|
+
'internal', 'resource-2', '2', 'false'], :uneven_columns_across, 4)
|
42
42
|
instance.run
|
43
43
|
end
|
44
44
|
end
|
45
|
-
end
|
45
|
+
end
|
@@ -22,15 +22,14 @@
|
|
22
22
|
require File.expand_path('../../spec_helper', __FILE__)
|
23
23
|
|
24
24
|
describe Chef::Knife::Cloud::OpenstackServerCreate do
|
25
|
-
|
26
25
|
before do
|
27
26
|
@knife_openstack_create = Chef::Knife::Cloud::OpenstackServerCreate.new
|
28
27
|
{
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
28
|
+
image: 'image',
|
29
|
+
openstack_username: 'openstack_username',
|
30
|
+
openstack_password: 'openstack_password',
|
31
|
+
openstack_auth_url: 'openstack_auth_url',
|
32
|
+
server_create_timeout: 1000
|
34
33
|
}.each do |key, value|
|
35
34
|
Chef::Config[:knife][key] = value
|
36
35
|
end
|
@@ -47,18 +46,18 @@ describe Chef::Knife::Cloud::OpenstackServerCreate do
|
|
47
46
|
|
48
47
|
allow(@knife_openstack_create).to receive(:create_service_instance).and_return(@openstack_service)
|
49
48
|
allow(@knife_openstack_create).to receive(:puts)
|
50
|
-
@new_openstack_server = double
|
49
|
+
@new_openstack_server = double
|
51
50
|
|
52
|
-
@openstack_server_attribs = { :
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
'public' => [{'addr' => '75.101.253.10'}],
|
59
|
-
'private' => [{'addr' => '10.251.75.20'}]
|
60
|
-
|
61
|
-
:
|
51
|
+
@openstack_server_attribs = { name: 'Mock Server',
|
52
|
+
id: 'id-123456',
|
53
|
+
key_name: 'key_name',
|
54
|
+
flavor: 'flavor_id',
|
55
|
+
image: 'image_id',
|
56
|
+
addresses: {
|
57
|
+
'public' => [{ 'addr' => '75.101.253.10' }],
|
58
|
+
'private' => [{ 'addr' => '10.251.75.20' }]
|
59
|
+
},
|
60
|
+
password: 'password'
|
62
61
|
}
|
63
62
|
|
64
63
|
@openstack_server_attribs.each_pair do |attrib, value|
|
@@ -66,7 +65,7 @@ describe Chef::Knife::Cloud::OpenstackServerCreate do
|
|
66
65
|
end
|
67
66
|
end
|
68
67
|
|
69
|
-
describe
|
68
|
+
describe 'run' do
|
70
69
|
before(:each) do
|
71
70
|
allow(@knife_openstack_create).to receive(:validate_params!)
|
72
71
|
allow(Fog::Compute::OpenStack).to receive_message_chain(:new, :servers, :create).and_return(@new_openstack_server)
|
@@ -74,9 +73,9 @@ describe Chef::Knife::Cloud::OpenstackServerCreate do
|
|
74
73
|
allow(@new_openstack_server).to receive(:wait_for)
|
75
74
|
end
|
76
75
|
|
77
|
-
context
|
76
|
+
context 'for Linux' do
|
78
77
|
before do
|
79
|
-
@config = {:
|
78
|
+
@config = { openstack_floating_ip: '-1', bootstrap_ip_address: '75.101.253.10', ssh_password: 'password' }
|
80
79
|
@knife_openstack_create.config[:distro] = 'chef-full'
|
81
80
|
@bootstrapper = Chef::Knife::Cloud::Bootstrapper.new(@config)
|
82
81
|
@ssh_bootstrap_protocol = Chef::Knife::Cloud::SshBootstrapProtocol.new(@config)
|
@@ -84,7 +83,7 @@ describe Chef::Knife::Cloud::OpenstackServerCreate do
|
|
84
83
|
allow(@ssh_bootstrap_protocol).to receive(:send_bootstrap_command)
|
85
84
|
end
|
86
85
|
|
87
|
-
it
|
86
|
+
it 'Creates an OpenStack instance and bootstraps it' do
|
88
87
|
expect(Chef::Knife::Cloud::Bootstrapper).to receive(:new).with(@config).and_return(@bootstrapper)
|
89
88
|
allow(@bootstrapper).to receive(:bootstrap).and_call_original
|
90
89
|
expect(@bootstrapper).to receive(:create_bootstrap_protocol).and_return(@ssh_bootstrap_protocol)
|
@@ -94,9 +93,9 @@ describe Chef::Knife::Cloud::OpenstackServerCreate do
|
|
94
93
|
end
|
95
94
|
end
|
96
95
|
|
97
|
-
context
|
96
|
+
context 'for Windows' do
|
98
97
|
before do
|
99
|
-
@config = {:
|
98
|
+
@config = { openstack_floating_ip: '-1', image_os_type: 'windows', bootstrap_ip_address: '75.101.253.10', bootstrap_protocol: 'winrm', ssh_password: 'password' }
|
100
99
|
@knife_openstack_create.config[:image_os_type] = 'windows'
|
101
100
|
@knife_openstack_create.config[:bootstrap_protocol] = 'winrm'
|
102
101
|
@knife_openstack_create.config[:distro] = 'windows-chef-client-msi'
|
@@ -104,7 +103,7 @@ describe Chef::Knife::Cloud::OpenstackServerCreate do
|
|
104
103
|
@winrm_bootstrap_protocol = Chef::Knife::Cloud::WinrmBootstrapProtocol.new(@config)
|
105
104
|
@windows_distribution = Chef::Knife::Cloud::WindowsDistribution.new(@config)
|
106
105
|
end
|
107
|
-
it
|
106
|
+
it 'Creates an OpenStack instance for Windows and bootstraps it' do
|
108
107
|
expect(Chef::Knife::Cloud::Bootstrapper).to receive(:new).with(@config).and_return(@bootstrapper)
|
109
108
|
allow(@bootstrapper).to receive(:bootstrap).and_call_original
|
110
109
|
expect(@bootstrapper).to receive(:create_bootstrap_protocol).and_return(@winrm_bootstrap_protocol)
|