knife-cloud 1.0.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +33 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTING.md +5 -0
- data/Gemfile +9 -0
- data/LICENSE +201 -0
- data/README.md +420 -0
- data/Rakefile +35 -0
- data/knife-cloud.gemspec +27 -0
- data/lib/chef/knife/cloud/chefbootstrap/bootstrap_distribution.rb +31 -0
- data/lib/chef/knife/cloud/chefbootstrap/bootstrap_options.rb +191 -0
- data/lib/chef/knife/cloud/chefbootstrap/bootstrap_protocol.rb +69 -0
- data/lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb +78 -0
- data/lib/chef/knife/cloud/chefbootstrap/ssh_bootstrap_protocol.rb +179 -0
- data/lib/chef/knife/cloud/chefbootstrap/unix_distribution.rb +31 -0
- data/lib/chef/knife/cloud/chefbootstrap/windows_distribution.rb +32 -0
- data/lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb +85 -0
- data/lib/chef/knife/cloud/command.rb +101 -0
- data/lib/chef/knife/cloud/exceptions.rb +38 -0
- data/lib/chef/knife/cloud/fog/options.rb +29 -0
- data/lib/chef/knife/cloud/fog/service.rb +200 -0
- data/lib/chef/knife/cloud/helpers.rb +39 -0
- data/lib/chef/knife/cloud/list_resource_command.rb +97 -0
- data/lib/chef/knife/cloud/list_resource_options.rb +21 -0
- data/lib/chef/knife/cloud/server/create_command.rb +165 -0
- data/lib/chef/knife/cloud/server/create_options.rb +80 -0
- data/lib/chef/knife/cloud/server/delete_command.rb +68 -0
- data/lib/chef/knife/cloud/server/delete_options.rb +42 -0
- data/lib/chef/knife/cloud/server/list_command.rb +84 -0
- data/lib/chef/knife/cloud/server/list_options.rb +43 -0
- data/lib/chef/knife/cloud/server/options.rb +39 -0
- data/lib/chef/knife/cloud/server/show_command.rb +55 -0
- data/lib/chef/knife/cloud/server/show_options.rb +36 -0
- data/lib/chef/knife/cloud/service.rb +91 -0
- data/lib/knife-cloud/version.rb +6 -0
- data/lib/test/fixtures/knife.rb +9 -0
- data/lib/test/fixtures/validation.pem +27 -0
- data/lib/test/knife-utils/helper.rb +39 -0
- data/lib/test/knife-utils/knife_test_utils.rb +40 -0
- data/lib/test/knife-utils/matchers.rb +29 -0
- data/lib/test/knife-utils/test_bed.rb +56 -0
- data/lib/test/templates/chef-full-chef-zero.erb +67 -0
- data/lib/test/templates/windows-chef-client-msi.erb +231 -0
- data/lib/test/templates/windows-shell.erb +77 -0
- data/spec/resource_spec_helper.rb +49 -0
- data/spec/server_command_common_spec_helper.rb +48 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/support/shared_examples_for_command.rb +35 -0
- data/spec/support/shared_examples_for_servercreatecommand.rb +144 -0
- data/spec/support/shared_examples_for_serverdeletecommand.rb +77 -0
- data/spec/support/shared_examples_for_service.rb +85 -0
- data/spec/unit/bootstrap_protocol_spec.rb +70 -0
- data/spec/unit/bootstrapper_spec.rb +171 -0
- data/spec/unit/cloud_command_spec.rb +35 -0
- data/spec/unit/command_spec.rb +49 -0
- data/spec/unit/fog_service_spec.rb +138 -0
- data/spec/unit/list_resource_command_spec.rb +136 -0
- data/spec/unit/server_create_command_spec.rb +198 -0
- data/spec/unit/server_delete_command_spec.rb +25 -0
- data/spec/unit/server_list_command_spec.rb +119 -0
- data/spec/unit/server_show_command_spec.rb +64 -0
- data/spec/unit/service_spec.rb +46 -0
- data/spec/unit/ssh_bootstrap_protocol_spec.rb +116 -0
- data/spec/unit/unix_distribution_spec.rb +37 -0
- data/spec/unit/windows_distribution_spec.rb +37 -0
- data/spec/unit/winrm_bootstrap_protocol_spec.rb +106 -0
- metadata +248 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013-2014 Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
19
|
+
require 'chef/knife/cloud/service'
|
20
|
+
|
21
|
+
|
22
|
+
describe Chef::Knife::Cloud::Service do
|
23
|
+
|
24
|
+
let (:instance) { Chef::Knife::Cloud::Service.new }
|
25
|
+
|
26
|
+
it { expect {instance}.to_not raise_error }
|
27
|
+
|
28
|
+
it { expect {instance.connection}.to raise_error(Chef::Exceptions::Override, "You must override connection in #{instance.to_s}") }
|
29
|
+
|
30
|
+
it { expect {instance.create_server}.to raise_error(Chef::Exceptions::Override, "You must override create_server in #{instance.to_s}") }
|
31
|
+
|
32
|
+
it { expect {instance.delete_server(:server_name)}.to raise_error(Chef::Exceptions::Override, "You must override delete_server in #{instance.to_s}") }
|
33
|
+
|
34
|
+
it { expect {instance.delete_server}.to raise_error(ArgumentError, "wrong number of arguments (0 for 1)") }
|
35
|
+
|
36
|
+
it { expect {instance.list_servers}.to raise_error(Chef::Exceptions::Override, "You must override list_servers in #{instance.to_s}") }
|
37
|
+
|
38
|
+
it { expect {instance.list_images}.to raise_error(ArgumentError, "wrong number of arguments (0 for 1)") }
|
39
|
+
|
40
|
+
it { expect {instance.list_images(:image_filters)}.to raise_error(Chef::Exceptions::Override, "You must override list_images in #{instance.to_s}") }
|
41
|
+
|
42
|
+
it { expect {instance.list_resource_configurations()}.to raise_error(Chef::Exceptions::Override, "You must override list_resource_configurations in #{instance.to_s}") }
|
43
|
+
|
44
|
+
it { expect { Chef::Knife::Cloud::Service.new({:auth_params => {:provider => 'Any Cloud Provider'}}) }.to_not raise_error }
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013-2014 Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
require 'spec_helper'
|
19
|
+
require 'chef/knife/cloud/chefbootstrap/ssh_bootstrap_protocol'
|
20
|
+
require 'chef/knife/bootstrap_windows_ssh'
|
21
|
+
|
22
|
+
describe Chef::Knife::Cloud::SshBootstrapProtocol do
|
23
|
+
before do
|
24
|
+
@config = {:bootstrap_protocol => 'ssh'}
|
25
|
+
@instance = Chef::Knife::Cloud::SshBootstrapProtocol.new(@config)
|
26
|
+
allow(@instance).to receive(:sleep).and_return(0)
|
27
|
+
allow(@instance).to receive(:print)
|
28
|
+
end
|
29
|
+
|
30
|
+
context "Create instance" do
|
31
|
+
it "asks for compulsory properties" do
|
32
|
+
expect {Chef::Knife::Cloud::SshBootstrapProtocol.new}.to raise_error(ArgumentError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "non windows image" do
|
36
|
+
@config[:image_os_type] = 'linux'
|
37
|
+
ssh_bootstrap_protocol = Chef::Knife::Cloud::SshBootstrapProtocol.new(@config)
|
38
|
+
expect(ssh_bootstrap_protocol.bootstrap.class).to eq(Chef::Knife::Bootstrap)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "windows image" do
|
42
|
+
@config[:image_os_type] = 'windows'
|
43
|
+
ssh_bootstrap_protocol = Chef::Knife::Cloud::SshBootstrapProtocol.new(@config)
|
44
|
+
expect(ssh_bootstrap_protocol.bootstrap.class).to eq(Chef::Knife::BootstrapWindowsSsh)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#wait_for_server_ready" do
|
49
|
+
it "execute with correct method calls" do
|
50
|
+
allow(@instance).to receive(:tcp_test_ssh).and_return(true)
|
51
|
+
expect(@instance).to receive(:tcp_test_ssh).ordered
|
52
|
+
@instance.wait_for_server_ready
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#init_bootstrap_options" do
|
57
|
+
it "set correct bootstrap config" do
|
58
|
+
@config[:bootstrap_ip_address] = "127.0.0.1"
|
59
|
+
@config[:chef_node_name] = "testnode"
|
60
|
+
@config[:environment] = "_default"
|
61
|
+
@config[:ssh_user] = "testuser"
|
62
|
+
@config[:ssh_gateway] = "ssh_gateway"
|
63
|
+
@config[:forward_agent] = true
|
64
|
+
@config[:use_sudo_password] = true
|
65
|
+
allow(@config).to receive(:locate_config_value).and_return({})
|
66
|
+
@instance.bootstrap = Chef::Knife::Bootstrap.new
|
67
|
+
@instance.init_bootstrap_options
|
68
|
+
expect(@instance.bootstrap.name_args).to eq(@config[:bootstrap_ip_address])
|
69
|
+
expect(@instance.bootstrap.config[:chef_node_name]).to eq(@config[:chef_node_name])
|
70
|
+
expect(@instance.bootstrap.config[:environment]).to eq(@config[:environment])
|
71
|
+
expect(@instance.bootstrap.config[:ssh_user]).to eq(@config[:ssh_user])
|
72
|
+
expect(@instance.bootstrap.config[:forward_agent]).to be(true)
|
73
|
+
expect(@instance.bootstrap.config[:use_sudo_password]).to be(true)
|
74
|
+
expect(@instance.bootstrap.config[:ssh_gateway]).to eq(@config[:ssh_gateway])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "#tcp_test_ssh" do
|
79
|
+
|
80
|
+
it "return true" do
|
81
|
+
tcpSocket = double()
|
82
|
+
allow(tcpSocket).to receive(:close).and_return(true)
|
83
|
+
allow(tcpSocket).to receive(:gets).and_return(true)
|
84
|
+
allow(TCPSocket).to receive(:new).and_return(tcpSocket)
|
85
|
+
allow(IO).to receive(:select).and_return(true)
|
86
|
+
allow(tcpSocket.gets).to receive(:nil?).and_return(false)
|
87
|
+
allow(tcpSocket.gets).to receive(:empty?).and_return(false)
|
88
|
+
expect(@instance.tcp_test_ssh("localhost","22"){}).to be(true)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "raise ETIMEDOUT error" do
|
92
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::ETIMEDOUT)
|
93
|
+
expect(@instance.tcp_test_ssh("localhost","22"){}).to be(false)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "raise EPERM error" do
|
97
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::EPERM)
|
98
|
+
expect(@instance.tcp_test_ssh("localhost","22"){}).to be(false)
|
99
|
+
end
|
100
|
+
|
101
|
+
it "raise ECONNREFUSED error" do
|
102
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::ECONNREFUSED)
|
103
|
+
expect(@instance.tcp_test_ssh("localhost","22"){}).to be(false)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "raise EHOSTUNREACH error" do
|
107
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::EHOSTUNREACH)
|
108
|
+
expect(@instance.tcp_test_ssh("localhost","22"){}).to be(false)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "raise ENETUNREACH error" do
|
112
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::ENETUNREACH)
|
113
|
+
expect(@instance.tcp_test_ssh("localhost","22"){}).to be(false)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013 Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
require 'spec_helper'
|
19
|
+
require 'chef/knife/cloud/chefbootstrap/unix_distribution'
|
20
|
+
|
21
|
+
describe Chef::Knife::Cloud::UnixDistribution do
|
22
|
+
|
23
|
+
before do
|
24
|
+
@config = {:bootstrap_protocol => 'ssh'}
|
25
|
+
end
|
26
|
+
|
27
|
+
context "Unix Distribution initializer" do
|
28
|
+
it "asks for compulsory properties while creating instance" do
|
29
|
+
expect {Chef::Knife::Cloud::UnixDistribution.new}.to raise_error(ArgumentError)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "creates instance" do
|
33
|
+
expect {Chef::Knife::Cloud::UnixDistribution.new(@config)}.to_not raise_error
|
34
|
+
expect(Chef::Knife::Cloud::UnixDistribution.new(@config).class).to eq(Chef::Knife::Cloud::UnixDistribution)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013 Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
require 'spec_helper'
|
19
|
+
require 'chef/knife/cloud/chefbootstrap/windows_distribution'
|
20
|
+
|
21
|
+
describe Chef::Knife::Cloud::WindowsDistribution do
|
22
|
+
|
23
|
+
before do
|
24
|
+
@config = {:bootstrap_protocol => 'winrm'}
|
25
|
+
end
|
26
|
+
|
27
|
+
context "Windows Distribution initializer" do
|
28
|
+
it "asks for compulsory properties while creating instance" do
|
29
|
+
expect {Chef::Knife::Cloud::WindowsDistribution.new}.to raise_error(ArgumentError)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "creates instance" do
|
33
|
+
expect {Chef::Knife::Cloud::WindowsDistribution.new(@config)}.to_not raise_error
|
34
|
+
expect(Chef::Knife::Cloud::WindowsDistribution.new(@config).class).to eq(Chef::Knife::Cloud::WindowsDistribution)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013-2014 Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
require 'spec_helper'
|
19
|
+
require 'chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol'
|
20
|
+
|
21
|
+
describe Chef::Knife::Cloud::WinrmBootstrapProtocol do
|
22
|
+
before do
|
23
|
+
@config = {:bootstrap_protocol => 'winrm'}
|
24
|
+
@config = {:image_os_type => 'windows'}
|
25
|
+
@instance = Chef::Knife::Cloud::WinrmBootstrapProtocol.new(@config)
|
26
|
+
allow(@instance).to receive(:sleep).and_return(0)
|
27
|
+
allow(@instance).to receive(:print)
|
28
|
+
end
|
29
|
+
|
30
|
+
context "Create instance" do
|
31
|
+
it "asks for compulsory properties" do
|
32
|
+
expect {Chef::Knife::Cloud::WinrmBootstrapProtocol.new}.to raise_error(ArgumentError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "windows image" do
|
36
|
+
@config[:image_os_type] = 'windows'
|
37
|
+
winrm_bootstrap_protocol = Chef::Knife::Cloud::WinrmBootstrapProtocol.new(@config)
|
38
|
+
expect(winrm_bootstrap_protocol.bootstrap.class).to eq(Chef::Knife::BootstrapWindowsWinrm)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#wait_for_server_ready" do
|
43
|
+
it "execute with correct method calls" do
|
44
|
+
@config[:image_os_type] = 'windows'
|
45
|
+
allow(@instance).to receive(:tcp_test_winrm).and_return(true)
|
46
|
+
expect(@instance).to receive(:tcp_test_winrm).ordered
|
47
|
+
@instance.wait_for_server_ready
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "#init_bootstrap_options" do
|
52
|
+
it "set correct bootstrap config" do
|
53
|
+
@config[:bootstrap_ip_address] = "127.0.0.1"
|
54
|
+
@config[:chef_node_name] = "testnode"
|
55
|
+
@config[:environment] = "_default"
|
56
|
+
@config[:winrm_user] = "testuser"
|
57
|
+
@config[:auth_timeout] = "100"
|
58
|
+
@instance.bootstrap = Chef::Knife::Bootstrap.new
|
59
|
+
@instance.init_bootstrap_options
|
60
|
+
expect(@instance.bootstrap.name_args).to eq(@config[:bootstrap_ip_address])
|
61
|
+
expect(@instance.bootstrap.config[:chef_node_name]).to eq(@config[:chef_node_name])
|
62
|
+
expect(@instance.bootstrap.config[:environment]).to eq(@config[:environment])
|
63
|
+
expect(@instance.bootstrap.config[:winrm_user]).to eq(@config[:winrm_user])
|
64
|
+
expect(@instance.bootstrap.config[:auth_timeout]).to eq(@config[:auth_timeout])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "#tcp_test_winrm" do
|
69
|
+
it "return true" do
|
70
|
+
tcpSocket = double()
|
71
|
+
allow(tcpSocket).to receive(:close).and_return(true)
|
72
|
+
allow(TCPSocket).to receive(:new).and_return(tcpSocket)
|
73
|
+
expect(@instance.tcp_test_winrm("localhost","5989")).to be(true)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "raise SocketError error" do
|
77
|
+
allow(TCPSocket).to receive(:new).and_raise(SocketError)
|
78
|
+
expect(@instance.tcp_test_winrm("localhost","5989")).to be(false)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "raise ETIMEDOUT error" do
|
82
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::ETIMEDOUT)
|
83
|
+
expect(@instance.tcp_test_winrm("localhost","5989")).to be(false)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "raise EPERM error" do
|
87
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::EPERM)
|
88
|
+
expect(@instance.tcp_test_winrm("localhost","5989"){raise Errno::EPERM}).to be(false)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "raise ECONNREFUSED error" do
|
92
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::ECONNREFUSED)
|
93
|
+
expect(@instance.tcp_test_winrm("localhost","5989"){raise Errno::ECONNREFUSED}).to be(false)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "raise EHOSTUNREACH error" do
|
97
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::EHOSTUNREACH)
|
98
|
+
expect(@instance.tcp_test_winrm("localhost","5989"){raise Errno::EHOSTUNREACH}).to be(false)
|
99
|
+
end
|
100
|
+
|
101
|
+
it "raise ENETUNREACH error" do
|
102
|
+
allow(TCPSocket).to receive(:new).and_raise(Errno::ENETUNREACH)
|
103
|
+
expect(@instance.tcp_test_winrm("localhost","5989"){raise Errno::ENETUNREACH}).to be(false)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
metadata
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: knife-cloud
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.rc.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kaustubh Deorukhkar
|
8
|
+
- Ameya Varade
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-07-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: fog
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ! '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.10.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ! '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.10.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: knife-windows
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.5.14
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.5.14
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: chef
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.10.10
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.10.10
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: mixlib-shellout
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec-core
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rspec-expectations
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rspec-mocks
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rspec_junit_formatter
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: knife-cloud plugin
|
127
|
+
email:
|
128
|
+
- dev@getchef.com
|
129
|
+
executables: []
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files:
|
132
|
+
- README.md
|
133
|
+
- LICENSE
|
134
|
+
files:
|
135
|
+
- .gitignore
|
136
|
+
- .travis.yml
|
137
|
+
- CHANGELOG.md
|
138
|
+
- CONTRIBUTING.md
|
139
|
+
- Gemfile
|
140
|
+
- LICENSE
|
141
|
+
- README.md
|
142
|
+
- Rakefile
|
143
|
+
- knife-cloud.gemspec
|
144
|
+
- lib/chef/knife/cloud/chefbootstrap/bootstrap_distribution.rb
|
145
|
+
- lib/chef/knife/cloud/chefbootstrap/bootstrap_options.rb
|
146
|
+
- lib/chef/knife/cloud/chefbootstrap/bootstrap_protocol.rb
|
147
|
+
- lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb
|
148
|
+
- lib/chef/knife/cloud/chefbootstrap/ssh_bootstrap_protocol.rb
|
149
|
+
- lib/chef/knife/cloud/chefbootstrap/unix_distribution.rb
|
150
|
+
- lib/chef/knife/cloud/chefbootstrap/windows_distribution.rb
|
151
|
+
- lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb
|
152
|
+
- lib/chef/knife/cloud/command.rb
|
153
|
+
- lib/chef/knife/cloud/exceptions.rb
|
154
|
+
- lib/chef/knife/cloud/fog/options.rb
|
155
|
+
- lib/chef/knife/cloud/fog/service.rb
|
156
|
+
- lib/chef/knife/cloud/helpers.rb
|
157
|
+
- lib/chef/knife/cloud/list_resource_command.rb
|
158
|
+
- lib/chef/knife/cloud/list_resource_options.rb
|
159
|
+
- lib/chef/knife/cloud/server/create_command.rb
|
160
|
+
- lib/chef/knife/cloud/server/create_options.rb
|
161
|
+
- lib/chef/knife/cloud/server/delete_command.rb
|
162
|
+
- lib/chef/knife/cloud/server/delete_options.rb
|
163
|
+
- lib/chef/knife/cloud/server/list_command.rb
|
164
|
+
- lib/chef/knife/cloud/server/list_options.rb
|
165
|
+
- lib/chef/knife/cloud/server/options.rb
|
166
|
+
- lib/chef/knife/cloud/server/show_command.rb
|
167
|
+
- lib/chef/knife/cloud/server/show_options.rb
|
168
|
+
- lib/chef/knife/cloud/service.rb
|
169
|
+
- lib/knife-cloud/version.rb
|
170
|
+
- lib/test/fixtures/knife.rb
|
171
|
+
- lib/test/fixtures/validation.pem
|
172
|
+
- lib/test/knife-utils/helper.rb
|
173
|
+
- lib/test/knife-utils/knife_test_utils.rb
|
174
|
+
- lib/test/knife-utils/matchers.rb
|
175
|
+
- lib/test/knife-utils/test_bed.rb
|
176
|
+
- lib/test/templates/chef-full-chef-zero.erb
|
177
|
+
- lib/test/templates/windows-chef-client-msi.erb
|
178
|
+
- lib/test/templates/windows-shell.erb
|
179
|
+
- spec/resource_spec_helper.rb
|
180
|
+
- spec/server_command_common_spec_helper.rb
|
181
|
+
- spec/spec_helper.rb
|
182
|
+
- spec/support/shared_examples_for_command.rb
|
183
|
+
- spec/support/shared_examples_for_servercreatecommand.rb
|
184
|
+
- spec/support/shared_examples_for_serverdeletecommand.rb
|
185
|
+
- spec/support/shared_examples_for_service.rb
|
186
|
+
- spec/unit/bootstrap_protocol_spec.rb
|
187
|
+
- spec/unit/bootstrapper_spec.rb
|
188
|
+
- spec/unit/cloud_command_spec.rb
|
189
|
+
- spec/unit/command_spec.rb
|
190
|
+
- spec/unit/fog_service_spec.rb
|
191
|
+
- spec/unit/list_resource_command_spec.rb
|
192
|
+
- spec/unit/server_create_command_spec.rb
|
193
|
+
- spec/unit/server_delete_command_spec.rb
|
194
|
+
- spec/unit/server_list_command_spec.rb
|
195
|
+
- spec/unit/server_show_command_spec.rb
|
196
|
+
- spec/unit/service_spec.rb
|
197
|
+
- spec/unit/ssh_bootstrap_protocol_spec.rb
|
198
|
+
- spec/unit/unix_distribution_spec.rb
|
199
|
+
- spec/unit/windows_distribution_spec.rb
|
200
|
+
- spec/unit/winrm_bootstrap_protocol_spec.rb
|
201
|
+
homepage: https://github.com/opscode/knife-cloud
|
202
|
+
licenses: []
|
203
|
+
metadata: {}
|
204
|
+
post_install_message:
|
205
|
+
rdoc_options: []
|
206
|
+
require_paths:
|
207
|
+
- lib
|
208
|
+
- spec
|
209
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - ! '>='
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - ! '>'
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: 1.3.1
|
219
|
+
requirements: []
|
220
|
+
rubyforge_project:
|
221
|
+
rubygems_version: 2.1.11
|
222
|
+
signing_key:
|
223
|
+
specification_version: 4
|
224
|
+
summary: knife-cloud plugin
|
225
|
+
test_files:
|
226
|
+
- spec/resource_spec_helper.rb
|
227
|
+
- spec/server_command_common_spec_helper.rb
|
228
|
+
- spec/spec_helper.rb
|
229
|
+
- spec/support/shared_examples_for_command.rb
|
230
|
+
- spec/support/shared_examples_for_servercreatecommand.rb
|
231
|
+
- spec/support/shared_examples_for_serverdeletecommand.rb
|
232
|
+
- spec/support/shared_examples_for_service.rb
|
233
|
+
- spec/unit/bootstrap_protocol_spec.rb
|
234
|
+
- spec/unit/bootstrapper_spec.rb
|
235
|
+
- spec/unit/cloud_command_spec.rb
|
236
|
+
- spec/unit/command_spec.rb
|
237
|
+
- spec/unit/fog_service_spec.rb
|
238
|
+
- spec/unit/list_resource_command_spec.rb
|
239
|
+
- spec/unit/server_create_command_spec.rb
|
240
|
+
- spec/unit/server_delete_command_spec.rb
|
241
|
+
- spec/unit/server_list_command_spec.rb
|
242
|
+
- spec/unit/server_show_command_spec.rb
|
243
|
+
- spec/unit/service_spec.rb
|
244
|
+
- spec/unit/ssh_bootstrap_protocol_spec.rb
|
245
|
+
- spec/unit/unix_distribution_spec.rb
|
246
|
+
- spec/unit/windows_distribution_spec.rb
|
247
|
+
- spec/unit/winrm_bootstrap_protocol_spec.rb
|
248
|
+
has_rdoc:
|