Signed-off-by: Chris Lalancette <[email protected]>
---
server/config/drivers.yaml | 30 ++++++++++----------
server/lib/deltacloud/backend_capability.rb | 4 +-
server/lib/deltacloud/base_driver/base_driver.rb | 14 ++++----
server/lib/deltacloud/base_driver/exceptions.rb | 2 +-
server/lib/deltacloud/base_driver/mock_driver.rb | 2 +-
server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 22 +++++++-------
.../lib/deltacloud/drivers/ec2/ec2_mock_driver.rb | 4 +-
.../lib/deltacloud/drivers/gogrid/gogrid_client.rb | 14 ++++----
.../lib/deltacloud/drivers/gogrid/gogrid_driver.rb | 6 ++--
server/lib/deltacloud/drivers/mock/mock_driver.rb | 2 +-
.../drivers/rackspace/rackspace_driver.rb | 2 +-
.../lib/deltacloud/drivers/rhevm/rhevm_client.rb | 2 +-
.../lib/deltacloud/drivers/rhevm/rhevm_driver.rb | 11 ++++---
.../drivers/rimuhosting/rimuhosting_client.rb | 2 +-
server/lib/deltacloud/drivers/sbc/sbc_client.rb | 8 ++--
server/lib/deltacloud/hardware_profile.rb | 2 +-
.../lib/deltacloud/helpers/application_helper.rb | 2 +-
server/lib/deltacloud/helpers/blob_stream.rb | 2 +-
server/lib/deltacloud/models/base_model.rb | 2 +-
server/lib/deltacloud/models/blob.rb | 2 +-
server/lib/deltacloud/models/instance.rb | 4 +-
server/lib/deltacloud/models/key.rb | 2 +-
server/lib/deltacloud/runner.rb | 6 ++--
server/lib/sinatra/rabbit.rb | 4 +-
server/lib/sinatra/rack_matrix_params.rb | 2 +-
server/lib/sinatra/rack_runtime.rb | 2 +-
server/lib/sinatra/respond_to.rb | 16 +++++-----
server/server.rb | 6 ++--
28 files changed, 89 insertions(+), 88 deletions(-)
diff --git a/server/config/drivers.yaml b/server/config/drivers.yaml
index f2bfc6d..20b2857 100644
--- a/server/config/drivers.yaml
+++ b/server/config/drivers.yaml
@@ -1,25 +1,25 @@
----
-:gogrid:
+---
+:gogrid:
:name: Gogrid
-:mock:
+:mock:
:name: Mock
-:rhevm:
+:rhevm:
:name: RHEVM
:entrypoints:
default:
default: "https://rhev-m.localhost:8443/rhevm-api-powershell"
-:rimuhosting:
+:rimuhosting:
:name: RimuHosting
-:opennebula:
+:opennebula:
:class: OpennebulaDriver
:name: Opennebula
-:sbc:
+:sbc:
:name: SBC
-:terremark:
+:terremark:
:name: Terremark
-:rackspace:
+:rackspace:
:name: Rackspace
-:azure:
+:azure:
:name: Azure
:eucalyptus:
:name: Eucalyptus
@@ -28,19 +28,19 @@
:entrypoints:
default:
default: "ec2=EUCALYPTUS_IP[:PORT];s3=WALRUS_IP[:PORT]"
-:ec2:
- :entrypoints:
- s3:
+:ec2:
+ :entrypoints:
+ s3:
us-west-1: s3-us-west-1.amazonaws.com
ap-southeast-1: s3-ap-southeast-1.amazonaws.com
eu-west-1: s3-eu-west-1.amazonaws.com
us-east-1: s3.amazonaws.com
- elb:
+ elb:
us-west-1: elasticloadbalancing.us-west-1.amazonaws.com
ap-southeast-1: elasticloadbalancing.ap-southeast-1.amazonaws.com
eu-west-1: elasticloadbalancing.eu-west-1.amazonaws.com
us-east-1: elasticloadbalancing.us-east-1.amazonaws.com
- ec2:
+ ec2:
us-west-1: ec2.us-west-1.amazonaws.com
ap-southeast-1: ec2.ap-southeast-1.amazonaws.com
eu-west-1: ec2.eu-west-1.amazonaws.com
diff --git a/server/lib/deltacloud/backend_capability.rb
b/server/lib/deltacloud/backend_capability.rb
index d7884bf..57e8cd3 100644
--- a/server/lib/deltacloud/backend_capability.rb
+++ b/server/lib/deltacloud/backend_capability.rb
@@ -18,7 +18,7 @@ module Deltacloud::BackendCapability
class Failure < StandardError
attr_reader :capability
-
+
def initialize(capability, msg='')
super(msg)
@capability = capability
@@ -26,7 +26,7 @@ module Deltacloud::BackendCapability
end
attr_reader :capability
-
+
def with_capability(capability)
@capability = capability
end
diff --git a/server/lib/deltacloud/base_driver/base_driver.rb
b/server/lib/deltacloud/base_driver/base_driver.rb
index d9ebd92..2c780d9 100644
--- a/server/lib/deltacloud/base_driver/base_driver.rb
+++ b/server/lib/deltacloud/base_driver/base_driver.rb
@@ -25,7 +25,7 @@ module Deltacloud
def self.exceptions(&block)
ExceptionHandler::exceptions(&block)
end
-
+
def self.define_hardware_profile(name,&block)
@hardware_profiles ||= []
hw_profile = @hardware_profiles.find{|e| e.name == name}
@@ -136,7 +136,7 @@ module Deltacloud
# def storage_volumes(credentials, ops)
#
# def storage_snapshots(credentials, ops)
- #
+ #
# def buckets(credentials, opts = nil)
# def create_bucket(credentials, name, opts=nil)
# def delete_bucket(credentials, name, opts=nil)
@@ -149,7 +149,7 @@ module Deltacloud
# def keys(credentials, opts)
# def create_key(credentials, opts)
# def destroy_key(credentials, opts)
-
+
def realm(credentials, opts)
realms = realms(credentials, opts).first if has_capability?(:realms)
end
@@ -174,7 +174,7 @@ module Deltacloud
#list of objects within bucket
buckets(credentials, opts).first if has_capability?(:buckets)
end
-
+
def blob(credentials, opts = {})
blobs(credentials, opts).first if has_capability?(:blobs)
end
@@ -185,7 +185,7 @@ module Deltacloud
MEMBER_SHOW_METHODS =
[ :realm, :image, :instance, :storage_volume, :bucket, :blob, :key ]
-
+
def has_capability?(capability)
if MEMBER_SHOW_METHODS.include?(capability.to_sym)
has_capability?(capability.to_s.pluralize)
@@ -193,8 +193,8 @@ module Deltacloud
respond_to?(capability)
end
end
-
-
+
+
def filter_on(collection, attribute, opts)
return collection if opts.nil?
return collection if opts[attribute].nil?
diff --git a/server/lib/deltacloud/base_driver/exceptions.rb
b/server/lib/deltacloud/base_driver/exceptions.rb
index 51cdd41..5999e30 100644
--- a/server/lib/deltacloud/base_driver/exceptions.rb
+++ b/server/lib/deltacloud/base_driver/exceptions.rb
@@ -107,7 +107,7 @@ module Deltacloud
def self.exceptions(&block)
@definitions = Exceptions.new(&block).exception_definitions if
block_given?
- @definitions
+ @definitions
end
def safely(&block)
diff --git a/server/lib/deltacloud/base_driver/mock_driver.rb
b/server/lib/deltacloud/base_driver/mock_driver.rb
index cd711a6..dd4d984 100644
--- a/server/lib/deltacloud/base_driver/mock_driver.rb
+++ b/server/lib/deltacloud/base_driver/mock_driver.rb
@@ -55,7 +55,7 @@ module Mock
MethodSerializer::Cache::wrap_methods(self, :cache_dir =>
File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'tests', 'ec2',
'support'))
end
-
+
end
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 0c0471a..4edd989 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -173,7 +173,7 @@ module Deltacloud
ec2 = new_client(credentials)
inst_arr = []
safely do
- inst_arr = ec2.describe_instances.collect do |instance|
+ inst_arr = ec2.describe_instances.collect do |instance|
convert_instance(instance) if instance
end.flatten
if tagging?
@@ -241,7 +241,7 @@ module Deltacloud
Deltacloud::Runner.execute(opts[:cmd], param)
end
end
-
+
def reboot_instance(credentials, instance_id)
ec2 = new_client(credentials)
if ec2.reboot_instances([instance_id])
@@ -409,9 +409,9 @@ module Deltacloud
opts.gsub_keys('HTTP_X_Deltacloud_Blobmeta_', 'x-amz-meta-')
opts["Content-Type"] = data[:type]
safely do
- res = s3_client.interface.put(bucket_id,
- blob_id,
- file,
+ res = s3_client.interface.put(bucket_id,
+ blob_id,
+ file,
opts)
end
#create a new Blob object and return that
@@ -427,7 +427,7 @@ module Deltacloud
#--
# Delete Blob
- #--
+ #--
def delete_blob(credentials, bucket_id, blob_id, opts={})
s3_client = new_client(credentials, :s3)
safely do
@@ -469,7 +469,7 @@ module Deltacloud
def destroy_storage_volume(credentials, opts={})
ec2 = new_client(credentials)
safely do
- unless ec2.delete_volume(opts[:id])
+ unless ec2.delete_volume(opts[:id])
raise Deltacloud::BackendError.new(500, "StorageVolume", "Cannot
delete storage volume")
end
storage_volume(credentials, opts[:id])
@@ -640,7 +640,7 @@ module Deltacloud
end
end
end
-
+
def convert_bucket(s3_bucket)
#get blob list:
blob_list = []
@@ -664,7 +664,7 @@ module Deltacloud
:content_type => s3_object.headers['content-type'],
:last_modified => s3_object.last_modified,
:user_metadata => s3_object.meta_headers
- )
+ )
end
def convert_realm(realm)
@@ -727,8 +727,8 @@ module Deltacloud
:realm_id => volume[:zone],
:device => volume[:aws_device],
# TODO: the available actions should be tied to the current
- # volume state
- :actions => [:attach, :detach, :destroy]
+ # volume state
+ :actions => [:attach, :detach, :destroy]
)
end
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
b/server/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
index 8cce73d..03db2c1 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
@@ -16,7 +16,7 @@
module RightAws
class MockEc2
-
+
def initialize(opts={})
end
@@ -161,7 +161,7 @@ module RightAws
instance[:aws_launch_time] = instance_time_format
instances = load_fixtures_for(:instances)
instances.each_with_index do |inst, i|
- instances[i] = instance if inst[:aws_instance_id].eql?(id)
+ instances[i] = instance if inst[:aws_instance_id].eql?(id)
end
update_fixtures_for(:instances, instances)
return instance
diff --git a/server/lib/deltacloud/drivers/gogrid/gogrid_client.rb
b/server/lib/deltacloud/drivers/gogrid/gogrid_client.rb
index 3131291..76b326e 100644
--- a/server/lib/deltacloud/drivers/gogrid/gogrid_client.rb
+++ b/server/lib/deltacloud/drivers/gogrid/gogrid_client.rb
@@ -42,25 +42,25 @@ class GoGridClient
def initialize(server='https://api.gogrid.com/api',
apikey='YOUR API KEY',
- secret='YOUR SHARED SECRET',
+ secret='YOUR SHARED SECRET',
format='json',
version='1.6')
@server = server
@secret = secret
@default_params = {'format'=>format, 'v'=>version,'api_key' => apikey}
- end
-
+ end
+
def getRequestURL(method,params)
requestURL = @server+'/'+method+'?'
call_params = @default_params.merge(params)
call_params['sig']=getSignature(@default_params['api_key'],@secret)
requestURL = requestURL+encode_params(call_params)
end
-
+
def getSignature(key,secret)
Digest::MD5.hexdigest(key+secret+"%.0f"%Time.new.to_f)
end
-
+
def sendAPIRequest(method,params={})
OpenURI.without_ssl_verification do
open(getRequestURL(method,params)).read
@@ -76,9 +76,9 @@ class GoGridClient
request = sendAPIRequest(method, params)
JSON::parse(request)
end
-
+
def encode_params(params)
params.map {|k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join("&")
end
-
+
end
diff --git a/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
b/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
index 18fc2e7..e4c1f94 100644
--- a/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
+++ b/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
@@ -43,7 +43,7 @@ class GogridDriver < Deltacloud::BaseDriver
server_rams = client.request('common/lookup/list', { 'lookup' =>
'server.ram' })
@hardware_profiles = []
server_types['list'].each do |type|
- memory_values = server_rams['list'].collect do |r|
+ memory_values = server_rams['list'].collect do |r|
r['name'] =~ /MB$/ ? r['name'].gsub(/MB$/, '').to_i :
(r['name'].gsub(/(\w{2})$/, '')).to_i*1024
end
@hardware_profiles <<
::Deltacloud::HardwareProfile.new(type['name'].tr(' ', '-').downcase) do
@@ -101,7 +101,7 @@ class GogridDriver < Deltacloud::BaseDriver
'server.ram' => server_ram,
'ip' => get_free_ip_from_realm(credentials, opts[:realm_id] || '1')
}
- params.merge!('isSandbox' => 'true') if opts[:sandbox]
+ params.merge!('isSandbox' => 'true') if opts[:sandbox]
safely do
instance = client.request('grid/server/add', params)['list'].first
if instance
@@ -358,7 +358,7 @@ class GogridDriver < Deltacloud::BaseDriver
balancer.instances = get_load_balancer_instances(instance_ips,
loadbalancer['instances'])
return balancer
end
-
+
def get_load_balancer_instances(instance_ips, instances)
instances.select { |i| instance_ips.include?(i.public_addresses.first) }
if instances
end
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb
b/server/lib/deltacloud/drivers/mock/mock_driver.rb
index df2fff0..b1506fa 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
@@ -350,7 +350,7 @@ class MockDriver < Deltacloud::BaseDriver
buckets=[]
safely do
unless (opts[:id].nil?)
- bucket_file = File::join(@storage_root, 'buckets', "#{opts[:id]}.yml")
+ bucket_file = File::join(@storage_root, 'buckets', "#{opts[:id]}.yml")
bucket = YAML.load_file(bucket_file)
bucket[:id] = opts[:id]
bucket[:name] = bucket[:id]
diff --git a/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
b/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
index f173bcc..0cebb83 100644
--- a/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
+++ b/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
@@ -315,7 +315,7 @@ class RackspaceDriver < Deltacloud::BaseDriver
safely do
blob = cf.container(opts['bucket']).object(opts[:id])
blob.set_metadata(meta_hash)
- end
+ end
end
private
diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
index 5d28b3d..75311f0 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
@@ -318,7 +318,7 @@ module RHEVM
@path = ((xml/'storage/path').first.text rescue nil)
end
end
-
+
end
class String
diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
index a0ac64f..43c1af6 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
@@ -203,7 +203,7 @@ class RHEVMDriver < Deltacloud::BaseDriver
def convert_instance(client, inst)
state = convert_state(inst.status)
storage_size = inst.storage.nil? ? 1 : (inst.storage.to_i/1024/1024/1024)
- profile = InstanceProfile::new(inst.profile.upcase,
+ profile = InstanceProfile::new(inst.profile.upcase,
:hwp_memory => inst.memory.to_i/1024/1024,
:hwp_cpu => inst.cores,
:hwp_storage => "#{storage_size}"
@@ -230,11 +230,12 @@ class RHEVMDriver < Deltacloud::BaseDriver
)
end
- # STATES:
+ # STATES:
#
- # UNASSIGNED, DOWN, UP, POWERING_UP, POWERED_DOWN, PAUSED, MIGRATING_FROM,
MIGRATING_TO,
- # UNKNOWN, NOT_RESPONDING, WAIT_FOR_LAUNCH, REBOOT_IN_PROGRESS,
SAVING_STATE, RESTORING_STATE,
- # SUSPENDED, IMAGE_ILLEGAL, IMAGE_LOCKED or POWERING_DOWN
+ # UNASSIGNED, DOWN, UP, POWERING_UP, POWERED_DOWN, PAUSED, MIGRATING_FROM,
+ # MIGRATING_TO, UNKNOWN, NOT_RESPONDING, WAIT_FOR_LAUNCH, REBOOT_IN_PROGRESS,
+ # SAVING_STATE, RESTORING_STATE, SUSPENDED, IMAGE_ILLEGAL,
+ # IMAGE_LOCKED or POWERING_DOWN
#
def convert_state(state)
case state
diff --git a/server/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
b/server/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
index 9d1d821..f44336a 100755
--- a/server/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
+++ b/server/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
@@ -47,7 +47,7 @@ class RimuHostingClient
res = res[res.keys[0]]
if(res['response_type'] == "ERROR" and ( (res['error_info']['error_class']
== "PermissionException") or
- (res['error_info']['error_class']
== "LoginRequired") ))
+ (res['error_info']['error_class']
== "LoginRequired") ))
raise "AuthFailure"
end
res
diff --git a/server/lib/deltacloud/drivers/sbc/sbc_client.rb
b/server/lib/deltacloud/drivers/sbc/sbc_client.rb
index 90d091b..a0e36cb 100644
--- a/server/lib/deltacloud/drivers/sbc/sbc_client.rb
+++ b/server/lib/deltacloud/drivers/sbc/sbc_client.rb
@@ -22,9 +22,9 @@ require 'digest/md5'
module Deltacloud
module Drivers
module SBC
-
+
class FixtureNotFound < Exception; end
-
+
#
# Client for the IBM Smart Business Cloud (SBC).
#
@@ -192,7 +192,7 @@ class SBCClient
def urlencode(hash)
hash.keys.map { |k| "#{URI.encode(k)}=#{URI.encode(hash[k])}" }.join("&")
end
-
+
#
# Reads a fake URL from local fixtures
#
@@ -240,7 +240,7 @@ class SBCClient
retry
end
end
-
+
end
end
end
diff --git a/server/lib/deltacloud/hardware_profile.rb
b/server/lib/deltacloud/hardware_profile.rb
index 60dbef3..e304d7c 100644
--- a/server/lib/deltacloud/hardware_profile.rb
+++ b/server/lib/deltacloud/hardware_profile.rb
@@ -136,7 +136,7 @@ module Deltacloud
props = []
self.each_property do |p|
if p.kind.eql? :fixed
- props << { :kind => p.kind, :value => p.value, :name => p.name,
:unit => p.unit }
+ props << { :kind => p.kind, :value => p.value, :name => p.name,
:unit => p.unit }
else
param = { :operation => "create", :method => "post", :name => p.name
}
if p.kind.eql? :range
diff --git a/server/lib/deltacloud/helpers/application_helper.rb
b/server/lib/deltacloud/helpers/application_helper.rb
index d496368..64c5672 100644
--- a/server/lib/deltacloud/helpers/application_helper.rb
+++ b/server/lib/deltacloud/helpers/application_helper.rb
@@ -160,7 +160,7 @@ module ApplicationHelper
capture_haml do
haml_tag :form, :method => :post, :action => url, :class => [:link,
method] do
haml_tag :input, :type => :hidden, :name => '_method', :value => method
- haml_tag :button, :type => :submit do
+ haml_tag :button, :type => :submit do
haml_concat action
end
end
diff --git a/server/lib/deltacloud/helpers/blob_stream.rb
b/server/lib/deltacloud/helpers/blob_stream.rb
index fce14d0..00879a9 100644
--- a/server/lib/deltacloud/helpers/blob_stream.rb
+++ b/server/lib/deltacloud/helpers/blob_stream.rb
@@ -30,7 +30,7 @@ begin
EM.next_tick { env['async.callback'].call [200, {
'Content-Type' => "#{params['content_type']}",
'Content-Disposition' => params["content_disposition"],
- 'Content-Length' => "#{params['content_length']}"}, body]
+ 'Content-Length' => "#{params['content_length']}"}, body]
}
#call the driver from here. the driver method yields for every chunk of
blob it receives. We then
#use body.call to write that chunk as received.
diff --git a/server/lib/deltacloud/models/base_model.rb
b/server/lib/deltacloud/models/base_model.rb
index ae08f12..b122b2b 100644
--- a/server/lib/deltacloud/models/base_model.rb
+++ b/server/lib/deltacloud/models/base_model.rb
@@ -46,7 +46,7 @@ class BaseModel
def to_hash
out = {}
- self.attributes.each do |attribute|
+ self.attributes.each do |attribute|
if self.send(:"#{attribute}")
out.merge!({ attribute => self.send(:"#{attribute}") } )
end
diff --git a/server/lib/deltacloud/models/blob.rb
b/server/lib/deltacloud/models/blob.rb
index 0b0ff0c..7dd08b3 100644
--- a/server/lib/deltacloud/models/blob.rb
+++ b/server/lib/deltacloud/models/blob.rb
@@ -15,7 +15,7 @@
# under the License.
class Blob < BaseModel
-
+
#already has an id from basemodel (for the key)
attr_accessor :bucket
attr_accessor :content_length
diff --git a/server/lib/deltacloud/models/instance.rb
b/server/lib/deltacloud/models/instance.rb
index 922f79b..c7547e3 100644
--- a/server/lib/deltacloud/models/instance.rb
+++ b/server/lib/deltacloud/models/instance.rb
@@ -66,7 +66,7 @@ class Instance < BaseModel
def authn_feature_failed?
return true unless authn_error.nil?
end
-
+
alias :to_hash_original :to_hash
def to_hash
@@ -75,7 +75,7 @@ class Instance < BaseModel
{ :"#{action}" => {
:method => collections[:instances].operations[action.to_sym].method,
:href =>
collections[:instances].operations[action.to_sym].path.gsub(':id', self.id)
- }}
+ }}
end
h
end
diff --git a/server/lib/deltacloud/models/key.rb
b/server/lib/deltacloud/models/key.rb
index cc8c222..86a6283 100644
--- a/server/lib/deltacloud/models/key.rb
+++ b/server/lib/deltacloud/models/key.rb
@@ -41,7 +41,7 @@ class Key < BaseModel
# NOTE: This is a fake PEM file, it will not work against SSH
def self.generate_mock_pem
chars = (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a + %w(= / + ))
- pem_material = (1..21).map do
+ pem_material = (1..21).map do
(1..75).collect{|a| chars[rand(chars.size)] }.join
end.join("\n") + "\n" + (1..68).collect{|a| chars[rand(chars.size)] }.join
"-----BEGIN RSA PRIVATE KEY-----\n"+pem_material+"-----END RSA PRIVATE
KEY-----"
diff --git a/server/lib/deltacloud/runner.rb b/server/lib/deltacloud/runner.rb
index 29f3063..aa13fa9 100644
--- a/server/lib/deltacloud/runner.rb
+++ b/server/lib/deltacloud/runner.rb
@@ -28,11 +28,11 @@ module Deltacloud
super
end
end
-
+
class InstanceSSHError < RunnerError; end
def self.execute(command, opts={})
-
+
if opts[:credentials] and (not opts[:credentials][:password] and not
opts[:private_key])
raise RunnerError::new("Either password or key must be specified")
end
@@ -118,7 +118,7 @@ module Deltacloud
end
class Response
-
+
attr_reader :body
attr_reader :ssh
diff --git a/server/lib/sinatra/rabbit.rb b/server/lib/sinatra/rabbit.rb
index 3d40112..fcc4c26 100644
--- a/server/lib/sinatra/rabbit.rb
+++ b/server/lib/sinatra/rabbit.rb
@@ -31,10 +31,10 @@ module Sinatra
@details = "This collection is not supported for this provider."
@message = @details
# The server understood the request, but is refusing to fulfill it.
Authorization will not help and the request
- # SHOULD NOT be repeated. If the request method was not HEAD and the
server wishes to make public why the request
+ # SHOULD NOT be repeated. If the request method was not HEAD and the
server wishes to make public why the request
# has not been fulfilled, it SHOULD describe the reason for the
refusal in the entity. If the server does not wish
# to make this information available to the client, the status code
404 (Not Found) can be used instead.
- @code = 403 #
+ @code = 403 #
end
end
diff --git a/server/lib/sinatra/rack_matrix_params.rb
b/server/lib/sinatra/rack_matrix_params.rb
index 6362c7f..5a86e39 100644
--- a/server/lib/sinatra/rack_matrix_params.rb
+++ b/server/lib/sinatra/rack_matrix_params.rb
@@ -36,7 +36,7 @@ module Rack
#
# All HTTP methods are supported, in case of POST they will be passed as a
# regular <form> parameters.
-
+
def call(env)
# Copy PATH_INFO to REQUEST_URI if Rack::Test
env['REQUEST_URI'] = env['PATH_INFO'] if env['rack.test']
diff --git a/server/lib/sinatra/rack_runtime.rb
b/server/lib/sinatra/rack_runtime.rb
index 31f8eae..dc56fc7 100644
--- a/server/lib/sinatra/rack_runtime.rb
+++ b/server/lib/sinatra/rack_runtime.rb
@@ -39,7 +39,7 @@ module Rack
if !headers.has_key?(@header_name)
headers[@header_name] = "%0.6f" % request_time
end
-
+
[status, headers, body]
end
end
diff --git a/server/lib/sinatra/respond_to.rb b/server/lib/sinatra/respond_to.rb
index 963df65..139573b 100644
--- a/server/lib/sinatra/respond_to.rb
+++ b/server/lib/sinatra/respond_to.rb
@@ -3,12 +3,12 @@
# Permission is hereby granted, free of charge, to any person obtaining a copy
of this software
# and associated documentation files (the 'Software'), to deal in the Software
without restriction,
# including without limitation the rights to use, copy, modify, merge,
publish, distribute,
-# sublicense, and/or sell copies of the Software, and to permit persons to
whom the Software is
+# sublicense, and/or sell copies of the Software, and to permit persons to
whom the Software is
# furnished to do so, subject to the following conditions:
#
-# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT
+# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM,
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE
@@ -68,7 +68,7 @@ module Sinatra
# Remove extension from URI
# Extension will be available as a 'extension' method
(extension=='txt')
-
+
extension request.path_info.match(/\.([^\.\/]+)$/).to_a.first
# If ?format= is present, ignore all Accept negotiations because
@@ -76,7 +76,7 @@ module Sinatra
if request.params.has_key? 'format'
format params['format'].to_sym
end
-
+
# Let's make a little exception here to handle
# /api/instance_states[.gv/.png] calls
if extension.eql?('gv')
@@ -214,7 +214,7 @@ module Sinatra
@_extension ||= val
@_extension
end
-
+
# This helper will holds current format. Helper should be
# accesible from all places in Sinatra
def format(val=nil)
@@ -224,11 +224,11 @@ module Sinatra
def respond_to(&block)
wants = {}
-
+
def wants.method_missing(type, *args, &handler)
self[type] = handler
end
-
+
# Set proper content-type and encoding for
# text based formats
if [:xml, :gv, :html, :json].include?(format)
diff --git a/server/server.rb b/server/server.rb
index 86dd524..a27b7ef 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -77,7 +77,7 @@ get '/api\/?' do
{ :api => {
:version => settings.version,
:driver => driver_symbol,
- :links => entry_points.collect do |l|
+ :links => entry_points.collect do |l|
{ :rel => l[0], :href => l[1]
}.merge(json_features_for_entrypoint(l))
end
}
@@ -194,8 +194,8 @@ END
param :instance_id, :string, :required
param :name, :string, :optional
param :description, :string, :optional
- control do
- @image = driver.create_image(credentials, {
+ control do
+ @image = driver.create_image(credentials, {
:id => params[:instance_id],
:name => params[:name],
:description => params[:description]
--
1.7.4.4