knife-openstack 1.3.2.pre → 1.3.2.pre.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile +1 -1
  4. data/Rakefile +7 -28
  5. data/knife-openstack.gemspec +16 -16
  6. data/lib/chef/knife/cloud/openstack_server_create_options.rb +44 -44
  7. data/lib/chef/knife/cloud/openstack_service.rb +27 -31
  8. data/lib/chef/knife/cloud/openstack_service_options.rb +25 -26
  9. data/lib/chef/knife/openstack_flavor_list.rb +9 -10
  10. data/lib/chef/knife/openstack_floating_ip_allocate.rb +4 -4
  11. data/lib/chef/knife/openstack_floating_ip_associate.rb +5 -5
  12. data/lib/chef/knife/openstack_floating_ip_disassociate.rb +4 -4
  13. data/lib/chef/knife/openstack_group_list.rb +9 -11
  14. data/lib/chef/knife/openstack_helpers.rb +14 -2
  15. data/lib/chef/knife/openstack_image_list.rb +14 -15
  16. data/lib/chef/knife/openstack_network_list.rb +8 -9
  17. data/lib/chef/knife/openstack_server_create.rb +81 -84
  18. data/lib/chef/knife/openstack_server_delete.rb +25 -26
  19. data/lib/chef/knife/openstack_server_list.rb +13 -19
  20. data/lib/chef/knife/openstack_server_show.rb +11 -12
  21. data/lib/chef/knife/openstack_volume_list.rb +10 -12
  22. data/lib/knife-openstack/version.rb +1 -1
  23. data/spec/functional/flavor_list_func_spec.rb +11 -11
  24. data/spec/functional/floating_ip_list_func_spec.rb +11 -11
  25. data/spec/functional/group_list_func_spec.rb +27 -31
  26. data/spec/functional/image_list_func_spec.rb +14 -14
  27. data/spec/functional/network_list_func_spec.rb +10 -10
  28. data/spec/functional/server_create_func_spec.rb +23 -24
  29. data/spec/functional/server_delete_func_spec.rb +16 -17
  30. data/spec/functional/server_list_func_spec.rb +39 -39
  31. data/spec/functional/server_show_func_spec.rb +4 -5
  32. data/spec/functional/volume_list_func_spec.rb +9 -9
  33. data/spec/integration/cleanup.rb +8 -11
  34. data/spec/integration/openstack_spec.rb +377 -347
  35. data/spec/spec_context.rb +10 -10
  36. data/spec/spec_helper.rb +23 -27
  37. data/spec/unit/openstack_flavor_list_spec.rb +1 -1
  38. data/spec/unit/openstack_floating_ip_allocate_spec.rb +2 -3
  39. data/spec/unit/openstack_floating_ip_associate_spec.rb +2 -2
  40. data/spec/unit/openstack_floating_ip_disassociate_spec.rb +3 -3
  41. data/spec/unit/openstack_floating_ip_release_spec.rb +1 -1
  42. data/spec/unit/openstack_group_list_spec.rb +7 -7
  43. data/spec/unit/openstack_image_list_spec.rb +2 -2
  44. data/spec/unit/openstack_network_list_spec.rb +4 -4
  45. data/spec/unit/openstack_server_create_spec.rb +117 -118
  46. data/spec/unit/openstack_server_delete_spec.rb +4 -4
  47. data/spec/unit/openstack_server_list_spec.rb +2 -2
  48. data/spec/unit/openstack_server_show_spec.rb +6 -6
  49. data/spec/unit/openstack_service_spec.rb +20 -20
  50. data/spec/unit/openstack_volume_list_spec.rb +1 -1
  51. metadata +30 -2
@@ -16,10 +16,10 @@ class Chef
16
16
  banner 'knife openstack floating_ip disassociate IP (options)'
17
17
 
18
18
  option :instance_id,
19
- :long => '--instance-id ID',
20
- :description => 'Instance id to disassociate with.',
21
- :proc => Proc.new { |key| Chef::Config[:knife][:instance_id] = key },
22
- :required => true
19
+ long: '--instance-id ID',
20
+ description: 'Instance id to disassociate with.',
21
+ proc: proc { |key| Chef::Config[:knife][:instance_id] = key },
22
+ required: true
23
23
 
24
24
  def execute_command
25
25
  if @name_args[0]
@@ -9,27 +9,25 @@ class Chef
9
9
  include OpenstackHelpers
10
10
  include OpenstackServiceOptions
11
11
 
12
- banner "knife openstack group list (options)"
12
+ banner 'knife openstack group list (options)'
13
13
 
14
14
  def query_resource
15
- begin
16
- @service.connection.security_groups
17
- rescue Excon::Errors::BadRequest => e
18
- response = Chef::JSONCompat.from_json(e.response.body)
19
- ui.fatal("Unknown server error (#{response['badRequest']['code']}): #{response['badRequest']['message']}")
20
- raise e
21
- end
15
+ @service.connection.security_groups
16
+ rescue Excon::Errors::BadRequest => e
17
+ response = Chef::JSONCompat.from_json(e.response.body)
18
+ ui.fatal("Unknown server error (#{response['badRequest']['code']}): #{response['badRequest']['message']}")
19
+ raise e
22
20
  end
23
21
 
24
22
  def list(security_groups)
25
- if(config[:format] == "summary")
23
+ if (config[:format] == 'summary')
26
24
  group_list = [
27
25
  ui.color('Name', :bold),
28
26
  ui.color('Protocol', :bold),
29
27
  ui.color('From', :bold),
30
28
  ui.color('To', :bold),
31
29
  ui.color('CIDR', :bold),
32
- ui.color('Description', :bold),
30
+ ui.color('Description', :bold)
33
31
  ]
34
32
  security_groups.sort_by(&:name).each do |group|
35
33
  group.security_group_rules.each do |rule|
@@ -52,4 +50,4 @@ class Chef
52
50
  end
53
51
  end
54
52
  end
55
- end
53
+ end
@@ -4,7 +4,6 @@ class Chef
4
4
  class Knife
5
5
  class Cloud
6
6
  module OpenstackHelpers
7
-
8
7
  def primary_private_ip_address(addresses)
9
8
  primary_network_ip_address(addresses, 'private')
10
9
  end
@@ -14,7 +13,7 @@ class Chef
14
13
  end
15
14
 
16
15
  def primary_network_ip_address(addresses, network_name)
17
- return addresses[network_name].last['addr'] if addresses[network_name] && !addresses[network_name].empty?
16
+ addresses[network_name].last['addr'] if addresses[network_name] && !addresses[network_name].empty?
18
17
  end
19
18
 
20
19
  def create_service_instance
@@ -24,6 +23,19 @@ class Chef
24
23
  def validate!
25
24
  super(:openstack_username, :openstack_password, :openstack_auth_url)
26
25
  end
26
+
27
+ def instance_addresses(addresses)
28
+ info = []
29
+ if addresses[addresses.keys[0]] && addresses[addresses.keys[0]].size > 0
30
+ ips = addresses[addresses.keys[0]]
31
+ ips.each do |ip|
32
+ version = 'IPv6' if ip['version'] == 6
33
+ version = 'IPv4' if ip['version'] == 4
34
+ info << "#{addresses.keys[0]}:#{version}: #{ip['addr']}"
35
+ end
36
+ end
37
+ info.join(' ')
38
+ end
27
39
  end
28
40
  end
29
41
  end
@@ -12,26 +12,26 @@ class Chef
12
12
  include OpenstackHelpers
13
13
  include OpenstackServiceOptions
14
14
 
15
- banner "knife openstack image list (options)"
15
+ banner 'knife openstack image list (options)'
16
16
 
17
17
  option :disable_filter,
18
- :long => "--disable-filter",
19
- :description => "Disable filtering of the image list. Currently filters names ending with 'initrd' or 'kernel'",
20
- :boolean => true,
21
- :default => false
18
+ long: '--disable-filter',
19
+ description: "Disable filtering of the image list. Currently filters names ending with 'initrd' or 'kernel'",
20
+ boolean: true,
21
+ default: false
22
22
 
23
23
  def before_exec_command
24
- #set resource_filters
25
- if !config[:disable_filter]
26
- @resource_filters = [{:attribute => 'name', :regex => /initrd$|kernel$|loader$|virtual$|vmlinuz$/}]
24
+ # set resource_filters
25
+ unless config[:disable_filter]
26
+ @resource_filters = [{ attribute: 'name', regex: /initrd$|kernel$|loader$|virtual$|vmlinuz$/ }]
27
27
  end
28
- #set columns_with_info map
28
+ # set columns_with_info map
29
29
  @columns_with_info = [
30
- {:label => 'Name', :key => 'name'},
31
- {:label => 'ID', :key => 'id'},
32
- {:label => 'Snapshot', :key => 'metadata', :value_callback => method(:is_image_snapshot)}
30
+ { label: 'Name', key: 'name' },
31
+ { label: 'ID', key: 'id' },
32
+ { label: 'Snapshot', key: 'metadata', value_callback: method(:is_image_snapshot) }
33
33
  ]
34
- @sort_by_field = "name"
34
+ @sort_by_field = 'name'
35
35
  end
36
36
 
37
37
  def query_resource
@@ -47,8 +47,7 @@ class Chef
47
47
  end
48
48
  snapshot
49
49
  end
50
-
51
50
  end
52
51
  end
53
52
  end
54
- end
53
+ end
@@ -12,24 +12,23 @@ class Chef
12
12
  include OpenstackHelpers
13
13
  include OpenstackServiceOptions
14
14
 
15
- banner "knife openstack network list (options)"
15
+ banner 'knife openstack network list (options)'
16
16
 
17
17
  def before_exec_command
18
- #set columns_with_info map
18
+ # set columns_with_info map
19
19
  @columns_with_info = [
20
- {:label => 'Name', :key => 'name'},
21
- {:label => 'ID', :key => 'id'},
22
- {:label => 'Tenant', :key => 'tenant_id'},
23
- {:label => 'Shared', :key => 'shared'}
20
+ { label: 'Name', key: 'name' },
21
+ { label: 'ID', key: 'id' },
22
+ { label: 'Tenant', key: 'tenant_id' },
23
+ { label: 'Shared', key: 'shared' }
24
24
  ]
25
- @sort_by_field = "name"
25
+ @sort_by_field = 'name'
26
26
  end
27
27
 
28
28
  def query_resource
29
29
  @service.list_networks
30
30
  end
31
-
32
31
  end
33
32
  end
34
33
  end
35
- end
34
+ end
@@ -33,55 +33,54 @@ class Chef
33
33
  include OpenstackServerCreateOptions
34
34
  include OpenstackServiceOptions
35
35
 
36
-
37
- banner "knife openstack server create (options)"
36
+ banner 'knife openstack server create (options)'
38
37
 
39
38
  def before_exec_command
40
- super
41
- # setup the create options
42
- @create_options = {
43
- :server_def => {
44
- #servers require a name, knife-cloud generates the chef_node_name
45
- :name => config[:chef_node_name],
46
- :image_ref => service.get_image(locate_config_value(:image)).id,
47
- :flavor_ref => service.get_flavor(locate_config_value(:flavor)).id,
48
- :security_groups => locate_config_value(:openstack_security_groups),
49
- :availability_zone => locate_config_value(:availability_zone),
50
- "os:scheduler_hints" => locate_config_value(:openstack_scheduler_hints),
51
- :metadata => locate_config_value(:metadata),
52
- :key_name => locate_config_value(:openstack_ssh_key_id)
53
- },
54
- :server_create_timeout => locate_config_value(:server_create_timeout)
55
- }
56
- unless locate_config_value(:openstack_volumes).nil?
57
- counter = 99
58
- @create_options[:server_def][:block_device_mapping] = locate_config_value(:openstack_volumes).map do |vol|
59
- counter += 1
60
- {
61
- :volume_id => vol,
62
- :delete_on_termination => false,
63
- :device_name => "/dev/vd"+counter.chr,
64
- :volume_size => nil,
65
- }
66
- end
39
+ super
40
+ # setup the create options
41
+ @create_options = {
42
+ server_def: {
43
+ # servers require a name, knife-cloud generates the chef_node_name
44
+ :name => config[:chef_node_name],
45
+ :image_ref => service.get_image(locate_config_value(:image)).id,
46
+ :flavor_ref => service.get_flavor(locate_config_value(:flavor)).id,
47
+ :security_groups => locate_config_value(:openstack_security_groups),
48
+ :availability_zone => locate_config_value(:availability_zone),
49
+ 'os:scheduler_hints' => locate_config_value(:openstack_scheduler_hints),
50
+ :metadata => locate_config_value(:metadata),
51
+ :key_name => locate_config_value(:openstack_ssh_key_id)
52
+ },
53
+ server_create_timeout: locate_config_value(:server_create_timeout)
54
+ }
55
+ unless locate_config_value(:openstack_volumes).nil?
56
+ counter = 99
57
+ @create_options[:server_def][:block_device_mapping] = locate_config_value(:openstack_volumes).map do |vol|
58
+ counter += 1
59
+ {
60
+ volume_id: vol,
61
+ delete_on_termination: false,
62
+ device_name: '/dev/vd' + counter.chr,
63
+ volume_size: nil
64
+ }
67
65
  end
66
+ end
68
67
 
69
- @create_options[:server_def].merge!({:user_data => locate_config_value(:user_data)}) if locate_config_value(:user_data)
70
- @create_options[:server_def].merge!({:nics => locate_config_value(:network_ids).map { |nic| nic_id = { 'net_id' => nic }}}) if locate_config_value(:network_ids)
71
-
72
- Chef::Log.debug("Create server params - server_def = #{@create_options[:server_def]}")
73
- #set columns_with_info map
74
- @columns_with_info = [
75
- {:label => 'Instance ID', :key => 'id'},
76
- {:label => 'Name', :key => 'name'},
77
- {:label => 'Public IP', :key => 'addresses', :value_callback => method(:primary_public_ip_address)},
78
- {:label => 'Private IP', :key => 'addresses', :value_callback => method(:primary_private_ip_address)},
79
- {:label => 'Flavor', :key => 'flavor', :value_callback => method(:get_id)},
80
- {:label => 'Image', :key => 'image', :value_callback => method(:get_id)},
81
- {:label => 'Keypair', :key => 'key_name'},
82
- {:label => 'State', :key => 'state'},
83
- {:label => 'Availability Zone', :key => 'availability_zone'}
84
- ]
68
+ @create_options[:server_def].merge!(user_data: locate_config_value(:user_data)) if locate_config_value(:user_data)
69
+ @create_options[:server_def].merge!(nics: locate_config_value(:network_ids).map { |nic| nic_id = { 'net_id' => nic } }) if locate_config_value(:network_ids)
70
+
71
+ Chef::Log.debug("Create server params - server_def = #{@create_options[:server_def]}")
72
+ # set columns_with_info map
73
+ @columns_with_info = [
74
+ { label: 'Instance ID', key: 'id' },
75
+ { label: 'Name', key: 'name' },
76
+ { label: 'Public IP', key: 'addresses', value_callback: method(:primary_public_ip_address) },
77
+ { label: 'Private IP', key: 'addresses', value_callback: method(:primary_private_ip_address) },
78
+ { label: 'Flavor', key: 'flavor', value_callback: method(:get_id) },
79
+ { label: 'Image', key: 'image', value_callback: method(:get_id) },
80
+ { label: 'Keypair', key: 'key_name' },
81
+ { label: 'State', key: 'state' },
82
+ { label: 'Availability Zone', key: 'availability_zone' }
83
+ ]
85
84
  end
86
85
 
87
86
  def get_id(value)
@@ -91,22 +90,22 @@ class Chef
91
90
  # Setup the floating ip after server creation.
92
91
  def after_exec_command
93
92
  Chef::Log.debug("Addresses #{server.addresses}")
94
- msg_pair("Public IP Address", primary_public_ip_address(server.addresses)) if primary_public_ip_address(server.addresses)
95
- msg_pair("Private IP Address", primary_private_ip_address(server.addresses)) if primary_private_ip_address(server.addresses)
93
+ msg_pair('Public IP Address', primary_public_ip_address(server.addresses)) if primary_public_ip_address(server.addresses)
94
+ msg_pair('Private IP Address', primary_private_ip_address(server.addresses)) if primary_private_ip_address(server.addresses)
96
95
 
97
96
  floating_address = locate_config_value(:openstack_floating_ip)
98
- bind_ip = primary_network_ip_address(server.addresses,server.addresses.keys[0])
97
+ bind_ip = primary_network_ip_address(server.addresses, server.addresses.keys[0])
99
98
  Chef::Log.debug("Floating IP Address requested #{floating_address}")
100
- unless (floating_address == '-1') #no floating IP requested
99
+ unless (floating_address == '-1') # no floating IP requested
101
100
  addresses = service.connection.addresses
102
- #floating requested without value
101
+ # floating requested without value
103
102
  if floating_address.nil?
104
- free_floating = addresses.find_index {|a| a.fixed_ip.nil?}
103
+ free_floating = addresses.find_index { |a| a.fixed_ip.nil? }
105
104
  begin
106
- if free_floating.nil? #no free floating IP found
107
- error_message = "Unable to assign a Floating IP from allocated IPs."
105
+ if free_floating.nil? # no free floating IP found
106
+ error_message = 'Unable to assign a Floating IP from allocated IPs.'
108
107
  ui.fatal(error_message)
109
- raise CloudExceptions::ServerSetupError, error_message
108
+ fail CloudExceptions::ServerSetupError, error_message
110
109
  else
111
110
  floating_address = addresses[free_floating].ip
112
111
  end
@@ -117,22 +116,22 @@ class Chef
117
116
  end
118
117
 
119
118
  # Pull the port_id for the associate_floating_ip
120
- port_id = @service.network.list_ports[:body]['ports'].find {|x| x['fixed_ips'][0]['ip_address'] == bind_ip}['id']
121
- fixed_ip_address = service.network.list_ports[:body]["ports"].find {|x| x['id'] == port_id}['fixed_ips'][0]["ip_address"]
119
+ port_id = @service.network.list_ports[:body]['ports'].find { |x| x['fixed_ips'][0]['ip_address'] == bind_ip }['id']
120
+ fixed_ip_address = service.network.list_ports[:body]['ports'].find { |x| x['id'] == port_id }['fixed_ips'][0]['ip_address']
122
121
 
123
122
  floating_ip_id = get_floating_ip_id(floating_address)
124
123
  # Associate the floating ip via the neutron/network api
125
- @service.network.associate_floating_ip(floating_ip_id, port_id, {:fixed_ip_address => fixed_ip_address })
124
+ @service.network.associate_floating_ip(floating_ip_id, port_id, fixed_ip_address: fixed_ip_address)
126
125
 
127
- #a bit of a hack, but server.reload takes a long time
128
- (server.addresses['public'] ||= []) << {"version"=>4,"addr"=>floating_address}
129
- msg_pair("Floating IP Address", floating_address)
126
+ # a bit of a hack, but server.reload takes a long time
127
+ (server.addresses['public'] ||= []) << { 'version' => 4, 'addr' => floating_address }
128
+ msg_pair('Floating IP Address', floating_address)
130
129
  end
131
130
 
132
131
  Chef::Log.debug("Addresses #{server.addresses}")
133
132
  Chef::Log.debug("Public IP Address actual: #{primary_public_ip_address(server.addresses)}") if primary_public_ip_address(server.addresses)
134
133
 
135
- msg_pair("Private IP Address", primary_private_ip_address(server.addresses)) if primary_private_ip_address(server.addresses)
134
+ msg_pair('Private IP Address', primary_private_ip_address(server.addresses)) if primary_private_ip_address(server.addresses)
136
135
  super
137
136
  end
138
137
 
@@ -145,13 +144,13 @@ class Chef
145
144
  # The bootstrap network is always initialised to 'public' when a network name isn't specified. Therefore,
146
145
  # only set the bootstrap network to 'private' if still initialised to public and nothing was specified for
147
146
  # the private network name.
148
- config[:bootstrap_network] = 'private' if (config[:private_network] && config[:bootstrap_network] == 'public')
147
+ config[:bootstrap_network] = 'private' if config[:private_network] && config[:bootstrap_network] == 'public'
149
148
 
150
149
  # Which IP address to bootstrap
151
150
  unless config[:network] # --no-network
152
151
  bootstrap_ip_address = primary_public_ip_address(server.addresses) ||
153
- primary_private_ip_address(server.addresses) ||
154
- server.addresses.first[1][0]['addr']
152
+ primary_private_ip_address(server.addresses) ||
153
+ server.addresses.first[1][0]['addr']
155
154
  Chef::Log.debug("No Bootstrap Network: #{config[:bootstrap_network]}")
156
155
  else
157
156
  bootstrap_ip_address = primary_network_ip_address(server.addresses, config[:bootstrap_network])
@@ -160,14 +159,14 @@ class Chef
160
159
 
161
160
  Chef::Log.debug("Bootstrap IP Address: #{bootstrap_ip_address}")
162
161
  if bootstrap_ip_address.nil?
163
- error_message = "No IP address available for bootstrapping."
162
+ error_message = 'No IP address available for bootstrapping.'
164
163
  ui.error(error_message)
165
- raise CloudExceptions::BootstrapError, error_message
164
+ fail CloudExceptions::BootstrapError, error_message
166
165
  end
167
166
  config[:bootstrap_ip_address] = bootstrap_ip_address
168
167
 
169
168
  config[:hints] ||= {}
170
- config[:hints]["openstack"] ||= {}
169
+ config[:hints]['openstack'] ||= {}
171
170
  end
172
171
 
173
172
  def validate_params!
@@ -178,15 +177,15 @@ class Chef
178
177
 
179
178
  if locate_config_value(:bootstrap_protocol) == 'winrm'
180
179
  if locate_config_value(:winrm_password).nil?
181
- errors << "You must provide Winrm Password."
180
+ errors << 'You must provide Winrm Password.'
182
181
  end
183
182
  elsif locate_config_value(:bootstrap_protocol) != 'ssh'
184
- errors << "You must provide a valid bootstrap protocol. options [ssh/winrm]. For linux type images, options [ssh]"
183
+ errors << 'You must provide a valid bootstrap protocol. options [ssh/winrm]. For linux type images, options [ssh]'
185
184
  end
186
185
 
187
- errors << "You must provide --image-os-type option [windows/linux]" if ! (%w(windows linux).include?(locate_config_value(:image_os_type)))
188
- error_message = ""
189
- raise CloudExceptions::ValidationError, error_message if errors.each{|e| ui.error(e); error_message = "#{error_message} #{e}."}.any?
186
+ errors << 'You must provide --image-os-type option [windows/linux]' unless %w(windows linux).include?(locate_config_value(:image_os_type))
187
+ error_message = ''
188
+ fail CloudExceptions::ValidationError, error_message if errors.each { |e| ui.error(e); error_message = "#{error_message} #{e}." }.any?
190
189
  end
191
190
 
192
191
  def is_image_valid?
@@ -200,9 +199,7 @@ class Chef
200
199
  def is_floating_ip_valid?
201
200
  address = locate_config_value(:openstack_floating_ip)
202
201
 
203
- if address == '-1' # no floating IP requested
204
- return true
205
- end
202
+ return true if address == '-1' # no floating IP requested
206
203
 
207
204
  addresses = service.connection.addresses
208
205
  return false if addresses.empty? # no floating IPs
@@ -225,23 +222,23 @@ class Chef
225
222
 
226
223
  def post_connection_validations
227
224
  errors = []
228
- errors << "You have not provided a valid image ID. Please note the options for this value are -I or --image." if !is_image_valid?
229
- errors << "You have not provided a valid flavor ID. Please note the options for this value are -f or --flavor." if !is_flavor_valid?
230
- errors << "You have either requested an invalid floating IP address or none are available." if !is_floating_ip_valid?
231
- error_message = ""
232
- raise CloudExceptions::ValidationError, error_message if errors.each{|e| ui.error(e); error_message = "#{error_message} #{e}."}.any?
225
+ errors << 'You have not provided a valid image ID. Please note the options for this value are -I or --image.' unless is_image_valid?
226
+ errors << 'You have not provided a valid flavor ID. Please note the options for this value are -f or --flavor.' unless is_flavor_valid?
227
+ errors << 'You have either requested an invalid floating IP address or none are available.' unless is_floating_ip_valid?
228
+ error_message = ''
229
+ fail CloudExceptions::ValidationError, error_message if errors.each { |e| ui.error(e); error_message = "#{error_message} #{e}." }.any?
233
230
  end
234
231
 
235
232
  def get_floating_ip_id(floating_address)
236
233
  # required for this method to work
237
234
  floating_ip_id = -1
238
235
  # Figure out the id for the port that the floating ip you requested
239
- @service.network.list_floating_ips[:body]["floatingips"].each do |x|
240
- if x["floating_ip_address"] == floating_address
241
- floating_ip_id = x["id"]
236
+ @service.network.list_floating_ips[:body]['floatingips'].each do |x|
237
+ if x['floating_ip_address'] == floating_address
238
+ floating_ip_id = x['id']
242
239
  end
243
240
  end
244
- return floating_ip_id
241
+ floating_ip_id
245
242
  end
246
243
  end
247
244
  end
@@ -1,26 +1,25 @@
1
- #
2
- # Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
3
- # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
4
- # Copyright:: Copyright (c) 2013 Chef Software, Inc.
5
- #
6
-
7
- require 'chef/knife/cloud/server/delete_options'
8
- require 'chef/knife/cloud/server/delete_command'
9
- require 'chef/knife/cloud/openstack_service'
10
- require 'chef/knife/cloud/openstack_service_options'
11
- require 'chef/knife/openstack_helpers'
12
-
13
- class Chef
14
- class Knife
15
- class Cloud
16
- class OpenstackServerDelete < ServerDeleteCommand
17
- include ServerDeleteOptions
18
- include OpenstackServiceOptions
19
- include OpenstackHelpers
20
-
21
- banner "knife openstack server delete INSTANCEID [INSTANCEID] (options)"
22
-
23
- end
24
- end
25
- end
26
- end
1
+ #
2
+ # Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
3
+ # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
4
+ # Copyright:: Copyright (c) 2013 Chef Software, Inc.
5
+ #
6
+
7
+ require 'chef/knife/cloud/server/delete_options'
8
+ require 'chef/knife/cloud/server/delete_command'
9
+ require 'chef/knife/cloud/openstack_service'
10
+ require 'chef/knife/cloud/openstack_service_options'
11
+ require 'chef/knife/openstack_helpers'
12
+
13
+ class Chef
14
+ class Knife
15
+ class Cloud
16
+ class OpenstackServerDelete < ServerDeleteCommand
17
+ include ServerDeleteOptions
18
+ include OpenstackServiceOptions
19
+ include OpenstackHelpers
20
+
21
+ banner 'knife openstack server delete INSTANCEID [INSTANCEID] (options)'
22
+ end
23
+ end
24
+ end
25
+ end