Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ vagrant will authenticate against the UK authentication endpoint.
* `disk_config` - Disk Configuration 'AUTO' or 'MANUAL'
* `metadata` - A set of key pair values that will be passed to the instance
for configuration.
* `network_name` - Network name to be usd for communicating with the server.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo


These can be set like typical provider-specific configuration:

Expand Down
13 changes: 10 additions & 3 deletions lib/vagrant-rackspace/action/read_ssh_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@ def read_ssh_info(rackspace, machine)
return nil
end

server_ip_address = machine.provider_config.network_name ?
ip_address(server, machine.provider_config.network_name) : server.public_ip_address

# Read the DNS info
return {
:host => server.ipv4_address,
:port => 22,
:username => "root"
:host => machine.config.ssh.host ? machine.config.ssh.host : server_ip_address,
:port => machine.config.ssh.port ? machine.config.ssh.port : 22,
:username => machine.config.ssh.username ? machine.config.ssh.username : 'root'
}
end

def ip_address(server, network_name)
server.addresses[network_name].select{|a| a["version"] == 4}[0]["addr"] rescue ''
end
end
end
end
Expand Down
5 changes: 5 additions & 0 deletions lib/vagrant-rackspace/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ class Config < Vagrant.plugin("2", :config)
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Server_Personality-d1e2543.html Server Personality
attr_accessor :init_script

# Network name to be use for connecting to the server. Particularly useful in case public network is disabled.
#
# @return [String]
attr_accessor :network_name

# Default Rackspace Cloud Network IDs
SERVICE_NET_ID = '11111111-1111-1111-1111-111111111111'
PUBLIC_NET_ID = '00000000-0000-0000-0000-000000000000'
Expand Down