Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Commit

Permalink
Code review feedback and documentation cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam DePue committed Jun 7, 2013
1 parent ed7c954 commit 20d7b29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/chef/knife/rackspace_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def public_dns_name(server)
@public_dns_name ||= begin
Resolv.getname(ip_address)
rescue
"#{ip_address.gsub('.','-')}.static.cloud-ips.com"
"#{ip_address.gsub('.','-')}.static.cloud-ips.com" unless ip_address == nil
end
end

Expand Down
10 changes: 4 additions & 6 deletions lib/chef/knife/rackspace_server_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class RackspaceServerCreate < Knife
:default => true

option :default_networks,
:long => "--[no-]-default-networks",
:long => "--[no-]default-networks",
:description => "Include public and service networks, enabled by default",
:boolean => true,
:default => true
Expand Down Expand Up @@ -405,7 +405,7 @@ def get_node_name(chef_node_name)
end

def get_networks(names)
names = Array(names) unless names.is_a?(Array)
names = Array(names)
if(Chef::Config[:knife][:rackspace_version] == 'v2')
if(config[:default_networks])
nets = [
Expand All @@ -415,12 +415,10 @@ def get_networks(names)
else
nets = []
end
found_nets = connection.networks.find_all do |n|
names.include?(n.label) || names.include?(n.id)
end
available_networks = connection.networks.all

names.each do |name|
net = found_nets.detect{|n| n.label == name || n.id == name}
net = available_networks.detect{|n| n.label == name || n.id == name}
if(net)
nets << net.id
else
Expand Down

0 comments on commit 20d7b29

Please sign in to comment.