deltacloud-core 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +10 -3
- data/bin/deltacloudd +67 -35
- data/config.ru +1 -1
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +9 -0
- data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +7 -2
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +25 -11
- data/lib/deltacloud/drivers/gogrid/test.rb +13 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +9 -0
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +19 -1
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +10 -1
- data/lib/deltacloud/helpers/application_helper.rb +3 -3
- data/lib/deltacloud/models/base_model.rb +2 -2
- data/lib/sinatra/url_for.rb +7 -1
- data/server.rb +5 -2
- data/test.rb +8 -0
- data/tests/url_for_test.rb +50 -0
- data/views/api/show.html.haml +1 -1
- data/views/docs/collection.html.haml +2 -2
- data/views/docs/collection.xml.haml +2 -2
- data/views/docs/index.html.haml +1 -1
- data/views/docs/index.xml.haml +1 -1
- data/views/docs/operation.html.haml +2 -2
- data/views/docs/operation.xml.haml +1 -1
- data/views/layout.html.haml +2 -1
- metadata +133 -92
    
        data/Rakefile
    CHANGED
    
    | @@ -37,15 +37,22 @@ Rake::TestTask.new("test") { |t| | |
| 37 37 | 
             
                'tests/images_test.rb',
         | 
| 38 38 | 
             
                'tests/instances_test.rb',
         | 
| 39 39 | 
             
                'tests/instance_states_test.rb',
         | 
| 40 | 
            +
                'tests/url_for_test.rb'
         | 
| 40 41 | 
             
              ]
         | 
| 41 42 | 
             
              t.verbose = true
         | 
| 42 43 | 
             
              t.warning = false
         | 
| 43 44 | 
             
            }
         | 
| 44 45 |  | 
| 45 | 
            -
            load 'deltacloud-core.gemspec'
         | 
| 46 46 |  | 
| 47 | 
            -
             | 
| 48 | 
            -
               | 
| 47 | 
            +
            @specs = ['ruby', 'java'].inject({}) do |hash, spec_platform|
         | 
| 48 | 
            +
              $platform = spec_platform
         | 
| 49 | 
            +
              hash.update(spec_platform => Gem::Specification.load('deltacloud-core.gemspec'))
         | 
| 50 | 
            +
            end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            @specs.values.each do |spec|
         | 
| 53 | 
            +
              Rake::GemPackageTask.new(spec) do |pkg|
         | 
| 54 | 
            +
                pkg.need_tar = true
         | 
| 55 | 
            +
              end
         | 
| 49 56 | 
             
            end
         | 
| 50 57 |  | 
| 51 58 | 
             
            desc "Install API"
         | 
    
        data/bin/deltacloudd
    CHANGED
    
    | @@ -2,7 +2,6 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require 'rubygems'
         | 
| 4 4 | 
             
            require 'optparse'
         | 
| 5 | 
            -
            require 'thin'
         | 
| 6 5 |  | 
| 7 6 | 
             
            options = {
         | 
| 8 7 | 
             
              :env => 'development'
         | 
| @@ -44,45 +43,78 @@ end | |
| 44 43 | 
             
            ENV["API_HOST"] = "localhost" unless ENV["API_HOST"]
         | 
| 45 44 | 
             
            ENV["API_PORT"] = "3001" unless ENV["API_PORT"]
         | 
| 46 45 |  | 
| 46 | 
            +
            puts "Starting Deltacloud API :: #{ENV["API_DRIVER"]} :: http://#{ENV["API_HOST"]}:#{ENV["API_PORT"]}/api"
         | 
| 47 | 
            +
            puts
         | 
| 48 | 
            +
             | 
| 47 49 | 
             
            dirname="#{File.dirname(__FILE__)}/.."
         | 
| 50 | 
            +
            platform = RUBY_PLATFORM[/java/] || 'ruby'
         | 
| 48 51 |  | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
            argv_opts << ['--address', ENV["API_HOST"] ]
         | 
| 52 | 
            -
            argv_opts << ['--port', ENV["API_PORT"] ]
         | 
| 53 | 
            -
            argv_opts << ['--rackup', 'config.ru' ]
         | 
| 54 | 
            -
            argv_opts << ['--chdir', dirname ]
         | 
| 55 | 
            -
            argv_opts << ['-e', options[:env] ]
         | 
| 56 | 
            -
            argv_opts << ['--threaded', '-D', '--stats', '/stats']
         | 
| 57 | 
            -
             | 
| 58 | 
            -
            argv_opts.flatten!
         | 
| 59 | 
            -
             | 
| 60 | 
            -
            if options[:env] == "development"
         | 
| 61 | 
            -
              use_rerun = false
         | 
| 62 | 
            -
              begin
         | 
| 63 | 
            -
                require "rerun"
         | 
| 64 | 
            -
                use_rerun = true
         | 
| 65 | 
            -
              rescue
         | 
| 66 | 
            -
                # Do nothing
         | 
| 67 | 
            -
              end
         | 
| 68 | 
            -
            end
         | 
| 52 | 
            +
            if platform == 'java'
         | 
| 53 | 
            +
              require 'rack'
         | 
| 69 54 |  | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 55 | 
            +
              # We can't chdir with webrick so add our root directory
         | 
| 56 | 
            +
              # onto the load path
         | 
| 57 | 
            +
              $: << dirname
         | 
| 58 | 
            +
             | 
| 59 | 
            +
              # Read in config.ru and convert it to an instance of Rack::Builder
         | 
| 60 | 
            +
              cfgfile = File.read(File.join(dirname, 'config.ru'))
         | 
| 61 | 
            +
              inner_app = eval("Rack::Builder.new {(" + cfgfile + "\n )}.to_app",
         | 
| 62 | 
            +
                               nil, 'config.ru')
         | 
| 72 63 |  | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
               | 
| 79 | 
            -
             | 
| 64 | 
            +
              app = Rack::Builder.new {
         | 
| 65 | 
            +
                use Rack::CommonLogger # apache-like logging
         | 
| 66 | 
            +
                use Rack::Reloader if options[:env] == "development"
         | 
| 67 | 
            +
                set :root, dirname # Set Sinatra root since we can't chdir to ../
         | 
| 68 | 
            +
                run inner_app
         | 
| 69 | 
            +
              }.to_app
         | 
| 70 | 
            +
             | 
| 71 | 
            +
              # There's a bug with string ports on JRuby so convert to int
         | 
| 72 | 
            +
              # http://jira.codehaus.org/browse/JRUBY-4868
         | 
| 73 | 
            +
              port = ENV["API_PORT"].to_i
         | 
| 74 | 
            +
             | 
| 75 | 
            +
              puts "=> Ctrl-C to shutdown server"
         | 
| 76 | 
            +
              Rack::Handler::WEBrick.run(app,
         | 
| 77 | 
            +
                                         :Host => ENV["API_HOST"],
         | 
| 78 | 
            +
                                         :Port => port,
         | 
| 79 | 
            +
                                         :AccessLog => [])
         | 
| 80 80 | 
             
            else
         | 
| 81 | 
            -
              thin | 
| 81 | 
            +
              require 'thin'
         | 
| 82 | 
            +
             | 
| 83 | 
            +
              argv_opts = ARGV.clone
         | 
| 84 | 
            +
              argv_opts << ['start'] unless Thin::Runner.commands.include?(options[0])
         | 
| 85 | 
            +
              argv_opts << ['--address', ENV["API_HOST"] ]
         | 
| 86 | 
            +
              argv_opts << ['--port', ENV["API_PORT"] ]
         | 
| 87 | 
            +
              argv_opts << ['--rackup', 'config.ru' ]
         | 
| 88 | 
            +
              argv_opts << ['--chdir', dirname ]
         | 
| 89 | 
            +
              argv_opts << ['-e', options[:env] ]
         | 
| 90 | 
            +
              argv_opts << ['--threaded', '-D', '--stats', '/stats']
         | 
| 91 | 
            +
             | 
| 92 | 
            +
              argv_opts.flatten!
         | 
| 93 | 
            +
             | 
| 94 | 
            +
              if options[:env] == "development"
         | 
| 95 | 
            +
                use_rerun = false
         | 
| 96 | 
            +
                begin
         | 
| 97 | 
            +
                  require "rerun"
         | 
| 98 | 
            +
                  use_rerun = true
         | 
| 99 | 
            +
                rescue
         | 
| 100 | 
            +
                  # Do nothing
         | 
| 101 | 
            +
                end
         | 
| 102 | 
            +
              end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
              if use_rerun
         | 
| 105 | 
            +
                argv_opts.unshift "thin"
         | 
| 106 | 
            +
                command = argv_opts.join(" ")
         | 
| 107 | 
            +
                topdir = File::expand_path(File::join(File::dirname(__FILE__), ".."))
         | 
| 108 | 
            +
                rerun = Rerun::Runner.new(command, :dir => topdir)
         | 
| 109 | 
            +
                rerun.start
         | 
| 110 | 
            +
                rerun.join
         | 
| 111 | 
            +
              else
         | 
| 112 | 
            +
                thin = Thin::Runner.new(argv_opts)
         | 
| 82 113 |  | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 114 | 
            +
                begin
         | 
| 115 | 
            +
                  thin.run!
         | 
| 116 | 
            +
                rescue Exception => e
         | 
| 117 | 
            +
                  puts "ERROR: #{e.message}"
         | 
| 118 | 
            +
                end
         | 
| 87 119 | 
             
              end
         | 
| 88 120 | 
             
            end
         | 
    
        data/config.ru
    CHANGED
    
    
| @@ -310,6 +310,15 @@ class EC2Driver < Deltacloud::BaseDriver | |
| 310 310 | 
             
                end
         | 
| 311 311 | 
             
              end
         | 
| 312 312 |  | 
| 313 | 
            +
              def valid_credentials?(credentials)
         | 
| 314 | 
            +
                client = new_client(credentials)
         | 
| 315 | 
            +
                # FIXME: We need to do this call to determine if
         | 
| 316 | 
            +
                #        EC2 is working with given credentials. There is no
         | 
| 317 | 
            +
                #        other way to check, if given credentials are valid or not.
         | 
| 318 | 
            +
                realms = client.describe_availability_zones rescue false
         | 
| 319 | 
            +
                return realms ? true : false
         | 
| 320 | 
            +
              end
         | 
| 321 | 
            +
             | 
| 313 322 | 
             
              private
         | 
| 314 323 |  | 
| 315 324 | 
             
              def new_client(credentials)
         | 
| @@ -9,7 +9,7 @@ class GoGridClient | |
| 9 9 | 
             
                             apikey='YOUR API KEY',
         | 
| 10 10 | 
             
                             secret='YOUR SHARED SECRET', 
         | 
| 11 11 | 
             
                             format='json',
         | 
| 12 | 
            -
                             version='1. | 
| 12 | 
            +
                             version='1.5')
         | 
| 13 13 | 
             
                @server = server
         | 
| 14 14 | 
             
                @secret = secret
         | 
| 15 15 | 
             
                @default_params = {'format'=>format, 'v'=>version,'api_key' => apikey}
         | 
| @@ -30,7 +30,12 @@ class GoGridClient | |
| 30 30 | 
             
                open(getRequestURL(method,params)).read
         | 
| 31 31 | 
             
              end
         | 
| 32 32 |  | 
| 33 | 
            -
              def request(method, params={})
         | 
| 33 | 
            +
              def request(method, params={}, version=nil)
         | 
| 34 | 
            +
                if version
         | 
| 35 | 
            +
                  @default_params['v'] = version
         | 
| 36 | 
            +
                else
         | 
| 37 | 
            +
                  @default_params['v'] = '1.5'
         | 
| 38 | 
            +
                end
         | 
| 34 39 | 
             
                begin
         | 
| 35 40 | 
             
                  JSON::parse(sendAPIRequest(method, params))
         | 
| 36 41 | 
             
                rescue Exception => e
         | 
| @@ -67,7 +67,7 @@ class GogridDriver < Deltacloud::BaseDriver | |
| 67 67 |  | 
| 68 68 | 
             
              def realms(credentials, opts=nil)
         | 
| 69 69 | 
             
                safely do
         | 
| 70 | 
            -
                  new_client(credentials).request('common/lookup/list', { 'lookup' => ' | 
| 70 | 
            +
                  new_client(credentials).request('common/lookup/list', { 'lookup' => 'ip.datacenter' })['list'].collect do |realm|
         | 
| 71 71 | 
             
                    convert_realm(realm)
         | 
| 72 72 | 
             
                  end
         | 
| 73 73 | 
             
                end
         | 
| @@ -88,7 +88,7 @@ class GogridDriver < Deltacloud::BaseDriver | |
| 88 88 | 
             
                    'name' => name,
         | 
| 89 89 | 
             
                    'image' => image_id,
         | 
| 90 90 | 
             
                    'server.ram' => server_ram,
         | 
| 91 | 
            -
                    'ip' =>  | 
| 91 | 
            +
                    'ip' => get_free_ip_from_realm(credentials, opts[:realm_id] || '1')
         | 
| 92 92 | 
             
                  })['list'].first
         | 
| 93 93 | 
             
                  if instance
         | 
| 94 94 | 
             
                    login_data = get_login_data(client, instance[:id])
         | 
| @@ -120,6 +120,7 @@ class GogridDriver < Deltacloud::BaseDriver | |
| 120 120 | 
             
              end
         | 
| 121 121 |  | 
| 122 122 | 
             
              def instances(credentials, opts=nil)
         | 
| 123 | 
            +
                require 'ap'
         | 
| 123 124 | 
             
                instances = []
         | 
| 124 125 | 
             
                if opts and opts[:id]
         | 
| 125 126 | 
             
                  begin
         | 
| @@ -154,25 +155,25 @@ class GogridDriver < Deltacloud::BaseDriver | |
| 154 155 |  | 
| 155 156 | 
             
              def reboot_instance(credentials, id)
         | 
| 156 157 | 
             
                safely do
         | 
| 157 | 
            -
                  new_client(credentials).request('grid/server/power', { ' | 
| 158 | 
            +
                  new_client(credentials).request('grid/server/power', { 'name' => id, 'power' => 'reboot'})
         | 
| 158 159 | 
             
                end
         | 
| 159 160 | 
             
              end
         | 
| 160 161 |  | 
| 161 162 | 
             
              def destroy_instance(credentials, id)
         | 
| 162 163 | 
             
                safely do
         | 
| 163 | 
            -
                  new_client(credentials).request('grid/server/delete', { ' | 
| 164 | 
            +
                  new_client(credentials).request('grid/server/delete', { 'name' => id})
         | 
| 164 165 | 
             
                end
         | 
| 165 166 | 
             
              end
         | 
| 166 167 |  | 
| 167 168 | 
             
              def stop_instance(credentials, id)
         | 
| 168 169 | 
             
                safely do
         | 
| 169 | 
            -
                  new_client(credentials).request('grid/server/power', { ' | 
| 170 | 
            +
                  new_client(credentials).request('grid/server/power', { 'name' => id, 'power' => 'off'})
         | 
| 170 171 | 
             
                end
         | 
| 171 172 | 
             
              end
         | 
| 172 173 |  | 
| 173 174 | 
             
              def start_instance(credentials, id)
         | 
| 174 175 | 
             
                safely do
         | 
| 175 | 
            -
                  new_client(credentials).request('grid/server/power', { ' | 
| 176 | 
            +
                  new_client(credentials).request('grid/server/power', { 'name' => id, 'power' => 'on'})
         | 
| 176 177 | 
             
                end
         | 
| 177 178 | 
             
              end
         | 
| 178 179 |  | 
| @@ -183,12 +184,23 @@ class GogridDriver < Deltacloud::BaseDriver | |
| 183 184 | 
             
              def keys(credentials, opts=nil)
         | 
| 184 185 | 
             
                gogrid = new_client( credentials )
         | 
| 185 186 | 
             
                creds = []
         | 
| 186 | 
            -
                 | 
| 187 | 
            -
                   | 
| 187 | 
            +
                safely do
         | 
| 188 | 
            +
                  gogrid.request('support/password/list')['list'].each do |password|
         | 
| 189 | 
            +
                    creds << convert_key(password)
         | 
| 190 | 
            +
                  end
         | 
| 188 191 | 
             
                end
         | 
| 189 192 | 
             
                return creds
         | 
| 190 193 | 
             
              end
         | 
| 191 194 |  | 
| 195 | 
            +
              def valid_credentials?(credentials)
         | 
| 196 | 
            +
                client = new_client(credentials)
         | 
| 197 | 
            +
                # FIXME: We need to do this call to determine if
         | 
| 198 | 
            +
                #        GoGrid is working with given credentials. There is no
         | 
| 199 | 
            +
                #        other way to check, if given credentials are valid or not.
         | 
| 200 | 
            +
                return false unless new_client(credentials).request('common/lookup/list', { 'lookup' => 'ip.datacenter' })
         | 
| 201 | 
            +
                true
         | 
| 202 | 
            +
              end
         | 
| 203 | 
            +
             | 
| 192 204 | 
             
              define_instance_states do
         | 
| 193 205 | 
             
                start.to( :pending )         .automatically
         | 
| 194 206 | 
             
                pending.to( :running )       .automatically
         | 
| @@ -202,6 +214,7 @@ class GogridDriver < Deltacloud::BaseDriver | |
| 202 214 |  | 
| 203 215 | 
             
              def new_client(credentials)
         | 
| 204 216 | 
             
                GoGridClient.new('https://api.gogrid.com/api', credentials.user, credentials.password)
         | 
| 217 | 
            +
             | 
| 205 218 | 
             
              end
         | 
| 206 219 |  | 
| 207 220 | 
             
              def get_login_data(client, instance_id)
         | 
| @@ -282,7 +295,7 @@ class GogridDriver < Deltacloud::BaseDriver | |
| 282 295 | 
             
                  :image_id => instance['image']['id'],
         | 
| 283 296 | 
             
                  :instance_profile => prof,
         | 
| 284 297 | 
             
                  :name => instance['name'],
         | 
| 285 | 
            -
                  :realm_id => instance[' | 
| 298 | 
            +
                  :realm_id => instance['ip']['datacenter']['id'],
         | 
| 286 299 | 
             
                  :state => convert_server_state(instance['state']['name'], instance['id']),
         | 
| 287 300 | 
             
                  :actions => instance_actions_for(convert_server_state(instance['state']['name'], instance['id'])),
         | 
| 288 301 | 
             
                  :public_addresses => [ instance['ip']['ip'] ],
         | 
| @@ -301,12 +314,13 @@ class GogridDriver < Deltacloud::BaseDriver | |
| 301 314 | 
             
                state.eql?('Off') ? 'STOPPED' : 'RUNNING'
         | 
| 302 315 | 
             
              end
         | 
| 303 316 |  | 
| 304 | 
            -
              def  | 
| 317 | 
            +
              def get_free_ip_from_realm(credentials, realm_id)
         | 
| 305 318 | 
             
                ip = ""
         | 
| 306 319 | 
             
                safely do
         | 
| 307 320 | 
             
                  ip = new_client(credentials).request('grid/ip/list', {
         | 
| 308 321 | 
             
                    'ip.type' => '1',
         | 
| 309 | 
            -
                    'ip.state' => '1'
         | 
| 322 | 
            +
                    'ip.state' => '1',
         | 
| 323 | 
            +
                    'datacenter' => realm_id
         | 
| 310 324 | 
             
                  })['list'].first['ip']
         | 
| 311 325 | 
             
                end
         | 
| 312 326 | 
             
                return ip
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            require 'gogrid_client'
         | 
| 2 | 
            +
            require 'ap'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            user='fbb1de3897597ccf'
         | 
| 5 | 
            +
            password='ngieth10'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            client=GoGridClient.new('https://api.gogrid.com/api', user, password)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ap client.request('grid/ip/list', {
         | 
| 10 | 
            +
              'ip.type' => '1',
         | 
| 11 | 
            +
              'ip.state' => '1',
         | 
| 12 | 
            +
              'datacenter' => '1'
         | 
| 13 | 
            +
            })
         | 
| @@ -257,6 +257,15 @@ class MockDriver < Deltacloud::BaseDriver | |
| 257 257 | 
             
                snapshots
         | 
| 258 258 | 
             
              end
         | 
| 259 259 |  | 
| 260 | 
            +
              def valid_credentials?(credentials)
         | 
| 261 | 
            +
                begin
         | 
| 262 | 
            +
                  check_credentials(credentials)
         | 
| 263 | 
            +
                  return true
         | 
| 264 | 
            +
                rescue Deltacloud::AuthException
         | 
| 265 | 
            +
                end
         | 
| 266 | 
            +
                return false
         | 
| 267 | 
            +
              end
         | 
| 268 | 
            +
             | 
| 260 269 | 
             
              private
         | 
| 261 270 |  | 
| 262 271 | 
             
              def check_credentials(credentials)
         | 
| @@ -73,6 +73,11 @@ class RackspaceDriver < Deltacloud::BaseDriver | |
| 73 73 | 
             
                safely do
         | 
| 74 74 | 
             
                  racks.reboot_server(id)
         | 
| 75 75 | 
             
                end
         | 
| 76 | 
            +
                Instance.new( {
         | 
| 77 | 
            +
                  :id => id,
         | 
| 78 | 
            +
                  :state => "REBOOT",
         | 
| 79 | 
            +
                  :actions => instance_actions_for( state ),
         | 
| 80 | 
            +
                } )
         | 
| 76 81 | 
             
              end
         | 
| 77 82 |  | 
| 78 83 | 
             
              def stop_instance(credentials, id)
         | 
| @@ -84,6 +89,11 @@ class RackspaceDriver < Deltacloud::BaseDriver | |
| 84 89 | 
             
                safely do
         | 
| 85 90 | 
             
                  racks.delete_server(id)
         | 
| 86 91 | 
             
                end
         | 
| 92 | 
            +
                Instance.new( {
         | 
| 93 | 
            +
                  :id => id,
         | 
| 94 | 
            +
                  :state => "STOPPED",
         | 
| 95 | 
            +
                  :actions => instance_actions_for( "STOPPED" ),
         | 
| 96 | 
            +
                } )
         | 
| 87 97 | 
             
              end
         | 
| 88 98 |  | 
| 89 99 |  | 
| @@ -121,9 +131,17 @@ class RackspaceDriver < Deltacloud::BaseDriver | |
| 121 131 | 
             
                instances
         | 
| 122 132 | 
             
              end
         | 
| 123 133 |  | 
| 134 | 
            +
              def valid_credentials?(credentials)
         | 
| 135 | 
            +
                begin
         | 
| 136 | 
            +
                  new_client(credentials)
         | 
| 137 | 
            +
                rescue
         | 
| 138 | 
            +
                  return false
         | 
| 139 | 
            +
                end
         | 
| 140 | 
            +
                true
         | 
| 141 | 
            +
              end
         | 
| 142 | 
            +
             | 
| 124 143 |  | 
| 125 144 | 
             
              def convert_srv_to_instance(srv)
         | 
| 126 | 
            -
                status = srv["status"] == "ACTIVE" ? "RUNNING" : "PENDING"
         | 
| 127 145 | 
             
                inst = Instance.new(:id => srv["id"].to_s,
         | 
| 128 146 | 
             
                                    :owner_id => "root",
         | 
| 129 147 | 
             
                                    :realm_id => "us")
         | 
| @@ -118,7 +118,7 @@ VAPP_STATE_MAP = { "0" =>  "PENDING", "1" =>  "PENDING", "2" =>  "STOPPED", "4" | |
| 118 118 | 
             
                running.to(:running)          .on( :reboot )
         | 
| 119 119 | 
             
                running.to(:shutting_down)    .on( :stop )
         | 
| 120 120 | 
             
                shutting_down.to(:stopped)    .automatically
         | 
| 121 | 
            -
                stopped.to(: | 
| 121 | 
            +
                stopped.to(:finish)           .on( :destroy )
         | 
| 122 122 | 
             
               end
         | 
| 123 123 |  | 
| 124 124 |  | 
| @@ -191,6 +191,15 @@ def destroy_instance(credentials, id) | |
| 191 191 | 
             
              end
         | 
| 192 192 | 
             
            end
         | 
| 193 193 |  | 
| 194 | 
            +
            def valid_credentials?(credentials)
         | 
| 195 | 
            +
              begin
         | 
| 196 | 
            +
                new_client(credentials)
         | 
| 197 | 
            +
              rescue Deltacloud::AuthException
         | 
| 198 | 
            +
                return false
         | 
| 199 | 
            +
              end
         | 
| 200 | 
            +
              true
         | 
| 201 | 
            +
            end
         | 
| 202 | 
            +
             | 
| 194 203 | 
             
            #--
         | 
| 195 204 | 
             
            # PRIVATE METHODS:
         | 
| 196 205 | 
             
            #--
         | 
| @@ -20,8 +20,8 @@ | |
| 20 20 | 
             
            module ApplicationHelper
         | 
| 21 21 |  | 
| 22 22 | 
             
              def bread_crumb
         | 
| 23 | 
            -
                s = "<ul class='breadcrumb'><li class='first'><a href='/'>δ</a></li>"
         | 
| 24 | 
            -
                url = request. | 
| 23 | 
            +
                s = "<ul class='breadcrumb'><li class='first'><a href='#{url_for('/')}'>δ</a></li>"
         | 
| 24 | 
            +
                url = request.path_info.split('?')  #remove extra query string parameters
         | 
| 25 25 | 
             
                levels = url[0].split('/') #break up url into different levels
         | 
| 26 26 | 
             
                levels.each_with_index do |level, index|
         | 
| 27 27 | 
             
                  unless level.blank?
         | 
| @@ -30,7 +30,7 @@ module ApplicationHelper | |
| 30 30 | 
             
                      s += "<li class='subsequent'>#{level.gsub(/_/, ' ')}</li>\n" unless level.to_i > 0
         | 
| 31 31 | 
             
                    else
         | 
| 32 32 | 
             
                        link = levels.slice(0, index+1).join("/")
         | 
| 33 | 
            -
                        s += "<li class='subsequent'><a href=\"#{link}\">#{level.gsub(/_/, ' ')}</a></li>\n"
         | 
| 33 | 
            +
                        s += "<li class='subsequent'><a href=\"#{url_for(link)}\">#{level.gsub(/_/, ' ')}</a></li>\n"
         | 
| 34 34 | 
             
                    end
         | 
| 35 35 | 
             
                  end
         | 
| 36 36 | 
             
                end
         | 
    
        data/lib/sinatra/url_for.rb
    CHANGED
    
    | @@ -33,7 +33,13 @@ module Sinatra | |
| 33 33 | 
             
                    raise TypeError, "Unknown url_for mode #{mode}"
         | 
| 34 34 | 
             
                  end
         | 
| 35 35 | 
             
                  url_escape = URI.escape(url_fragment)
         | 
| 36 | 
            -
                   | 
| 36 | 
            +
                  # Don't add the base fragment if url_for gets called more than once
         | 
| 37 | 
            +
                  # per url or the url_fragment passed in is an absolute url
         | 
| 38 | 
            +
                  if url_escape.match(/^#{base}/) or url_escape.match(/^http/)
         | 
| 39 | 
            +
                    url_escape
         | 
| 40 | 
            +
                  else
         | 
| 41 | 
            +
                    "#{base}#{url_escape}"
         | 
| 42 | 
            +
                  end
         | 
| 37 43 | 
             
                end
         | 
| 38 44 |  | 
| 39 45 | 
             
                def root_url
         | 
    
        data/server.rb
    CHANGED
    
    | @@ -38,10 +38,13 @@ error Deltacloud::BackendError do | |
| 38 38 | 
             
            end
         | 
| 39 39 |  | 
| 40 40 | 
             
            # Redirect to /api
         | 
| 41 | 
            -
            get '/' do redirect '/api'; end
         | 
| 41 | 
            +
            get '/' do redirect url_for('/api'); end
         | 
| 42 42 |  | 
| 43 43 | 
             
            get '/api\/?' do
         | 
| 44 44 | 
             
                @version = 0.1
         | 
| 45 | 
            +
                if params[:force_auth]
         | 
| 46 | 
            +
                  return [401, 'Authentication failed'] unless driver.valid_credentials?(credentials)
         | 
| 47 | 
            +
                end
         | 
| 45 48 | 
             
                respond_to do |format|
         | 
| 46 49 | 
             
                    format.xml { haml :"api/show" }
         | 
| 47 50 | 
             
                    format.json do
         | 
| @@ -174,7 +177,7 @@ END | |
| 174 177 | 
             
              end
         | 
| 175 178 |  | 
| 176 179 | 
             
              operation :show do
         | 
| 177 | 
            -
                description 'Show an  | 
| 180 | 
            +
                description 'Show an instance identified by "id" parameter.'
         | 
| 178 181 | 
             
                param :id,           :string, :required
         | 
| 179 182 | 
             
                control { show(:instance) }
         | 
| 180 183 | 
             
              end
         | 
    
        data/test.rb
    ADDED
    
    
| @@ -0,0 +1,50 @@ | |
| 1 | 
            +
            require 'tests/common'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module DeltacloudUnitTest
         | 
| 4 | 
            +
              class UrlForTest < Test::Unit::TestCase
         | 
| 5 | 
            +
                include Rack::Test::Methods
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def app
         | 
| 8 | 
            +
                  Sinatra::Application
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def test_it_works_for_root
         | 
| 12 | 
            +
                  verify_url_for("/", "/")
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def test_it_works_for_root_absolute
         | 
| 16 | 
            +
                  verify_url_for("/", "http://localhost/", :full)
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def test_it_works_with_spaces
         | 
| 20 | 
            +
                  verify_url_for("/url with spaces", "/url%20with%20spaces")
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def test_it_works_when_given_absolute
         | 
| 24 | 
            +
                  verify_url_for("http://test.com", "http://test.com")
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                def test_it_works_when_not_at_root_context
         | 
| 28 | 
            +
                  verify_url_for("/", "context/", :path_only, {}, {"SCRIPT_NAME" => "context"})
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                def verify_url_for(url, expected_url, mode=:path_only, params={}, rack_env={})
         | 
| 32 | 
            +
                  # generate a unique url for each test
         | 
| 33 | 
            +
                  test_url = "/url_for_test/#{expected_url.hash}/#{Time.now.to_f}"
         | 
| 34 | 
            +
                  # Create our sinatra test endpoint
         | 
| 35 | 
            +
                  self.class.create_test_url_content(test_url, url, mode)
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  # verify the generated url matches what we expect
         | 
| 38 | 
            +
                  get test_url, params, rack_env
         | 
| 39 | 
            +
                  last_response.body.should == expected_url
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                def self.create_test_url_content(test_url, url_content, mode)
         | 
| 43 | 
            +
                  get test_url do
         | 
| 44 | 
            +
                    content_type "text/plain"
         | 
| 45 | 
            +
                      url_for(url_content, mode)
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
              end
         | 
| 50 | 
            +
            end
         | 
    
        data/views/api/show.html.haml
    CHANGED
    
    
| @@ -16,7 +16,7 @@ | |
| 16 16 | 
             
                - @operations.keys.sort_by { |k| k.to_s }.each do |operation|
         | 
| 17 17 | 
             
                  %tr
         | 
| 18 18 | 
             
                    %td{:style => "width:15em"}
         | 
| 19 | 
            -
                      %a{:href => "/api/docs/#{@collection.name.to_s}/#{operation}"} #{operation}
         | 
| 19 | 
            +
                      %a{:href => url_for("/api/docs/#{@collection.name.to_s}/#{operation}")} #{operation}
         | 
| 20 20 | 
             
                    %td{:style => "width:10em"} #{@operations[operation].description}
         | 
| 21 21 |  | 
| 22 22 | 
             
            %h3 Features:
         | 
| @@ -34,4 +34,4 @@ | |
| 34 34 | 
             
                    %td= feature.description
         | 
| 35 35 | 
             
                    %td
         | 
| 36 36 | 
             
                      - feature.operations.each do |op|
         | 
| 37 | 
            -
                        %a{:href => "/api/docs/#{@collection.name.to_s}/#{op.name}"} #{op.name}
         | 
| 37 | 
            +
                        %a{:href => url_for("/api/docs/#{@collection.name.to_s}/#{op.name}")} #{op.name}
         | 
| @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            %docs{:status => "unsupported"}
         | 
| 2 | 
            -
              %collection{:url => "/api/docs/#{@collection.name}", :name => "#{@collection.name}"}
         | 
| 2 | 
            +
              %collection{:url => url_for("/api/docs/#{@collection.name}"), :name => "#{@collection.name}"}
         | 
| 3 3 | 
             
                %description #{@collection.description}
         | 
| 4 4 | 
             
                %operations
         | 
| 5 5 | 
             
                  - @operations.keys.sort_by { |k| k.to_s }.each do |operation|
         | 
| 6 | 
            -
                    %operation{:url => "/api/#{@collection.name.to_s}", :name => "#{operation}", :href => "#{@operations[operation].path}", :method => "#{@operations[operation].method}"}
         | 
| 6 | 
            +
                    %operation{:url => url_for("/api/#{@collection.name.to_s}"), :name => "#{operation}", :href => url_for("#{@operations[operation].path}"), :method => "#{@operations[operation].method}"}
         | 
| 7 7 | 
             
                      %description #{@operations[operation].description}
         | 
| 8 8 | 
             
                      - @operations[operation].each_param do |param|
         | 
| 9 9 | 
             
                        %parameter{:name => "#{param.name}", :type => "#{param.type}"}
         | 
    
        data/views/docs/index.html.haml
    CHANGED
    
    | @@ -11,5 +11,5 @@ | |
| 11 11 | 
             
                - collections.keys.sort_by { |k| k.to_s }.each do |collection|
         | 
| 12 12 | 
             
                  %tr
         | 
| 13 13 | 
             
                    %td{:style => "width:15em"}
         | 
| 14 | 
            -
                      %a{:href => "/api/docs/#{collection}"} #{collection}
         | 
| 14 | 
            +
                      %a{:href => url_for("/api/docs/#{collection}")} #{collection}
         | 
| 15 15 | 
             
                    %td{:style => "width:10em"} #{collections[collection].description}
         | 
    
        data/views/docs/index.xml.haml
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            %docs{:status => "unsupported"}
         | 
| 2 2 | 
             
              - collections.keys.sort_by { |k| k.to_s }.each do |collection|
         | 
| 3 | 
            -
                %collection{:url => "/api/docs/#{collection}"}
         | 
| 3 | 
            +
                %collection{:url => url_for("/api/docs/#{collection}")}
         | 
| 4 4 | 
             
                  %name #{collection}
         | 
| 5 5 | 
             
                  %description  #{collections[collection].description}
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            %h2
         | 
| 2 | 
            -
              %a{:href => "/api/docs/#{@collection.name.to_s}"} #{@collection.name.to_s.titlecase}
         | 
| 2 | 
            +
              %a{:href => url_for("/api/docs/#{@collection.name.to_s}")} #{@collection.name.to_s.titlecase}
         | 
| 3 3 | 
             
              #{'::'}
         | 
| 4 4 | 
             
              #{@operation.name}
         | 
| 5 5 |  | 
| @@ -9,7 +9,7 @@ | |
| 9 9 | 
             
            %h3
         | 
| 10 10 | 
             
              URL:
         | 
| 11 11 | 
             
              %u
         | 
| 12 | 
            -
                = "/api/#{@collection.name.to_s}/#{@operation.name.to_s}"
         | 
| 12 | 
            +
                = url_for("/api/#{@collection.name.to_s}/#{@operation.name.to_s}")
         | 
| 13 13 | 
             
            %br
         | 
| 14 14 | 
             
            %h3 Parameters:
         | 
| 15 15 |  | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            %docs{:status => "unsupported"}
         | 
| 2 | 
            -
              %operation{:url => "/api/docs/#{@collection.name.to_s}", :name => "#{@operation.name.to_s}", :href => "#{@operation.path}", :method => "#{@operation.method}"}
         | 
| 2 | 
            +
              %operation{:url => url_for("/api/docs/#{@collection.name.to_s}"), :name => "#{@operation.name.to_s}", :href => url_for("#{@operation.path}"), :method => "#{@operation.method}"}
         | 
| 3 3 | 
             
                %description #{@operation.description}
         | 
| 4 4 | 
             
                - @operation.each_param do |param|
         | 
| 5 5 | 
             
                  %parameter{:name => "#{param.name}", :type => "#{param.type}"}
         | 
    
        data/views/layout.html.haml
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,12 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: deltacloud-core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 19
         | 
| 4 5 | 
             
              prerelease: false
         | 
| 5 6 | 
             
              segments: 
         | 
| 6 7 | 
             
              - 0
         | 
| 7 8 | 
             
              - 0
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              version: 0.0. | 
| 9 | 
            +
              - 6
         | 
| 10 | 
            +
              version: 0.0.6
         | 
| 10 11 | 
             
            platform: ruby
         | 
| 11 12 | 
             
            authors: 
         | 
| 12 13 | 
             
            - Red Hat, Inc.
         | 
| @@ -14,16 +15,18 @@ autorequire: | |
| 14 15 | 
             
            bindir: bin
         | 
| 15 16 | 
             
            cert_chain: []
         | 
| 16 17 |  | 
| 17 | 
            -
            date: 2010- | 
| 18 | 
            +
            date: 2010-09-10 00:00:00 +02:00
         | 
| 18 19 | 
             
            default_executable: 
         | 
| 19 20 | 
             
            dependencies: 
         | 
| 20 21 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 21 22 | 
             
              name: rake
         | 
| 22 23 | 
             
              prerelease: false
         | 
| 23 24 | 
             
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 25 | 
            +
                none: false
         | 
| 24 26 | 
             
                requirements: 
         | 
| 25 27 | 
             
                - - ">="
         | 
| 26 28 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 29 | 
            +
                    hash: 49
         | 
| 27 30 | 
             
                    segments: 
         | 
| 28 31 | 
             
                    - 0
         | 
| 29 32 | 
             
                    - 8
         | 
| @@ -35,9 +38,11 @@ dependencies: | |
| 35 38 | 
             
              name: eventmachine
         | 
| 36 39 | 
             
              prerelease: false
         | 
| 37 40 | 
             
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 41 | 
            +
                none: false
         | 
| 38 42 | 
             
                requirements: 
         | 
| 39 43 | 
             
                - - ">="
         | 
| 40 44 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 45 | 
            +
                    hash: 59
         | 
| 41 46 | 
             
                    segments: 
         | 
| 42 47 | 
             
                    - 0
         | 
| 43 48 | 
             
                    - 12
         | 
| @@ -49,9 +54,11 @@ dependencies: | |
| 49 54 | 
             
              name: haml
         | 
| 50 55 | 
             
              prerelease: false
         | 
| 51 56 | 
             
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 57 | 
            +
                none: false
         | 
| 52 58 | 
             
                requirements: 
         | 
| 53 59 | 
             
                - - ">="
         | 
| 54 60 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 61 | 
            +
                    hash: 37
         | 
| 55 62 | 
             
                    segments: 
         | 
| 56 63 | 
             
                    - 2
         | 
| 57 64 | 
             
                    - 2
         | 
| @@ -63,9 +70,11 @@ dependencies: | |
| 63 70 | 
             
              name: sinatra
         | 
| 64 71 | 
             
              prerelease: false
         | 
| 65 72 | 
             
              requirement: &id004 !ruby/object:Gem::Requirement 
         | 
| 73 | 
            +
                none: false
         | 
| 66 74 | 
             
                requirements: 
         | 
| 67 75 | 
             
                - - ">="
         | 
| 68 76 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 77 | 
            +
                    hash: 51
         | 
| 69 78 | 
             
                    segments: 
         | 
| 70 79 | 
             
                    - 0
         | 
| 71 80 | 
             
                    - 9
         | 
| @@ -77,9 +86,11 @@ dependencies: | |
| 77 86 | 
             
              name: rack
         | 
| 78 87 | 
             
              prerelease: false
         | 
| 79 88 | 
             
              requirement: &id005 !ruby/object:Gem::Requirement 
         | 
| 89 | 
            +
                none: false
         | 
| 80 90 | 
             
                requirements: 
         | 
| 81 91 | 
             
                - - ">="
         | 
| 82 92 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 93 | 
            +
                    hash: 23
         | 
| 83 94 | 
             
                    segments: 
         | 
| 84 95 | 
             
                    - 1
         | 
| 85 96 | 
             
                    - 0
         | 
| @@ -91,9 +102,11 @@ dependencies: | |
| 91 102 | 
             
              name: thin
         | 
| 92 103 | 
             
              prerelease: false
         | 
| 93 104 | 
             
              requirement: &id006 !ruby/object:Gem::Requirement 
         | 
| 105 | 
            +
                none: false
         | 
| 94 106 | 
             
                requirements: 
         | 
| 95 107 | 
             
                - - ">="
         | 
| 96 108 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 109 | 
            +
                    hash: 21
         | 
| 97 110 | 
             
                    segments: 
         | 
| 98 111 | 
             
                    - 1
         | 
| 99 112 | 
             
                    - 2
         | 
| @@ -105,9 +118,11 @@ dependencies: | |
| 105 118 | 
             
              name: rerun
         | 
| 106 119 | 
             
              prerelease: false
         | 
| 107 120 | 
             
              requirement: &id007 !ruby/object:Gem::Requirement 
         | 
| 121 | 
            +
                none: false
         | 
| 108 122 | 
             
                requirements: 
         | 
| 109 123 | 
             
                - - ">="
         | 
| 110 124 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 125 | 
            +
                    hash: 15
         | 
| 111 126 | 
             
                    segments: 
         | 
| 112 127 | 
             
                    - 0
         | 
| 113 128 | 
             
                    - 5
         | 
| @@ -119,9 +134,11 @@ dependencies: | |
| 119 134 | 
             
              name: json
         | 
| 120 135 | 
             
              prerelease: false
         | 
| 121 136 | 
             
              requirement: &id008 !ruby/object:Gem::Requirement 
         | 
| 137 | 
            +
                none: false
         | 
| 122 138 | 
             
                requirements: 
         | 
| 123 139 | 
             
                - - ">="
         | 
| 124 140 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 141 | 
            +
                    hash: 1
         | 
| 125 142 | 
             
                    segments: 
         | 
| 126 143 | 
             
                    - 1
         | 
| 127 144 | 
             
                    - 4
         | 
| @@ -133,9 +150,11 @@ dependencies: | |
| 133 150 | 
             
              name: compass
         | 
| 134 151 | 
             
              prerelease: false
         | 
| 135 152 | 
             
              requirement: &id009 !ruby/object:Gem::Requirement 
         | 
| 153 | 
            +
                none: false
         | 
| 136 154 | 
             
                requirements: 
         | 
| 137 155 | 
             
                - - ">="
         | 
| 138 156 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 157 | 
            +
                    hash: 29
         | 
| 139 158 | 
             
                    segments: 
         | 
| 140 159 | 
             
                    - 0
         | 
| 141 160 | 
             
                    - 8
         | 
| @@ -147,9 +166,11 @@ dependencies: | |
| 147 166 | 
             
              name: nokogiri
         | 
| 148 167 | 
             
              prerelease: false
         | 
| 149 168 | 
             
              requirement: &id010 !ruby/object:Gem::Requirement 
         | 
| 169 | 
            +
                none: false
         | 
| 150 170 | 
             
                requirements: 
         | 
| 151 171 | 
             
                - - ">="
         | 
| 152 172 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 173 | 
            +
                    hash: 5
         | 
| 153 174 | 
             
                    segments: 
         | 
| 154 175 | 
             
                    - 1
         | 
| 155 176 | 
             
                    - 4
         | 
| @@ -161,9 +182,11 @@ dependencies: | |
| 161 182 | 
             
              name: rack-test
         | 
| 162 183 | 
             
              prerelease: false
         | 
| 163 184 | 
             
              requirement: &id011 !ruby/object:Gem::Requirement 
         | 
| 185 | 
            +
                none: false
         | 
| 164 186 | 
             
                requirements: 
         | 
| 165 187 | 
             
                - - ">="
         | 
| 166 188 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 189 | 
            +
                    hash: 13
         | 
| 167 190 | 
             
                    segments: 
         | 
| 168 191 | 
             
                    - 0
         | 
| 169 192 | 
             
                    - 5
         | 
| @@ -175,9 +198,11 @@ dependencies: | |
| 175 198 | 
             
              name: cucumber
         | 
| 176 199 | 
             
              prerelease: false
         | 
| 177 200 | 
             
              requirement: &id012 !ruby/object:Gem::Requirement 
         | 
| 201 | 
            +
                none: false
         | 
| 178 202 | 
             
                requirements: 
         | 
| 179 203 | 
             
                - - ">="
         | 
| 180 204 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 205 | 
            +
                    hash: 1
         | 
| 181 206 | 
             
                    segments: 
         | 
| 182 207 | 
             
                    - 0
         | 
| 183 208 | 
             
                    - 6
         | 
| @@ -189,9 +214,11 @@ dependencies: | |
| 189 214 | 
             
              name: rcov
         | 
| 190 215 | 
             
              prerelease: false
         | 
| 191 216 | 
             
              requirement: &id013 !ruby/object:Gem::Requirement 
         | 
| 217 | 
            +
                none: false
         | 
| 192 218 | 
             
                requirements: 
         | 
| 193 219 | 
             
                - - ">="
         | 
| 194 220 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 221 | 
            +
                    hash: 43
         | 
| 195 222 | 
             
                    segments: 
         | 
| 196 223 | 
             
                    - 0
         | 
| 197 224 | 
             
                    - 9
         | 
| @@ -210,129 +237,138 @@ extra_rdoc_files: | |
| 210 237 | 
             
            files: 
         | 
| 211 238 | 
             
            - Rakefile
         | 
| 212 239 | 
             
            - config.ru
         | 
| 240 | 
            +
            - test.rb
         | 
| 213 241 | 
             
            - deltacloud.rb
         | 
| 214 242 | 
             
            - server.rb
         | 
| 215 | 
            -
            - support/fedora/deltacloudd
         | 
| 216 243 | 
             
            - support/fedora/rubygem-deltacloud-core.spec
         | 
| 217 | 
            -
            -  | 
| 218 | 
            -
            - lib/ | 
| 219 | 
            -
            - lib/ | 
| 220 | 
            -
            - lib/ | 
| 221 | 
            -
            - lib/ | 
| 244 | 
            +
            - support/fedora/deltacloudd
         | 
| 245 | 
            +
            - lib/drivers.rb
         | 
| 246 | 
            +
            - lib/sinatra/respond_to.rb
         | 
| 247 | 
            +
            - lib/sinatra/lazy_auth.rb
         | 
| 248 | 
            +
            - lib/sinatra/accept_media_types.rb
         | 
| 249 | 
            +
            - lib/sinatra/static_assets.rb
         | 
| 250 | 
            +
            - lib/sinatra/url_for.rb
         | 
| 251 | 
            +
            - lib/sinatra/rabbit.rb
         | 
| 252 | 
            +
            - lib/deltacloud/models/base_model.rb
         | 
| 253 | 
            +
            - lib/deltacloud/models/realm.rb
         | 
| 254 | 
            +
            - lib/deltacloud/models/instance.rb
         | 
| 255 | 
            +
            - lib/deltacloud/models/key.rb
         | 
| 256 | 
            +
            - lib/deltacloud/models/instance_profile.rb
         | 
| 257 | 
            +
            - lib/deltacloud/models/storage_volume.rb
         | 
| 258 | 
            +
            - lib/deltacloud/models/storage_snapshot.rb
         | 
| 259 | 
            +
            - lib/deltacloud/models/image.rb
         | 
| 260 | 
            +
            - lib/deltacloud/method_serializer.rb
         | 
| 261 | 
            +
            - lib/deltacloud/helpers.rb
         | 
| 222 262 | 
             
            - lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
         | 
| 263 | 
            +
            - lib/deltacloud/drivers/ec2/ec2_driver.rb
         | 
| 264 | 
            +
            - lib/deltacloud/drivers/terremark/terremark_driver.rb
         | 
| 265 | 
            +
            - lib/deltacloud/drivers/gogrid/test.rb
         | 
| 223 266 | 
             
            - lib/deltacloud/drivers/gogrid/gogrid_client.rb
         | 
| 224 267 | 
             
            - lib/deltacloud/drivers/gogrid/gogrid_driver.rb
         | 
| 225 | 
            -
            - lib/deltacloud/drivers/mock/mock_driver.rb
         | 
| 226 | 
            -
            - lib/deltacloud/drivers/opennebula/cloud_client.rb
         | 
| 227 | 
            -
            - lib/deltacloud/drivers/opennebula/occi_client.rb
         | 
| 228 268 | 
             
            - lib/deltacloud/drivers/opennebula/opennebula_driver.rb
         | 
| 269 | 
            +
            - lib/deltacloud/drivers/opennebula/occi_client.rb
         | 
| 270 | 
            +
            - lib/deltacloud/drivers/opennebula/cloud_client.rb
         | 
| 271 | 
            +
            - lib/deltacloud/drivers/mock/mock_driver.rb
         | 
| 272 | 
            +
            - lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb
         | 
| 273 | 
            +
            - lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
         | 
| 229 274 | 
             
            - lib/deltacloud/drivers/rackspace/rackspace_client.rb
         | 
| 230 275 | 
             
            - lib/deltacloud/drivers/rackspace/rackspace_driver.rb
         | 
| 231 276 | 
             
            - lib/deltacloud/drivers/rhevm/rhevm_driver.rb
         | 
| 232 | 
            -
            - lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb
         | 
| 233 | 
            -
            - lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb
         | 
| 234 | 
            -
            - lib/deltacloud/drivers/terremark/terremark_driver.rb
         | 
| 235 277 | 
             
            - lib/deltacloud/hardware_profile.rb
         | 
| 236 | 
            -
            - lib/deltacloud/ | 
| 278 | 
            +
            - lib/deltacloud/validation.rb
         | 
| 279 | 
            +
            - lib/deltacloud/base_driver/mock_driver.rb
         | 
| 280 | 
            +
            - lib/deltacloud/base_driver/base_driver.rb
         | 
| 281 | 
            +
            - lib/deltacloud/base_driver/features.rb
         | 
| 282 | 
            +
            - lib/deltacloud/helpers/hardware_profiles_helper.rb
         | 
| 237 283 | 
             
            - lib/deltacloud/helpers/application_helper.rb
         | 
| 238 284 | 
             
            - lib/deltacloud/helpers/conversion_helper.rb
         | 
| 239 | 
            -
            - lib/deltacloud/helpers/hardware_profiles_helper.rb
         | 
| 240 | 
            -
            - lib/deltacloud/method_serializer.rb
         | 
| 241 | 
            -
            - lib/deltacloud/models/base_model.rb
         | 
| 242 | 
            -
            - lib/deltacloud/models/image.rb
         | 
| 243 | 
            -
            - lib/deltacloud/models/instance.rb
         | 
| 244 | 
            -
            - lib/deltacloud/models/instance_profile.rb
         | 
| 245 | 
            -
            - lib/deltacloud/models/realm.rb
         | 
| 246 | 
            -
            - lib/deltacloud/models/storage_snapshot.rb
         | 
| 247 | 
            -
            - lib/deltacloud/models/storage_volume.rb
         | 
| 248 | 
            -
            - lib/deltacloud/models/key.rb
         | 
| 249 285 | 
             
            - lib/deltacloud/state_machine.rb
         | 
| 250 | 
            -
            - lib/deltacloud/ | 
| 251 | 
            -
            - lib/drivers. | 
| 252 | 
            -
            - lib/ | 
| 253 | 
            -
            - lib/ | 
| 254 | 
            -
            - lib/ | 
| 255 | 
            -
            - lib/ | 
| 256 | 
            -
            - lib/ | 
| 257 | 
            -
            - lib/sinatra/url_for.rb
         | 
| 258 | 
            -
            - lib/deltacloud/drivers/mock/data/images/img1.yml
         | 
| 286 | 
            +
            - lib/deltacloud/base_driver.rb
         | 
| 287 | 
            +
            - lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml
         | 
| 288 | 
            +
            - lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml
         | 
| 289 | 
            +
            - lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml
         | 
| 290 | 
            +
            - lib/deltacloud/drivers/mock/data/storage_snapshots/snap3.yml
         | 
| 291 | 
            +
            - lib/deltacloud/drivers/mock/data/storage_snapshots/snap1.yml
         | 
| 292 | 
            +
            - lib/deltacloud/drivers/mock/data/storage_snapshots/snap2.yml
         | 
| 259 293 | 
             
            - lib/deltacloud/drivers/mock/data/images/img2.yml
         | 
| 260 294 | 
             
            - lib/deltacloud/drivers/mock/data/images/img3.yml
         | 
| 261 | 
            -
            - lib/deltacloud/drivers/mock/data/ | 
| 295 | 
            +
            - lib/deltacloud/drivers/mock/data/images/img1.yml
         | 
| 262 296 | 
             
            - lib/deltacloud/drivers/mock/data/instances/inst1.yml
         | 
| 263 297 | 
             
            - lib/deltacloud/drivers/mock/data/instances/inst2.yml
         | 
| 264 | 
            -
            - lib/deltacloud/drivers/mock/data/ | 
| 265 | 
            -
            -  | 
| 266 | 
            -
            -  | 
| 267 | 
            -
            -  | 
| 268 | 
            -
            -  | 
| 269 | 
            -
            -  | 
| 298 | 
            +
            - lib/deltacloud/drivers/mock/data/instances/inst0.yml
         | 
| 299 | 
            +
            - views/instance_states/show.xml.haml
         | 
| 300 | 
            +
            - views/instance_states/show.html.haml
         | 
| 301 | 
            +
            - views/root/index.html.haml
         | 
| 302 | 
            +
            - views/storage_volumes/show.xml.haml
         | 
| 303 | 
            +
            - views/storage_volumes/index.xml.haml
         | 
| 304 | 
            +
            - views/storage_volumes/index.html.haml
         | 
| 305 | 
            +
            - views/storage_volumes/show.html.haml
         | 
| 270 306 | 
             
            - views/accounts/index.html.haml
         | 
| 271 307 | 
             
            - views/accounts/show.html.haml
         | 
| 272 | 
            -
            - views/ | 
| 273 | 
            -
            - views/ | 
| 274 | 
            -
            - views/ | 
| 275 | 
            -
            - views/ | 
| 276 | 
            -
            - views/ | 
| 277 | 
            -
            - views/ | 
| 278 | 
            -
            - views/docs/operation.html.haml
         | 
| 279 | 
            -
            - views/docs/operation.xml.haml
         | 
| 280 | 
            -
            - views/errors/auth_exception.html.haml
         | 
| 308 | 
            +
            - views/storage_snapshots/show.xml.haml
         | 
| 309 | 
            +
            - views/storage_snapshots/index.xml.haml
         | 
| 310 | 
            +
            - views/storage_snapshots/index.html.haml
         | 
| 311 | 
            +
            - views/storage_snapshots/show.html.haml
         | 
| 312 | 
            +
            - views/layout.html.haml
         | 
| 313 | 
            +
            - views/errors/not_found.html.haml
         | 
| 281 314 | 
             
            - views/errors/auth_exception.xml.haml
         | 
| 282 | 
            -
            - views/errors/backend_error.html.haml
         | 
| 283 | 
            -
            - views/errors/backend_error.xml.haml
         | 
| 284 | 
            -
            - views/errors/validation_failure.html.haml
         | 
| 285 315 | 
             
            - views/errors/validation_failure.xml.haml
         | 
| 286 | 
            -
            - views/errors/not_found.html.haml
         | 
| 287 316 | 
             
            - views/errors/not_found.xml.haml
         | 
| 288 | 
            -
            - views/ | 
| 289 | 
            -
            - views/ | 
| 290 | 
            -
            - views/ | 
| 291 | 
            -
            - views/ | 
| 292 | 
            -
            - views/images/ | 
| 317 | 
            +
            - views/errors/backend_error.xml.haml
         | 
| 318 | 
            +
            - views/errors/auth_exception.html.haml
         | 
| 319 | 
            +
            - views/errors/backend_error.html.haml
         | 
| 320 | 
            +
            - views/errors/validation_failure.html.haml
         | 
| 321 | 
            +
            - views/images/show.xml.haml
         | 
| 293 322 | 
             
            - views/images/index.xml.haml
         | 
| 323 | 
            +
            - views/images/index.html.haml
         | 
| 294 324 | 
             
            - views/images/show.html.haml
         | 
| 295 | 
            -
            - views/ | 
| 296 | 
            -
            - views/ | 
| 297 | 
            -
            - views/ | 
| 298 | 
            -
            - views/ | 
| 325 | 
            +
            - views/api/show.xml.haml
         | 
| 326 | 
            +
            - views/api/show.html.haml
         | 
| 327 | 
            +
            - views/keys/show.xml.haml
         | 
| 328 | 
            +
            - views/keys/new.html.haml
         | 
| 329 | 
            +
            - views/keys/index.xml.haml
         | 
| 330 | 
            +
            - views/keys/index.html.haml
         | 
| 331 | 
            +
            - views/keys/show.html.haml
         | 
| 332 | 
            +
            - views/instances/show.xml.haml
         | 
| 299 333 | 
             
            - views/instances/index.xml.haml
         | 
| 300 | 
            -
            - views/instances/ | 
| 334 | 
            +
            - views/instances/index.html.haml
         | 
| 301 335 | 
             
            - views/instances/show.html.haml
         | 
| 302 | 
            -
            - views/instances/ | 
| 303 | 
            -
            - views/ | 
| 304 | 
            -
            - views/ | 
| 336 | 
            +
            - views/instances/new.html.haml
         | 
| 337 | 
            +
            - views/hardware_profiles/show.xml.haml
         | 
| 338 | 
            +
            - views/hardware_profiles/index.xml.haml
         | 
| 339 | 
            +
            - views/hardware_profiles/index.html.haml
         | 
| 340 | 
            +
            - views/hardware_profiles/show.html.haml
         | 
| 341 | 
            +
            - views/docs/operation.xml.haml
         | 
| 342 | 
            +
            - views/docs/operation.html.haml
         | 
| 343 | 
            +
            - views/docs/collection.xml.haml
         | 
| 344 | 
            +
            - views/docs/index.xml.haml
         | 
| 345 | 
            +
            - views/docs/index.html.haml
         | 
| 346 | 
            +
            - views/docs/collection.html.haml
         | 
| 347 | 
            +
            - views/realms/show.xml.haml
         | 
| 305 348 | 
             
            - views/realms/index.xml.haml
         | 
| 306 349 | 
             
            - views/realms/show.html.haml
         | 
| 307 | 
            -
            - views/realms/ | 
| 308 | 
            -
            - views/root/index.html.haml
         | 
| 309 | 
            -
            - views/storage_snapshots/index.html.haml
         | 
| 310 | 
            -
            - views/storage_snapshots/index.xml.haml
         | 
| 311 | 
            -
            - views/storage_snapshots/show.html.haml
         | 
| 312 | 
            -
            - views/storage_snapshots/show.xml.haml
         | 
| 313 | 
            -
            - views/storage_volumes/index.html.haml
         | 
| 314 | 
            -
            - views/storage_volumes/index.xml.haml
         | 
| 315 | 
            -
            - views/storage_volumes/show.html.haml
         | 
| 316 | 
            -
            - views/storage_volumes/show.xml.haml
         | 
| 317 | 
            -
            - views/keys/index.html.haml
         | 
| 318 | 
            -
            - views/keys/index.xml.haml
         | 
| 319 | 
            -
            - views/keys/new.html.haml
         | 
| 320 | 
            -
            - views/keys/show.html.haml
         | 
| 321 | 
            -
            - views/keys/show.xml.haml
         | 
| 350 | 
            +
            - views/realms/index.html.haml
         | 
| 322 351 | 
             
            - views/instance_states/show.gv.erb
         | 
| 323 352 | 
             
            - public/favicon.ico
         | 
| 353 | 
            +
            - public/images/topbar-bg.png
         | 
| 324 354 | 
             
            - public/images/grid.png
         | 
| 325 | 
            -
            - public/images/logo-wide.png
         | 
| 326 355 | 
             
            - public/images/rails.png
         | 
| 327 | 
            -
            - public/images/ | 
| 328 | 
            -
            - public/javascripts/application.js
         | 
| 356 | 
            +
            - public/images/logo-wide.png
         | 
| 329 357 | 
             
            - public/javascripts/jquery-1.4.2.min.js
         | 
| 330 | 
            -
            - public/ | 
| 358 | 
            +
            - public/javascripts/application.js
         | 
| 331 359 | 
             
            - public/stylesheets/compiled/ie.css
         | 
| 360 | 
            +
            - public/stylesheets/compiled/application.css
         | 
| 332 361 | 
             
            - public/stylesheets/compiled/print.css
         | 
| 333 362 | 
             
            - public/stylesheets/compiled/screen.css
         | 
| 334 363 | 
             
            - bin/deltacloudd
         | 
| 335 364 | 
             
            - COPYING
         | 
| 365 | 
            +
            - tests/instance_states_test.rb
         | 
| 366 | 
            +
            - tests/api_test.rb
         | 
| 367 | 
            +
            - tests/instances_test.rb
         | 
| 368 | 
            +
            - tests/hardware_profiles_test.rb
         | 
| 369 | 
            +
            - tests/realms_test.rb
         | 
| 370 | 
            +
            - tests/images_test.rb
         | 
| 371 | 
            +
            - tests/url_for_test.rb
         | 
| 336 372 | 
             
            has_rdoc: true
         | 
| 337 373 | 
             
            homepage: http://www.deltacloud.org
         | 
| 338 374 | 
             
            licenses: []
         | 
| @@ -343,32 +379,37 @@ rdoc_options: [] | |
| 343 379 | 
             
            require_paths: 
         | 
| 344 380 | 
             
            - lib
         | 
| 345 381 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 382 | 
            +
              none: false
         | 
| 346 383 | 
             
              requirements: 
         | 
| 347 384 | 
             
              - - ">="
         | 
| 348 385 | 
             
                - !ruby/object:Gem::Version 
         | 
| 386 | 
            +
                  hash: 53
         | 
| 349 387 | 
             
                  segments: 
         | 
| 350 388 | 
             
                  - 1
         | 
| 351 389 | 
             
                  - 8
         | 
| 352 390 | 
             
                  - 1
         | 
| 353 391 | 
             
                  version: 1.8.1
         | 
| 354 392 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 393 | 
            +
              none: false
         | 
| 355 394 | 
             
              requirements: 
         | 
| 356 395 | 
             
              - - ">="
         | 
| 357 396 | 
             
                - !ruby/object:Gem::Version 
         | 
| 397 | 
            +
                  hash: 3
         | 
| 358 398 | 
             
                  segments: 
         | 
| 359 399 | 
             
                  - 0
         | 
| 360 400 | 
             
                  version: "0"
         | 
| 361 401 | 
             
            requirements: []
         | 
| 362 402 |  | 
| 363 403 | 
             
            rubyforge_project: 
         | 
| 364 | 
            -
            rubygems_version: 1.3. | 
| 404 | 
            +
            rubygems_version: 1.3.7
         | 
| 365 405 | 
             
            signing_key: 
         | 
| 366 406 | 
             
            specification_version: 3
         | 
| 367 407 | 
             
            summary: Deltacloud REST API
         | 
| 368 408 | 
             
            test_files: 
         | 
| 369 | 
            -
            - tests/ | 
| 370 | 
            -
            - tests/images_test.rb
         | 
| 371 | 
            -
            - tests/instances_test.rb
         | 
| 409 | 
            +
            - tests/instance_states_test.rb
         | 
| 372 410 | 
             
            - tests/api_test.rb
         | 
| 411 | 
            +
            - tests/instances_test.rb
         | 
| 373 412 | 
             
            - tests/hardware_profiles_test.rb
         | 
| 374 | 
            -
            - tests/ | 
| 413 | 
            +
            - tests/realms_test.rb
         | 
| 414 | 
            +
            - tests/images_test.rb
         | 
| 415 | 
            +
            - tests/url_for_test.rb
         |