Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fog/fog into auth20
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Rames committed Mar 11, 2013
2 parents bf91142 + 87b60dc commit ae9287a
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/fog/aws/models/compute/server.rb
Expand Up @@ -202,7 +202,7 @@ def setup(credentials = {})
end

# wait for aws to be ready
wait_for { sshable? }
wait_for { sshable?(credentials) }

Fog::SSH.new(public_ip_address, username, credentials).run(commands)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/models/storage/file.rb
Expand Up @@ -223,7 +223,7 @@ def save(options = {})
#
# required attributes: key
#
# @param expires [String] number of seconds before url expires
# @param expires [String] number of seconds (since 1970-01-01 00:00) before url expires
# @param options [Hash]
# @return [String] url
#
Expand Down
3 changes: 3 additions & 0 deletions lib/fog/compute.rb
Expand Up @@ -35,6 +35,9 @@ def self.new(attributes)
when :stormondemand
require 'fog/storm_on_demand/compute'
Fog::Compute::StormOnDemand.new(attributes)
when :vcloud
require 'fog/vcloud/compute'
Fog::Vcloud::Compute.new(attributes)
else
if self.providers.include?(provider)
require "fog/#{provider}/compute"
Expand Down
4 changes: 2 additions & 2 deletions lib/fog/compute/models/server.rb
Expand Up @@ -62,8 +62,8 @@ def ssh_port
22
end

def sshable?
ready? && !public_ip_address.nil? && !!Timeout::timeout(8) { ssh 'pwd' }
def sshable?(options={})
ready? && !public_ip_address.nil? && !!Timeout::timeout(8) { ssh('pwd', options) }
rescue SystemCallError, Net::SSH::AuthenticationFailed, Timeout::Error
false
end
Expand Down
6 changes: 3 additions & 3 deletions lib/fog/glesys/models/compute/server.rb
Expand Up @@ -87,13 +87,13 @@ def setup(credentials = {})
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
end

# wait for aws to be ready
wait_for { sshable? }

if credentials[:password].nil? && !rootpassword.nil?
credentials[:password] = rootpassword
end

# wait for glesys to be ready
wait_for { sshable?(credentials) }

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

Expand Down
4 changes: 4 additions & 0 deletions lib/fog/openstack/image.rb
Expand Up @@ -206,6 +206,10 @@ def authenticate
@host = uri.host
@path = uri.path
@path.sub!(/\/$/, '')
unless @path.match(/v1(\.1)*/)
raise Fog::OpenStack::Errors::ServiceUnavailable.new(
"OpenStack binding only supports version 1.1 (a.k.a. 1)")
end
@port = uri.port
@scheme = uri.scheme
true
Expand Down
5 changes: 3 additions & 2 deletions lib/fog/openstack/network.rb
Expand Up @@ -7,7 +7,7 @@ class OpenStack < Fog::Service
requires :openstack_auth_url
recognizes :openstack_auth_token, :openstack_management_url, :persistent,
:openstack_service_type, :openstack_service_name, :openstack_tenant,
:openstack_api_key, :openstack_username,
:openstack_api_key, :openstack_username, :openstack_endpoint_type,
:current_user, :current_tenant

## MODELS
Expand Down Expand Up @@ -120,6 +120,7 @@ def initialize(options={})
@openstack_must_reauthenticate = false
@openstack_service_type = options[:openstack_service_type] || ['network']
@openstack_service_name = options[:openstack_service_name]
@openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'

@connection_options = options[:connection_options] || {}

Expand Down Expand Up @@ -192,7 +193,7 @@ def authenticate
:openstack_auth_token => @openstack_auth_token,
:openstack_service_type => @openstack_service_type,
:openstack_service_name => @openstack_service_name,
:openstack_endpoint_type => 'adminURL'
:openstack_endpoint_type => @openstack_endpoint_type
}

credentials = Fog::OpenStack.authenticate_v2(options, @connection_options)
Expand Down
10 changes: 9 additions & 1 deletion lib/fog/openstack/requests/compute/rebuild_server.rb
Expand Up @@ -11,7 +11,15 @@ def rebuild_server(server_id, image_ref, name, admin_pass=nil, metadata=nil, per
}}
body['rebuild']['adminPass'] = admin_pass if admin_pass
body['rebuild']['metadata'] = metadata if metadata
body['rebuild']['personality'] = personality if personality
if personality
body['rebuild']['personality'] = []
for file in personality
body['rebuild']['personality'] << {
'contents' => Base64.encode64(file['contents']),
'path' => file['path']
}
end
end
server_action(server_id, body, 202)
end

Expand Down
1 change: 1 addition & 0 deletions lib/fog/rackspace/requests/block_storage/create_volume.rb
Expand Up @@ -13,6 +13,7 @@ def create_volume(size, options = {})
data['volume']['display_description'] = options[:display_description] unless options[:display_description].nil?
data['volume']['volume_type'] = options[:volume_type] unless options[:volume_type].nil?
data['volume']['availability_zone'] = options[:availability_zone] unless options[:availability_zone].nil?
data['volume']['snapshot_id'] = options[:snapshot_id] unless options[:snapshot_id].nil?

request(
:body => Fog::JSON.encode(data),
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/vcloud/compute.rb
Expand Up @@ -301,7 +301,7 @@ def base_url

# Use this to set the Authorization header for login
def authorization_header
"Basic #{Base64.encode64("#{@username}:#{@password}").chomp!}"
"Basic #{Base64.encode64("#{@username}:#{@password}").delete("\r\n")}"
end

# Actually do the request
Expand Down
8 changes: 8 additions & 0 deletions lib/fog/vcloud/models/compute/catalog_item.rb
Expand Up @@ -23,6 +23,14 @@ def customization_options
end
end

def password_enabled?
load_unless_loaded!
customization_options = service.get_vapp_template(self.entity[:href]).body[:Children][:Vm][:GuestCustomizationSection]
return false if customization_options[:AdminPasswordEnabled] == "false"
return true if customization_options[:AdminPasswordEnabled] == "true" \
and customization_options[:AdminPasswordAuto] == "false" \
and ( options[:password].nil? or options[:password].empty? )
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/vcloud/requests/compute/configure_vm_network.rb
Expand Up @@ -23,7 +23,7 @@ def configure_vm_network(network_info)
request(
:body => body,
:expects => 202,
:headers => {'Content-Type' => network_info[:"vcloud_type"] },
:headers => {'Content-Type' => network_info[:"type"] },
:method => 'PUT',
:uri => "#{edit_uri}",
:parse => true
Expand Down

0 comments on commit ae9287a

Please sign in to comment.