From: David Lutterkort lutter@redhat.com
--- client/lib/dcloud/base_model.rb | 6 ++-- client/lib/dcloud/image.rb | 2 +- client/lib/dcloud/instance.rb | 2 +- client/lib/dcloud/storage_snapshot.rb | 2 +- client/lib/dcloud/storage_volume.rb | 2 +- client/lib/deltacloud.rb | 20 +++++++++--------- client/specs/flavors_spec.rb | 2 +- client/specs/images_spec.rb | 2 +- client/specs/initialization_spec.rb | 2 +- client/specs/instance_states_spec.rb | 2 +- client/specs/instances_spec.rb | 2 +- client/specs/realms_spec.rb | 2 +- .../app/controllers/application_controller.rb | 2 +- .../libexec/app/controllers/images_controller.rb | 10 ++++---- server/libexec/config/initializers/inflections.rb | 2 +- .../libexec/config/initializers/session_store.rb | 2 +- server/libexec/lib/converters/xml_converter.rb | 2 +- .../lib/deltacloud/drivers/mock/mock_driver.rb | 4 +- .../deltacloud/drivers/opennebula/cloud_client.rb | 22 ++++++++++---------- .../drivers/rackspace/rackspace_client.rb | 12 +++++----- .../lib/deltacloud/drivers/rhevm/rhevm_driver.rb | 2 +- server/libexec/lib/deltacloud/state_machine.rb | 8 +++--- 22 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/client/lib/dcloud/base_model.rb b/client/lib/dcloud/base_model.rb index 8c83fbf..0f210a4 100644 --- a/client/lib/dcloud/base_model.rb +++ b/client/lib/dcloud/base_model.rb @@ -20,7 +20,7 @@ module DCloud class BaseModel
def self.xml_tag_name(name=nil) - unless ( name.nil? ) + unless ( name.nil? ) @xml_tag_name = name end @xml_tag_name || self.class.name.downcase.to_sym @@ -54,7 +54,7 @@ module DCloud @id end
- + protected
attr_reader :client @@ -68,7 +68,7 @@ module DCloud def load_payload(xml=nil) unless ( xml.nil? ) @loaded = true - @id = xml.text( 'id' ) + @id = xml.text( 'id' ) end end
diff --git a/client/lib/dcloud/image.rb b/client/lib/dcloud/image.rb index cba7fc7..220de21 100644 --- a/client/lib/dcloud/image.rb +++ b/client/lib/dcloud/image.rb @@ -37,7 +37,7 @@ module DCloud unless xml.nil? @description = xml.text( 'description' ) @owner_id = xml.text( 'owner_id' ) - @name = xml.text( 'name' ) + @name = xml.text( 'name' ) @architecture = xml.text( 'architecture' ) end end diff --git a/client/lib/dcloud/instance.rb b/client/lib/dcloud/instance.rb index e14dd50..9115e9a 100644 --- a/client/lib/dcloud/instance.rb +++ b/client/lib/dcloud/instance.rb @@ -77,7 +77,7 @@ module DCloud @image = Image.new( @client, image_uri ) flavor_uri = xml.get_elements( 'flavor' )[0].attributes['href'] @flavor = Flavor.new( @client, flavor_uri ) - # Only use realms if they are there + # Only use realms if they are there if (!xml.get_elements( 'realm' ).empty?) realm_uri = xml.get_elements( 'realm' )[0].attributes['href'] @realm = Realm.new( @client, realm_uri ) diff --git a/client/lib/dcloud/storage_snapshot.rb b/client/lib/dcloud/storage_snapshot.rb index 9276fb8..ae60771 100644 --- a/client/lib/dcloud/storage_snapshot.rb +++ b/client/lib/dcloud/storage_snapshot.rb @@ -40,7 +40,7 @@ module DCloud if ( ! storage_volumes.empty? ) storage_volume = storage_volumes.first storage_volume_href = storage_volume.attributes['href'] - if ( storage_volume_href ) + if ( storage_volume_href ) @storage_volume = StorageVolume.new( @client, storage_volume_href ) end end diff --git a/client/lib/dcloud/storage_volume.rb b/client/lib/dcloud/storage_volume.rb index aec2f57..bdb2e3b 100644 --- a/client/lib/dcloud/storage_volume.rb +++ b/client/lib/dcloud/storage_volume.rb @@ -43,7 +43,7 @@ module DCloud if ( ! instances.empty? ) instance = instances.first instance_href = instance.attributes['href'] - if ( instance_href ) + if ( instance_href ) @instance = Instance.new( @client, instance_href ) end end diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb index bae8ff0..5324c79 100644 --- a/client/lib/deltacloud.rb +++ b/client/lib/deltacloud.rb @@ -44,12 +44,12 @@ class DeltaCloud attr_reader :driver_name
def initialize(name, password, api_uri, &block) - @logger = Logger.new( STDERR ) + @logger = Logger.new( STDERR ) @name = name @password = password @api_uri = URI.parse( api_uri ) @entry_points = {} - connect( &block ) + connect( &block ) self end
@@ -71,7 +71,7 @@ class DeltaCloud end end end - flavors + flavors end
def flavor(id) @@ -101,7 +101,7 @@ class DeltaCloud doc.get_elements( 'states/state' ).each do |state_elem| state = DCloud::State.new( state_elem.attributes['name'] ) state_elem.get_elements( 'transition' ).each do |transition_elem| - state.transitions << DCloud::Transition.new( + state.transitions << DCloud::Transition.new( transition_elem.attributes['to'], transition_elem.attributes['action'] ) @@ -245,7 +245,7 @@ class DeltaCloud uri = instance.attributes['href'] return DCloud::Instance.new( self, uri, instance ) end - end + end end
def storage_volumes() @@ -276,7 +276,7 @@ class DeltaCloud end
def fetch_storage_volume(uri) - xml = fetch_resource( :storage_volume, uri ) + xml = fetch_resource( :storage_volume, uri ) return DCloud::StorageVolume.new( self, uri, xml ) if xml nil end @@ -309,7 +309,7 @@ class DeltaCloud end
def fetch_storage_snapshot(uri) - xml = fetch_resource( :storage_snapshot, uri ) + xml = fetch_resource( :storage_snapshot, uri ) return DCloud::StorageSnapshot.new( self, uri, xml ) if xml nil end @@ -324,7 +324,7 @@ class DeltaCloud if ( response.is_a?( Net::HTTPSuccess ) ) doc = REXML::Document.new( response.body ) if ( doc.root && ( doc.root.name == type.to_s.gsub( /_/, '-' ) ) ) - return doc.root + return doc.root end end end @@ -374,7 +374,7 @@ class DeltaCloud end
def request(path='', method=:get, query_args={}, form_data={}, &block) - if ( path =~ /^http/ ) + if ( path =~ /^http/ ) request_path = path else request_path = "#{api_path}#{path}" @@ -383,7 +383,7 @@ class DeltaCloud if ( query_string != '' ) request_path += "?#{query_string}" end - + logger << "Request [#{method.to_s.upcase} #{request_path}]\n" request = eval( "Net::HTTP::#{method.to_s.capitalize}" ).new( request_path ) request.basic_auth( @name, @password ) diff --git a/client/specs/flavors_spec.rb b/client/specs/flavors_spec.rb index 740d7ac..91a063e 100644 --- a/client/specs/flavors_spec.rb +++ b/client/specs/flavors_spec.rb @@ -37,7 +37,7 @@ describe "flavors" do flavor.memory.should be_a(Float) end end - end + end
it "should allow filtering of flavors by architecture" do DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client| diff --git a/client/specs/images_spec.rb b/client/specs/images_spec.rb index 5f508db..704c2ae 100644 --- a/client/specs/images_spec.rb +++ b/client/specs/images_spec.rb @@ -38,7 +38,7 @@ describe "images" do image.owner_id.should be_a(String) end end - end + end
it "should allow retrieval of my own images" do DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client| diff --git a/client/specs/initialization_spec.rb b/client/specs/initialization_spec.rb index 47449dd..386eb9e 100644 --- a/client/specs/initialization_spec.rb +++ b/client/specs/initialization_spec.rb @@ -33,7 +33,7 @@ describe "initializing the client" do client.entry_points[:instances].should eql( "#{API_URL}/instances" ) client.entry_points[:storage_volumes].should eql( "#{API_URL}/storage/volumes" ) client.entry_points[:storage_snapshots].should eql( "#{API_URL}/storage/snapshots" ) - end + end end
it "should provide the current driver name via client" do diff --git a/client/specs/instance_states_spec.rb b/client/specs/instance_states_spec.rb index a80d546..667baf6 100644 --- a/client/specs/instance_states_spec.rb +++ b/client/specs/instance_states_spec.rb @@ -50,7 +50,7 @@ describe "instance-states" do includes_transition( instance_states[2].transitions, :reboot, :running ).should be_true includes_transition( instance_states[2].transitions, :stop, :stopped ).should be_true end - end + end
it "should allow retrieval of a single instance-state blob" do DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client| diff --git a/client/specs/instances_spec.rb b/client/specs/instances_spec.rb index a7d9fdb..b088f74 100644 --- a/client/specs/instances_spec.rb +++ b/client/specs/instances_spec.rb @@ -45,7 +45,7 @@ describe "instances" do instance.private_addresses.should be_a( Array ) end end - end + end
it "should allow navigation from instance to image" do DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client| diff --git a/client/specs/realms_spec.rb b/client/specs/realms_spec.rb index 8b08649..6f5199f 100644 --- a/client/specs/realms_spec.rb +++ b/client/specs/realms_spec.rb @@ -34,7 +34,7 @@ describe "realms" do realm.name.should be_a(String) end end - end + end
it "should allow fetching a realm by id" do diff --git a/server/libexec/app/controllers/application_controller.rb b/server/libexec/app/controllers/application_controller.rb index 76641b6..618a833 100644 --- a/server/libexec/app/controllers/application_controller.rb +++ b/server/libexec/app/controllers/application_controller.rb @@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base # filter_parameter_logging :password
- protected + protected
def credentials creds = {} diff --git a/server/libexec/app/controllers/images_controller.rb b/server/libexec/app/controllers/images_controller.rb index 382b138..92fe73f 100644 --- a/server/libexec/app/controllers/images_controller.rb +++ b/server/libexec/app/controllers/images_controller.rb @@ -29,10 +29,10 @@ class ImagesController < ApplicationController @images = driver.images( credentials, @filter )
respond_to do |format| - format.html + format.html format.json - format.xml { - render :xml=>convert_to_xml( :image, @images ) + format.xml { + render :xml=>convert_to_xml( :image, @images ) } end end @@ -43,8 +43,8 @@ class ImagesController < ApplicationController respond_to do |format| format.html format.json - format.xml { - render :xml=>convert_to_xml( :image, @image ) + format.xml { + render :xml=>convert_to_xml( :image, @image ) } end end diff --git a/server/libexec/config/initializers/inflections.rb b/server/libexec/config/initializers/inflections.rb index d531b8b..9e8b013 100644 --- a/server/libexec/config/initializers/inflections.rb +++ b/server/libexec/config/initializers/inflections.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file.
-# Add new inflection rules using the following format +# Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' diff --git a/server/libexec/config/initializers/session_store.rb b/server/libexec/config/initializers/session_store.rb index bdc56be..9450644 100644 --- a/server/libexec/config/initializers/session_store.rb +++ b/server/libexec/config/initializers/session_store.rb @@ -2,7 +2,7 @@
# Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! -# Make sure the secret is at least 30 characters and all random, +# Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. ActionController::Base.session = { :key => '_deltacloud-framework_session', diff --git a/server/libexec/lib/converters/xml_converter.rb b/server/libexec/lib/converters/xml_converter.rb index a353b75..0b11fd7 100644 --- a/server/libexec/lib/converters/xml_converter.rb +++ b/server/libexec/lib/converters/xml_converter.rb @@ -82,7 +82,7 @@ module Converters builder.owner_id( obj.owner_id ) builder.image( :href=>@link_builder.send( :image_url, obj.image_id ) ) builder.flavor( :href=>@link_builder.send( :flavor_url, obj.flavor_id ) ) - builder.realm( :href=>@link_builder.send( :realm_url, obj.realm_id ) ) if obj.realm_id + builder.realm( :href=>@link_builder.send( :realm_url, obj.realm_id ) ) if obj.realm_id builder.state( obj.state ) builder.actions { if ( obj.actions ) diff --git a/server/libexec/lib/deltacloud/drivers/mock/mock_driver.rb b/server/libexec/lib/deltacloud/drivers/mock/mock_driver.rb index 61f180a..73cdcc4 100644 --- a/server/libexec/lib/deltacloud/drivers/mock/mock_driver.rb +++ b/server/libexec/lib/deltacloud/drivers/mock/mock_driver.rb @@ -192,7 +192,7 @@ class MockDriver < Deltacloud::BaseDriver instance_yml = YAML.load( File.read( instance_file ) ) instance_yml[:state] = 'RUNNING' File.open( instance_file, 'w' ) do |f| - f << YAML.dump( instance_yml ) + f << YAML.dump( instance_yml ) end Instance.new( instance_yml ) end @@ -202,7 +202,7 @@ class MockDriver < Deltacloud::BaseDriver instance_yml = YAML.load( File.read( instance_file ) ) instance_yml[:state] = 'RUNNING' File.open( instance_file, 'w' ) do |f| - f << YAML.dump( instance_yml ) + f << YAML.dump( instance_yml ) end Instance.new( instance_yml ) end diff --git a/server/libexec/lib/deltacloud/drivers/opennebula/cloud_client.rb b/server/libexec/lib/deltacloud/drivers/opennebula/cloud_client.rb index 10b34d5..19f989d 100644 --- a/server/libexec/lib/deltacloud/drivers/opennebula/cloud_client.rb +++ b/server/libexec/lib/deltacloud/drivers/opennebula/cloud_client.rb @@ -35,7 +35,7 @@ rescue LoadError end
############################################################################### -# The CloudClient module contains general functionality to implement a +# The CloudClient module contains general functionality to implement a # Cloud Client ############################################################################### module CloudClient @@ -43,7 +43,7 @@ module CloudClient # Default location for the authentication file # ######################################################################### DEFAULT_AUTH_FILE = ENV["HOME"]+"/.one/one_auth" - + # ######################################################################### # Gets authorization credentials from ONE_AUTH or default # auth file. @@ -51,7 +51,7 @@ module CloudClient # Raises an error if authorization is not found # ######################################################################### def self.get_one_auth - if ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and + if ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and File.file?(ENV["ONE_AUTH"]) one_auth=File.read(ENV["ONE_AUTH"]).strip.split(':') elsif File.file?(DEFAULT_AUTH_FILE) @@ -59,12 +59,12 @@ module CloudClient else raise "No authorization data present" end - + raise "Authorization data malformed" if one_auth.length < 2 - + one_auth end - + # ######################################################################### # Starts an http connection and calls the block provided. SSL flag # is set if needed. @@ -75,7 +75,7 @@ module CloudClient http.use_ssl = true http.verify_mode=OpenSSL::SSL::VERIFY_NONE end - + begin http.start do |connection| block.call(connection) @@ -83,7 +83,7 @@ module CloudClient rescue Errno::ECONNREFUSED => e str = "Error connecting to server (#{e.to_s})." str << "Server: #{url.host}:#{url.port}" - + return CloudClient::Error.new(str) end end @@ -94,7 +94,7 @@ module CloudClient # ######################################################################### class Error attr_reader :message - + # +message+ a description of the error def initialize(message=nil) @message=message @@ -105,7 +105,7 @@ module CloudClient end end
- # ######################################################################### + # ######################################################################### # Returns true if the object returned by a method of the OpenNebula # library is an Error # ######################################################################### @@ -113,7 +113,7 @@ module CloudClient value.class==CloudClient::Error end end - + # Command line help functions module CloudCLI # Returns the command name diff --git a/server/libexec/lib/deltacloud/drivers/rackspace/rackspace_client.rb b/server/libexec/lib/deltacloud/drivers/rackspace/rackspace_client.rb index 09b71c6..d01d8d3 100644 --- a/server/libexec/lib/deltacloud/drivers/rackspace/rackspace_client.rb +++ b/server/libexec/lib/deltacloud/drivers/rackspace/rackspace_client.rb @@ -31,7 +31,7 @@ module Deltacloud class RackspaceClient
@@AUTH_API = URI.parse('https://auth.api.rackspacecloud.com/v1.0') - + def initialize(username, auth_key) http = Net::HTTP.new(@@AUTH_API.host,@@AUTH_API.port) http.use_ssl = true @@ -42,7 +42,7 @@ class RackspaceClient @service.use_ssl = true end
- def get(path) + def get(path) @service.get(@service_uri.path + path, {"Accept" => "application/json", "X-Auth-Token" => @auth_token}).body end
@@ -50,16 +50,16 @@ class RackspaceClient JSON.parse(get('/flavors/detail'))['flavors'] end
- def list_images + def list_images JSON.parse(get('/images/detail'))['images'] end
- def list_servers + def list_servers JSON.parse(get('/servers/detail'))['servers'] end
- def load_server_details( server_id ) + def load_server_details( server_id ) JSON.parse(get("/servers/#{server_id}"))['server'] end
@@ -79,7 +79,7 @@ class RackspaceClient end
- def headers + def headers {"Accept" => "application/json", "X-Auth-Token" => @auth_token, "Content-Type" => "application/json"} end
diff --git a/server/libexec/lib/deltacloud/drivers/rhevm/rhevm_driver.rb b/server/libexec/lib/deltacloud/drivers/rhevm/rhevm_driver.rb index eaf008a..d026852 100644 --- a/server/libexec/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +++ b/server/libexec/lib/deltacloud/drivers/rhevm/rhevm_driver.rb @@ -162,7 +162,7 @@ class RHEVMDriver < Deltacloud::BaseDriver # # Instances # - + define_instance_states do start.to(:stopped) .on( :create )
diff --git a/server/libexec/lib/deltacloud/state_machine.rb b/server/libexec/lib/deltacloud/state_machine.rb index f624f09..9c4f7ba 100644 --- a/server/libexec/lib/deltacloud/state_machine.rb +++ b/server/libexec/lib/deltacloud/state_machine.rb @@ -27,7 +27,7 @@ module Deltacloud
def method_missing(sym,*args) return state( sym ) if ( args.empty? ) - super( sym, *args ) + super( sym, *args ) end
class State @@ -40,13 +40,13 @@ module Deltacloud @name = name @transitions = [] end - + def to_s self.name.to_s end
def to(destination_name) - destination = @machine.state(destination_name) + destination = @machine.state(destination_name) transition = Transition.new( @machine, destination ) @transitions << transition transition @@ -77,7 +77,7 @@ module Deltacloud def on(action) @action = action end - + end
end