lib/chef/knife/openstack_helpers.rb in knife-openstack-1.3.2 vs lib/chef/knife/openstack_helpers.rb in knife-openstack-2.0.0
- old
+ new
@@ -1,21 +1,22 @@
-require 'chef/knife/cloud/openstack_service_options'
+# frozen_string_literal: true
+require "chef/knife/cloud/openstack_service_options"
class Chef
class Knife
class Cloud
module OpenstackHelpers
def primary_private_ip_address(addresses)
- primary_network_ip_address(addresses, 'private')
+ primary_network_ip_address(addresses, "private")
end
def primary_public_ip_address(addresses)
- primary_network_ip_address(addresses, 'public')
+ primary_network_ip_address(addresses, "public")
end
def primary_network_ip_address(addresses, network_name)
- addresses[network_name].last['addr'] if addresses[network_name] && !addresses[network_name].empty?
+ addresses[network_name].last["addr"] if addresses[network_name] && !addresses[network_name].empty?
end
def create_service_instance
OpenstackService.new
end
@@ -27,15 +28,15 @@
def instance_addresses(addresses)
info = []
if addresses[addresses.keys[0]] && addresses[addresses.keys[0]].size > 0
ips = addresses[addresses.keys[0]]
ips.each do |ip|
- version = 'IPv6' if ip['version'] == 6
- version = 'IPv4' if ip['version'] == 4
+ version = "IPv6" if ip["version"] == 6
+ version = "IPv4" if ip["version"] == 4
info << "#{addresses.keys[0]}:#{version}: #{ip['addr']}"
end
end
- info.join(' ')
+ info.join(" ")
end
end
end
end
end