Skip to content

Commit

Permalink
[core] updating Server models to use ssh_ip_address rather than publi…
Browse files Browse the repository at this point in the history
…c_ip_address
  • Loading branch information
Kyle Rames committed Jan 22, 2014
1 parent 10f019c commit 01518d3
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions lib/fog/aws/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def save
end

def setup(credentials = {})
requires :public_ip_address, :username
requires :ssh_ip_address, :username
require 'net/ssh'

commands = [
Expand All @@ -225,7 +225,7 @@ def setup(credentials = {})
# wait for aws to be ready
wait_for { sshable?(credentials) }

Fog::SSH.new(public_ip_address, username, credentials).run(commands)
Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
end

def start
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/bluebox/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def save

def setup(credentials = {})
requires :identity, :ips, :public_key, :username
Fog::SSH.new(public_ip_address, username, credentials).run([
Fog::SSH.new(ssh_ip_address, username, credentials).run([
%{mkdir .ssh},
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
%{passwd -l #{username}},
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/clodo/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def save
end

def setup(credentials = {})
requires :public_ip_address, :identity, :public_key, :username
Fog::SSH.new(public_ip_address, username, credentials).run([
requires :ssh_ip_address, :identity, :public_key, :username
Fog::SSH.new(ssh_ip_address, username, credentials).run([
%{mkdir .ssh},
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
%{passwd -l #{username}},
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/compute/models/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def ssh_options

def scp(local_path, remote_path, upload_options = {})
require 'net/scp'
requires :public_ip_address, :username
requires :ssh_ip_address, :username

Fog::SCP.new(ssh_ip_address, username, ssh_options).upload(local_path, remote_path, upload_options)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/digitalocean/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def start
end

def setup(credentials = {})
requires :public_ip_address
requires :ssh_ip_address
require 'net/ssh'

commands = [
Expand All @@ -98,7 +98,7 @@ def setup(credentials = {})
# wait for aws to be ready
wait_for { sshable?(credentials) }

Fog::SSH.new(public_ip_address, username, credentials).run(commands)
Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
end

# Creates the server (not to be called directly).
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/glesys/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def save
end

def setup(credentials = {})
requires :public_ip_address, :username
requires :ssh_ip_address, :username
require 'net/ssh'

attrs = attributes.dup
Expand All @@ -100,7 +100,7 @@ def setup(credentials = {})
# wait for glesys to be ready
wait_for { sshable?(credentials) }

Fog::SSH.new(public_ip_address, username, credentials).run(commands)
Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
end

def ssh(command, options={}, &block)
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/go_grid/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def save
end

def setup(credentials = {})
requires :identity, :public_ip_address, :public_key, :username
Fog::SSH.new(public_ip_address, username, credentials).run([
requires :identity, :ssh_ip_address, :public_key, :username
Fog::SSH.new(ssh_ip_address, username, credentials).run([
%{mkdir .ssh},
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
%{passwd -l root},
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/hp/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ def save
end

def setup(credentials = {})
requires :public_ip_address, :identity, :public_key, :username
Fog::SSH.new(public_ip_address, username, credentials).run([
requires :ssh_ip_address, :identity, :public_key, :username
Fog::SSH.new(ssh_ip_address, username, credentials).run([
%{mkdir .ssh},
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
%{passwd -l #{username}},
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/hp/models/compute_v2/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ def save
end

def setup(credentials = {})
requires :public_ip_address, :identity, :public_key, :username
Fog::SSH.new(public_ip_address, username, credentials).run([
requires :ssh_ip_address, :identity, :public_key, :username
Fog::SSH.new(ssh_ip_address, username, credentials).run([
%{mkdir .ssh},
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
%{passwd -l #{username}},
Expand Down
12 changes: 6 additions & 6 deletions lib/fog/libvirt/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def public_ip_address
end

def ssh(commands)
requires :public_ip_address, :username
requires :ssh_ip_address, :username

ssh_options={}
ssh_options[:password] = password unless password.nil?
Expand All @@ -153,19 +153,19 @@ def ssh_proxy

# Transfers a file
def scp(local_path, remote_path, upload_options = {})
requires :public_ip_address, :username
requires :ssh_ip_address, :username

scp_options = {}
scp_options[:password] = password unless self.password.nil?
scp_options[:key_data] = [private_key] if self.private_key
scp_options[:proxy]= ssh_proxy unless self.ssh_proxy.nil?

Fog::SCP.new(public_ip_address, username, scp_options).upload(local_path, remote_path, upload_options)
Fog::SCP.new(ssh_ip_address, username, scp_options).upload(local_path, remote_path, upload_options)
end

# Sets up a new key
def setup(credentials = {})
requires :public_key, :public_ip_address, :username
requires :public_key, :ssh_ip_address, :username

credentials[:proxy]= ssh_proxy unless ssh_proxy.nil?
credentials[:password] = password unless self.password.nil?
Expand All @@ -184,7 +184,7 @@ def setup(credentials = {})
Timeout::timeout(360) do
begin
Timeout::timeout(8) do
Fog::SSH.new(public_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')
Fog::SSH.new(ssh_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')
end
rescue Errno::ECONNREFUSED
sleep(2)
Expand All @@ -193,7 +193,7 @@ def setup(credentials = {})
retry
end
end
Fog::SSH.new(public_ip_address, username, credentials).run(commands)
Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
end

def update_display attrs = {}
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/openstack/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ def save
end

def setup(credentials = {})
requires :public_ip_address, :identity, :public_key, :username
Fog::SSH.new(public_ip_address, username, credentials).run([
requires :ssh_ip_address, :identity, :public_key, :username
Fog::SSH.new(ssh_ip_address, username, credentials).run([
%{mkdir .ssh},
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
%{passwd -l #{username}},
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/rackspace/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def save(options = {})
end

def setup(credentials = {})
requires :public_ip_address, :identity, :public_key, :username
Fog::SSH.new(public_ip_address, username, credentials).run([
requires :ssh_ip_address, :identity, :public_key, :username
Fog::SSH.new(ssh_ip_address, username, credentials).run([
%{mkdir .ssh},
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
%{passwd -l #{username}},
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/rackspace/models/compute_v2/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def change_admin_password(password)
# Setup server for SSH access
# @see Servers#bootstrap
def setup(credentials = {})
requires :public_ip_address, :identity, :public_key, :username
requires :ssh_ip_address, :identity, :public_key, :username

commands = [
%{mkdir .ssh},
Expand All @@ -534,7 +534,7 @@ def setup(credentials = {})

@password = nil if password_lock

Fog::SSH.new(public_ip_address, username, credentials).run(commands)
Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
rescue Errno::ECONNREFUSED
sleep(1)
retry
Expand Down
10 changes: 5 additions & 5 deletions lib/fog/vmfusion/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,19 @@ def ssh(commands)

# SCP something to our VM.
def scp(local_path, remote_path, upload_options = {})
requires :ipaddress, :username
requires :ssh_ip_address, :username

scp_options = {}
scp_options[:password] = password unless self.password.nil?
scp_options[:key_data] = [private_key] if self.private_key

Fog::SCP.new(ipaddress, username, scp_options).upload(local_path, remote_path, upload_options)
Fog::SCP.new(ssh_ip_address, username, scp_options).upload(local_path, remote_path, upload_options)
end

# Sets up a new SSH key on the VM so one doesn't need to use a password
# ever again.
def setup(credentials = {})
requires :public_key, :ipaddress, :username
requires :public_key, :ssh_ip_address, :username

credentials[:password] = password unless self.password.nil?
credentails[:key_data] = [private_key] if self.private_key
Expand All @@ -213,7 +213,7 @@ def setup(credentials = {})
Timeout::timeout(360) do
begin
Timeout::timeout(8) do
Fog::SSH.new(ipaddress, username, credentials.merge(:timeout => 4)).run('pwd')
Fog::SSH.new(ssh_ip_address, username, credentials.merge(:timeout => 4)).run('pwd')
end
rescue Errno::ECONNREFUSED
sleep(2)
Expand All @@ -222,7 +222,7 @@ def setup(credentials = {})
retry
end
end
Fog::SSH.new(ipaddress, username, credentials).run(commands)
Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
end

private
Expand Down

0 comments on commit 01518d3

Please sign in to comment.