knife-openstack 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +24 -20
- data/lib/chef/knife/openstack_server_create.rb +35 -4
- data/lib/knife-openstack/version.rb +1 -1
- data/spec/unit/openstack_server_create_spec.rb +38 -14
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -1,29 +1,34 @@
|
|
1
|
+
## v0.8.1
|
2
|
+
|
3
|
+
* KNIFE-296 knife-windows overrides -i, -p, -P and -x options with winrm values
|
4
|
+
* KNIFE-304 enable setting the ssh port for knife-openstack
|
5
|
+
|
1
6
|
## v0.8.0
|
2
7
|
|
3
|
-
* Windows bootstrapping (winrm-based) support for knife-openstack (
|
8
|
+
* KNIFE-221 Windows bootstrapping (winrm-based) support for knife-openstack (Chirag Jog)
|
4
9
|
|
5
10
|
## v0.7.1
|
6
11
|
|
7
|
-
* file permissions fixed
|
12
|
+
* KNIFE-261 file permissions fixed
|
8
13
|
|
9
14
|
## v0.7.0
|
10
15
|
* Update dependency on to Fog 1.10.0
|
11
16
|
* 'delay-loading' changes to reduce load-time (Mohit Sethi)
|
12
|
-
* Use the hint with the bootstrap method instead of assuming the :personality works with the server.create method
|
13
|
-
* Added 'knife openstack group list' for listing security groups and their rules
|
17
|
+
* KNIFE-201 Use the hint with the bootstrap method instead of assuming the :personality works with the server.create method
|
18
|
+
* KNIFE-227 Added 'knife openstack group list' for listing security groups and their rules
|
14
19
|
* Filter out extraneous images from knife openstack image list and added '--disable-filter' to disable
|
15
20
|
* Fixed minor issue for public ip addresses (Edmund Haselwanter)
|
16
|
-
* Fixed security groups, adding `-G` support
|
21
|
+
* KNIFE-230 Fixed security groups, adding `-G` support
|
17
22
|
* Added snapshots as a new column in image list
|
18
|
-
* "knife openstack image list" fails with empty image name (
|
19
|
-
* excon / fog errors are a JSON blob, Rescue fog errors (
|
23
|
+
* KNIFE-83 "knife openstack image list" fails with empty image name (Simon Belluzzo)
|
24
|
+
* KNIFE-87 excon / fog errors are a JSON blob, Rescue fog errors (Bryan McLellan)
|
20
25
|
* Better error handling for connection errors.
|
21
|
-
* Pass ssh_password to bootstrap (
|
26
|
+
* KNIFE-88 Pass ssh_password to bootstrap (David Petzel)
|
22
27
|
* Catch Net Unreachable error (E.J. Finneran)
|
23
|
-
* Allow an option to ignore the SSL cert (
|
28
|
+
* KNIFE-225 Allow an option to ignore the SSL cert (BK Box)
|
24
29
|
* Attach to floating IPs (Mohit Sethi)
|
25
|
-
* Key pair is not required (
|
26
|
-
* Fog 1.10.0 changes API for OpenStack IP addresses
|
30
|
+
* KNIFE-226 Key pair is not required (BK Box)
|
31
|
+
* KNIFE-248 Fog 1.10.0 changes API for OpenStack IP addresses
|
27
32
|
|
28
33
|
## v0.6.2
|
29
34
|
* Use less pessimistic fog version constraint.
|
@@ -33,10 +38,10 @@
|
|
33
38
|
* Switched to OpenStack API from OpenStack EC2 API.
|
34
39
|
* Updated to point to Fog 1.4.0 for latest `OpenStack` provider
|
35
40
|
* testing with Diablo & Essex
|
36
|
-
* knife openstack server create
|
37
|
-
* knife openstack server delete
|
38
|
-
* Support for unenven_columns for prettier output
|
39
|
-
* Added chef gem dependency
|
41
|
+
* KNIFE_OPENSTACK-1 knife openstack server create
|
42
|
+
* KNIFE_OPENSTACK-2 knife openstack server delete
|
43
|
+
* KNIFE_OPENSTACK-5 Support for unenven_columns for prettier output
|
44
|
+
* KNIFE_OPENSTACK-6 Added chef gem dependency
|
40
45
|
* Added virtual cpus to 'knife openstack flavor list'
|
41
46
|
* Removed unsupported features to match current state of plugin (public_key, kernel, architecture, cores, location)
|
42
47
|
* Added support for openstack_tenant (Rob Hirschfeld & Alexander Gordeev)
|
@@ -54,15 +59,14 @@
|
|
54
59
|
This is a list of missing(?) features and open questions currently under development consideration:
|
55
60
|
|
56
61
|
* Basic availability zones support (Jarek Zmudzinski) NEED TESTING ACCESS FOR AVAILABILITY ZONES
|
57
|
-
* Windows bootstrapping (winrm-based) support for knife-openstack (KNIFE-221) winrm branch, UGLY WARNINGS NEED RESOLUTION
|
58
62
|
* purge only works when names match up with clients
|
59
63
|
* `knife openstack floating list|associate|release NODE` with --floating-ip-pool also
|
60
|
-
* Allow specifying the name of the pool when using floating IPs
|
64
|
+
* KNIFE-229 Allow specifying the name of the pool when using floating IPs
|
61
65
|
* attempt to allocate a floating ipaddress if none if free, currently missing in Fog
|
62
|
-
* take either the flavor ID or the flavor name
|
66
|
+
* KNIFE-76 take either the flavor ID or the flavor name
|
63
67
|
* take either the image ID or the image name (similar for KNIFE-76)
|
64
|
-
* server create with expired password hangs
|
65
|
-
* added ability to specify arbitrary network ID
|
68
|
+
* KNIFE-86 server create with expired password hangs
|
69
|
+
* KNIFE-231 added ability to specify arbitrary network ID
|
66
70
|
* assumption of only single floating IP (and fog uses the last as the public_ip_address)
|
67
71
|
* probably other places public network is assumed that could cause issues
|
68
72
|
* fog is putting the original public IP address into the private_ip_address method when you get a floating_ip, this is wrong. Remove KNIFE-248 code once fixed.
|
@@ -82,6 +82,13 @@ class Chef
|
|
82
82
|
:description => "The OpenStack SSH keypair id",
|
83
83
|
:proc => Proc.new { |key| Chef::Config[:knife][:openstack_ssh_key_id] = key }
|
84
84
|
|
85
|
+
option :ssh_port,
|
86
|
+
:short => "-p PORT",
|
87
|
+
:long => "--ssh-port PORT",
|
88
|
+
:description => "The ssh port",
|
89
|
+
:default => "22",
|
90
|
+
:proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key }
|
91
|
+
|
85
92
|
option :ssh_user,
|
86
93
|
:short => "-x USERNAME",
|
87
94
|
:long => "--ssh-user USERNAME",
|
@@ -149,11 +156,11 @@ class Chef
|
|
149
156
|
:default => 600,
|
150
157
|
:proc => Proc.new { |v| Chef::Config[:knife][:server_create_timeouts] = v}
|
151
158
|
|
152
|
-
def tcp_test_ssh(hostname)
|
153
|
-
tcp_socket = TCPSocket.new(hostname,
|
159
|
+
def tcp_test_ssh(hostname, port)
|
160
|
+
tcp_socket = TCPSocket.new(hostname, port)
|
154
161
|
readable = IO.select([tcp_socket], nil, nil, 5)
|
155
162
|
if readable
|
156
|
-
Chef::Log.debug("sshd accepting connections on #{hostname}, banner is #{tcp_socket.gets}")
|
163
|
+
Chef::Log.debug("sshd accepting connections on #{hostname} port #{port}, banner is #{tcp_socket.gets}")
|
157
164
|
yield
|
158
165
|
true
|
159
166
|
else
|
@@ -210,6 +217,28 @@ class Chef
|
|
210
217
|
validate!
|
211
218
|
if locate_config_value(:bootstrap_protocol) == 'winrm'
|
212
219
|
load_winrm_deps
|
220
|
+
else
|
221
|
+
# workaround for KNIFE-296 winrm values stomping on ssh values
|
222
|
+
# unchanged ssh_user and changed winrm_user, override ssh_user
|
223
|
+
if locate_config_value(:ssh_user).eql?(options[:ssh_user][:default]) &&
|
224
|
+
!locate_config_value(:winrm_user).eql?(options[:winrm_user][:default])
|
225
|
+
config[:ssh_user] = locate_config_value(:winrm_user)
|
226
|
+
end
|
227
|
+
# unchanged ssh_port and changed winrm_port, override ssh_port
|
228
|
+
if locate_config_value(:ssh_port).eql?(options[:ssh_port][:default]) &&
|
229
|
+
!locate_config_value(:winrm_port).eql?(options[:winrm_port][:default])
|
230
|
+
config[:ssh_port] = locate_config_value(:winrm_port)
|
231
|
+
end
|
232
|
+
# unset ssh_password and set winrm_password, override ssh_password
|
233
|
+
if locate_config_value(:ssh_password).nil? &&
|
234
|
+
!locate_config_value(:winrm_password).nil?
|
235
|
+
config[:ssh_password] = locate_config_value(:winrm_password)
|
236
|
+
end
|
237
|
+
# unset identity_file and set kerberos_keytab_file, override identity_file
|
238
|
+
if locate_config_value(:identity_file).nil? &&
|
239
|
+
!locate_config_value(:kerberos_keytab_file).nil?
|
240
|
+
config[:identity_file] = locate_config_value(:kerberos_keytab_file)
|
241
|
+
end
|
213
242
|
end
|
214
243
|
#servers require a name, generate one if not passed
|
215
244
|
node_name = get_node_name(config[:chef_node_name])
|
@@ -307,8 +336,9 @@ class Chef
|
|
307
336
|
print(".") until tcp_test_winrm(bootstrap_ip_address, locate_config_value(:winrm_port))
|
308
337
|
bootstrap_for_windows_node(server, bootstrap_ip_address).run
|
309
338
|
else
|
339
|
+
Chef::Log.debug("Waiting for sshd on IP address: #{bootstrap_ip_address} and port: #{locate_config_value(:ssh_port)}")
|
310
340
|
print "\n#{ui.color("Waiting for sshd", :magenta)}"
|
311
|
-
print(".") until tcp_test_ssh(bootstrap_ip_address) {
|
341
|
+
print(".") until tcp_test_ssh(bootstrap_ip_address, locate_config_value(:ssh_port)) {
|
312
342
|
sleep @initial_sleep_delay ||= 10
|
313
343
|
puts("done")
|
314
344
|
}
|
@@ -358,6 +388,7 @@ class Chef
|
|
358
388
|
bootstrap = Chef::Knife::Bootstrap.new
|
359
389
|
bootstrap.name_args = [bootstrap_ip_address]
|
360
390
|
bootstrap.config[:ssh_user] = config[:ssh_user]
|
391
|
+
bootstrap.config[:ssh_port] = config[:ssh_port]
|
361
392
|
bootstrap.config[:identity_file] = config[:identity_file]
|
362
393
|
bootstrap.config[:host_key_verify] = config[:host_key_verify]
|
363
394
|
bootstrap.config[:use_sudo] = true unless config[:ssh_user] == 'root'
|
@@ -14,10 +14,10 @@ describe Chef::Knife::OpenstackServerCreate do
|
|
14
14
|
@openstack_connection.stub_chain(:flavors, :get).and_return ('flavor_id')
|
15
15
|
@openstack_connection.stub_chain(:images, :get).and_return mock('image_id')
|
16
16
|
@openstack_connection.stub_chain(:addresses).and_return [mock('addresses', {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
:instance_id => nil,
|
18
|
+
:ip => '111.111.111.111',
|
19
|
+
:fixed_ip => true
|
20
|
+
})]
|
21
21
|
|
22
22
|
@knife_openstack_create = Chef::Knife::OpenstackServerCreate.new
|
23
23
|
@knife_openstack_create.initial_sleep_delay = 0
|
@@ -43,16 +43,16 @@ describe Chef::Knife::OpenstackServerCreate do
|
|
43
43
|
@new_openstack_server = mock()
|
44
44
|
|
45
45
|
@openstack_server_attribs = { :name => 'Mock Server',
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
:id => 'id-123456',
|
47
|
+
:key_name => 'key_name',
|
48
|
+
:flavor => 'flavor_id',
|
49
|
+
:image => 'image_id',
|
50
|
+
:addresses => {
|
51
|
+
'public' => [{'addr' => '75.101.253.10'}],
|
52
|
+
'private' => [{'addr' => '10.251.75.20'}]
|
53
|
+
},
|
54
|
+
:password => 'password'
|
55
|
+
}
|
56
56
|
|
57
57
|
|
58
58
|
@openstack_server_attribs.each_pair do |attrib, value|
|
@@ -60,6 +60,25 @@ describe Chef::Knife::OpenstackServerCreate do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
describe "options" do
|
64
|
+
before do
|
65
|
+
@options = @knife_openstack_create.options
|
66
|
+
end
|
67
|
+
|
68
|
+
it "ensures default options" do
|
69
|
+
@options[:bootstrap_protocol][:default].should == nil
|
70
|
+
@options[:distro][:default].should == 'chef-full'
|
71
|
+
@options[:floating_ip][:default].should == '-1'
|
72
|
+
@options[:host_key_verify][:default].should == true
|
73
|
+
@options[:private_network][:default].should == false
|
74
|
+
@options[:run_list][:default].should == []
|
75
|
+
@options[:security_groups][:default].should == ['default']
|
76
|
+
@options[:server_create_timeout][:default].should == 600
|
77
|
+
@options[:ssh_port][:default].should == '22'
|
78
|
+
@options[:ssh_user][:default].should == 'root'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
63
82
|
describe "run" do
|
64
83
|
before do
|
65
84
|
@openstack_servers.should_receive(:create).and_return(@new_openstack_server)
|
@@ -96,6 +115,7 @@ describe Chef::Knife::OpenstackServerCreate do
|
|
96
115
|
describe "when configuring the bootstrap process" do
|
97
116
|
before do
|
98
117
|
@knife_openstack_create.config[:ssh_user] = "ubuntu"
|
118
|
+
@knife_openstack_create.config[:ssh_port] = "44"
|
99
119
|
@knife_openstack_create.config[:identity_file] = "~/.ssh/key.pem"
|
100
120
|
@knife_openstack_create.config[:chef_node_name] = "blarf"
|
101
121
|
@knife_openstack_create.config[:template_file] = '~/.chef/templates/my-bootstrap.sh.erb'
|
@@ -118,6 +138,10 @@ describe Chef::Knife::OpenstackServerCreate do
|
|
118
138
|
@bootstrap.config[:ssh_user].should == 'ubuntu'
|
119
139
|
end
|
120
140
|
|
141
|
+
it "configures the bootstrap to use the correct ssh_port" do
|
142
|
+
@bootstrap.config[:ssh_port].should == '44'
|
143
|
+
end
|
144
|
+
|
121
145
|
it "configures the bootstrap to use the correct ssh identity file" do
|
122
146
|
@bootstrap.config[:identity_file].should == "~/.ssh/key.pem"
|
123
147
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-openstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fog
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
173
|
rubyforge_project:
|
174
|
-
rubygems_version: 1.8.
|
174
|
+
rubygems_version: 1.8.25
|
175
175
|
signing_key:
|
176
176
|
specification_version: 3
|
177
177
|
summary: OpenStack Compute Support for Chef's Knife Command
|