Return-Path: Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: (qmail 43218 invoked from network); 23 Nov 2010 15:00:03 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Nov 2010 15:00:03 -0000 Received: (qmail 29438 invoked by uid 500); 23 Nov 2010 15:00:34 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 29364 invoked by uid 500); 23 Nov 2010 15:00:34 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 29356 invoked by uid 99); 23 Nov 2010 15:00:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Nov 2010 15:00:34 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=10.0 tests=FSL_RU_URL,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Nov 2010 15:00:29 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oANF08R1012160 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Nov 2010 10:00:08 -0500 Received: from patashnik.brq.redhat.com (dhcp-2-138.brq.redhat.com [10.34.2.138]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oANF06jN005077 for ; Tue, 23 Nov 2010 10:00:06 -0500 From: mfojtik@redhat.com To: deltacloud-dev@incubator.apache.org Subject: [PATCH core] Added ASF license header to files Date: Tue, 23 Nov 2010 16:00:05 +0100 Message-Id: <1290524405-5248-1-git-send-email-mfojtik@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 From: Michal Fojtik --- server/config.ru | 20 +- server/deltacloud.rb | 21 +- server/lib/deltacloud/backend_capability.rb | 18 + server/lib/deltacloud/base_driver.rb | 2 +- server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 3 +- .../lib/deltacloud/drivers/ec2/ec2_mock_driver.rb | 18 + .../lib/deltacloud/drivers/ec2/old_ec2_driver.rb | 546 ++++++++++++++++++++ .../lib/deltacloud/drivers/gogrid/gogrid_client.rb | 1 - .../lib/deltacloud/drivers/gogrid/gogrid_driver.rb | 2 +- server/lib/deltacloud/drivers/gogrid/test.rb | 13 - server/lib/deltacloud/drivers/mock/mock_driver.rb | 2 +- .../drivers/rackspace/rackspace_client.rb | 2 +- server/lib/deltacloud/hardware_profile.rb | 17 + server/lib/deltacloud/helpers.rb | 18 + .../lib/deltacloud/helpers/application_helper.rb | 4 +- server/lib/deltacloud/helpers/conversion_helper.rb | 3 +- .../deltacloud/helpers/hardware_profiles_helper.rb | 17 + server/lib/deltacloud/method_serializer.rb | 2 +- server/lib/deltacloud/models/base_model.rb | 2 +- server/lib/deltacloud/models/blob.rb | 4 +- server/lib/deltacloud/models/bucket.rb | 3 +- server/lib/deltacloud/models/image.rb | 5 +- server/lib/deltacloud/models/instance.rb | 3 +- server/lib/deltacloud/models/instance_profile.rb | 3 +- server/lib/deltacloud/models/key.rb | 2 +- server/lib/deltacloud/models/load_balancer.rb | 2 +- server/lib/deltacloud/models/realm.rb | 2 +- server/lib/deltacloud/models/storage_snapshot.rb | 2 +- server/lib/deltacloud/models/storage_volume.rb | 2 +- server/lib/deltacloud/state_machine.rb | 17 + server/lib/deltacloud/validation.rb | 18 + server/lib/drivers.rb | 18 + server/libexec/app/views/api/show.html.erb | 7 - .../libexec/app/views/layouts/application.html.erb | 32 -- server/libexec/app/views/layouts/old.html.erb | 32 -- server/libexec/public/stylesheets/application.css | 96 ---- .../public/stylesheets/sass/application.sass | 109 ---- server/public/stylesheets/application.sass | 109 ++++ server/server.rb | 25 +- 39 files changed, 881 insertions(+), 321 deletions(-) create mode 100644 server/lib/deltacloud/drivers/ec2/old_ec2_driver.rb delete mode 100644 server/lib/deltacloud/drivers/gogrid/test.rb delete mode 100644 server/libexec/app/views/api/show.html.erb delete mode 100644 server/libexec/app/views/layouts/application.html.erb delete mode 100644 server/libexec/app/views/layouts/old.html.erb delete mode 100644 server/libexec/public/stylesheets/application.css delete mode 100644 server/libexec/public/stylesheets/sass/application.sass create mode 100644 server/public/stylesheets/application.sass diff --git a/server/config.ru b/server/config.ru index cb38ca8..74f659b 100644 --- a/server/config.ru +++ b/server/config.ru @@ -1,7 +1,25 @@ +# +# Copyright (C) 2009,2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + require 'rubygems' -require 'sinatra' $:.unshift File.join(File.dirname(__FILE__), '.') require 'server.rb' + run Sinatra::Application diff --git a/server/deltacloud.rb b/server/deltacloud.rb index 02d6c2e..516963e 100644 --- a/server/deltacloud.rb +++ b/server/deltacloud.rb @@ -1,6 +1,25 @@ -# Add ./lib into load path +# +# Copyright (C) 2009,2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + $:.unshift File.join(File.dirname(__FILE__), 'lib') +require 'drivers' + require 'deltacloud/base_driver' require 'deltacloud/hardware_profile' require 'deltacloud/state_machine' diff --git a/server/lib/deltacloud/backend_capability.rb b/server/lib/deltacloud/backend_capability.rb index bec8714..ba37e1e 100644 --- a/server/lib/deltacloud/backend_capability.rb +++ b/server/lib/deltacloud/backend_capability.rb @@ -1,3 +1,21 @@ +# +# Copyright (C) 2009, 2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + module Deltacloud::BackendCapability class Failure < StandardError diff --git a/server/lib/deltacloud/base_driver.rb b/server/lib/deltacloud/base_driver.rb index b540562..fcec3a7 100644 --- a/server/lib/deltacloud/base_driver.rb +++ b/server/lib/deltacloud/base_driver.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009,2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb index 45f2e01..51e34ce 100644 --- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb +++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -16,7 +16,6 @@ # License for the specific language governing permissions and limitations # under the License. - require 'deltacloud/base_driver' require 'active_support' require 'AWS' diff --git a/server/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb index 1c63ff6..6a9c051 100644 --- a/server/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +++ b/server/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb @@ -1,3 +1,21 @@ +# +# Copyright (C) 2009,2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + module RightAws class MockEc2 diff --git a/server/lib/deltacloud/drivers/ec2/old_ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/old_ec2_driver.rb new file mode 100644 index 0000000..9b37069 --- /dev/null +++ b/server/lib/deltacloud/drivers/ec2/old_ec2_driver.rb @@ -0,0 +1,546 @@ +# +# Copyright (C) 2009 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +require 'deltacloud/base_driver' +require 'active_support' +require 'AWS' +require 'right_aws' + +class Instance + attr_accessor :keyname + attr_accessor :authn_error + + def authn_feature_failed? + return true unless authn_error.nil? + end + +end + +module Deltacloud + module Drivers + module EC2 +class EC2Driver < Deltacloud::BaseDriver + + def supported_collections + DEFAULT_COLLECTIONS + [ :keys, :buckets ] + end + + feature :instances, :user_data + feature :instances, :authentication_key + feature :images, :owner_id + feature :buckets, :bucket_location + + define_hardware_profile('m1.small') do + cpu 1 + memory 1.7 * 1024 + storage 160 + architecture 'i386' + end + + define_hardware_profile('m1.large') do + cpu 4 + memory 7.5 * 1024 + storage 850 + architecture 'x86_64' + end + + define_hardware_profile('m1.xlarge') do + cpu 8 + memory 15 * 1024 + storage 1690 + architecture 'x86_64' + end + + define_hardware_profile('c1.medium') do + cpu 5 + memory 1.7 * 1024 + storage 350 + architecture 'i386' + end + + define_hardware_profile('c1.xlarge') do + cpu 20 + memory 7 * 1024 + storage 1690 + architecture 'x86_64' + end + + define_hardware_profile('m2.xlarge') do + cpu 6.5 + memory 17.1 * 1024 + storage 420 + architecture 'x86_64' + end + + define_hardware_profile('m2.2xlarge') do + cpu 13 + memory 34.2 * 1024 + storage 850 + architecture 'x86_64' + end + + define_hardware_profile('m2.4xlarge') do + cpu 26 + memory 68.4 * 1024 + storage 1690 + architecture 'x86_64' + end + + define_instance_states do + start.to( :pending ) .automatically + pending.to( :running ) .automatically + pending.to( :stopping ) .on( :stop ) + pending.to( :stopped ) .automatically + stopped.to( :running ) .on( :start ) + running.to( :running ) .on( :reboot ) + running.to( :stopping ) .on( :stop ) + shutting_down.to( :stopped ) .automatically + stopped.to( :finish ) .automatically + end + + # + # Images + # + + def images(credentials, opts={} ) + ec2 = new_client(credentials) + img_arr = [] + # if we know the image_id, we don't want to limit by owner_id, since this + # will exclude public images + if (opts and opts[:id]) + config = { :image_id => opts[:id] } + else + config = { :owner_id => "amazon" } + config.merge!({ :owner_id => opts[:owner_id] }) if opts and opts[:owner_id] + end + safely do + image_set = ec2.describe_images(config).imagesSet + unless image_set.nil? + image_set.item.each do |image| + img_arr << convert_image(image) + end + end + end + img_arr = filter_on( img_arr, :architecture, opts ) + img_arr.sort_by{|e| [e.owner_id, e.name]} + end + + # + # Realms + # + + def realms(credentials, opts=nil) + ec2 = new_client(credentials) + realms = [] + safely do + ec2.describe_availability_zones.availabilityZoneInfo.item.each do |ec2_realm| + realms << convert_realm( ec2_realm ) + end + end + realms + end + + # + # Instances + # + def instances(credentials, opts=nil) + ec2 = new_client(credentials) + instances = [] + safely do + param = opts.nil? ? nil : opts[:id] + ec2_instances = ec2.describe_instances.reservationSet + return [] unless ec2_instances + ec2_instances.item.each do |item| + item.instancesSet.item.each do |ec2_instance| + instances << convert_instance( ec2_instance, item.ownerId ) + end + end + end + instances = filter_on( instances, :id, opts ) + instances = filter_on( instances, :state, opts ) + instances + end + + + def create_instance(credentials, image_id, opts) + ec2 = new_client( credentials ) + realm_id = opts[:realm_id] + safely do + image = image(credentials, :id => image_id ) + hwp = find_hardware_profile(credentials, opts[:hwp_id], image.id) + ec2_instances = ec2.run_instances( + :image_id => image.id, + :user_data => opts[:user_data], + :key_name => opts[:keyname], + :availability_zone => realm_id, + :monitoring_enabled => true, + :instance_type => hwp.name, + :disable_api_termination => false, + :instance_initiated_shutdown_behavior => 'terminate' + ) + return convert_instance( ec2_instances.instancesSet.item.first, 'pending' ) + end + end + + def generate_instance(ec2, id, backup) + begin + this_instance = ec2.describe_instances( :instance_id => id ).reservationSet.item.first.instancesSet.item.first + convert_instance(this_instance, this_instance.ownerId) + rescue Exception => e + puts "WARNING: ignored error during instance refresh: #{e.message}" + # at this point, the action has succeeded but our follow-up + # "describe_instances" failed for some reason. Create a simple Instance + # object with only the ID and new state in place + state = convert_state(backup.instancesSet.item.first.currentState.name) + Instance.new( { + :id => id, + :state => state, + :actions => instance_actions_for( state ), + } ) + end + end + + def reboot_instance(credentials, id) + ec2 = new_client(credentials) + backup = ec2.reboot_instances( :instance_id => id ) + + generate_instance(ec2, id, backup) + end + + def stop_instance(credentials, id) + ec2 = new_client(credentials) + backup = ec2.terminate_instances( :instance_id => id ) + + generate_instance(ec2, id, backup) + end + + def destroy_instance(credentials, id) + ec2 = new_client(credentials) + backup = ec2.terminate_instances( :instance_id => id ) + + generate_instance(ec2, id, backup) + end + + # + # Storage Volumes + # + + def storage_volumes(credentials, opts=nil) + ec2 = new_client( credentials ) + volumes = [] + safely do + if (opts) + ec2.describe_volumes(:volume_id => opts[:id]).volumeSet.item.each do |ec2_volume| + volumes << convert_volume( ec2_volume ) + end + else + ec2_volumes = ec2.describe_volumes.volumeSet + return [] unless ec2_volumes + ec2_volumes.item.each do |ec2_volume| + volumes << convert_volume( ec2_volume ) + end + end + end + volumes + end + + # + # Storage Snapshots + # + + def storage_snapshots(credentials, opts=nil) + ec2 = new_client( credentials ) + snapshots = [] + safely do + if (opts) + ec2.describe_snapshots(:owner => 'self', :snapshot_id => opts[:id]).snapshotSet.item.each do |ec2_snapshot| + snapshots << convert_snapshot( ec2_snapshot ) + end + else + ec2_snapshots = ec2.describe_snapshots(:owner => 'self').snapshotSet + return [] unless ec2_snapshots + ec2_snapshots.item.each do |ec2_snapshot| + snapshots << convert_snapshot( ec2_snapshot ) + end + end + end + snapshots + end + + def key(credentials, opts=nil) + keys(credentials, opts).first + end + + def keys(credentials, opts=nil) + ec2 = new_client( credentials ) + opts[:key_name] = opts[:id] if opts and opts[:id] + keypairs = ec2.describe_keypairs(opts || {}) + result = [] + safely do + keypairs.keySet.item.each do |keypair| + result << convert_key(keypair) + end + end + result + end + + def create_key(credentials, opts={}) + key = Key.new + ec2 = new_client( credentials ) + safely do + key = convert_key(ec2.create_keypair(opts)) + end + return key + end + + def destroy_key(credentials, opts={}) + safely do + ec2 = new_client( credentials ) + ec2.delete_keypair(opts) + end + end + + def valid_credentials?(credentials) + client = new_client(credentials) + # FIXME: We need to do this call to determine if + # EC2 is working with given credentials. There is no + # other way to check, if given credentials are valid or not. + realms = client.describe_availability_zones rescue false + return realms ? true : false + end + +#-- +# Buckets +#-- get a list of your buckets from the s3 service + def buckets(credentials, opts) + buckets = [] + safely do + s3_client = s3_client(credentials) + bucket_list = s3_client.buckets + bucket_list.each do |current| + buckets << convert_bucket(current) + end + end + buckets = filter_on(buckets, :id, opts) + buckets + end + +#-- +# Create bucket +#-- +#valid values for bucket location: 'EU'|'us-west1'|'ap-southeast-1' - if you +#don't specify a location then by default buckets are created in 'us-east' +#[but if you *do* specify 'us-east' things blow up] + def create_bucket(credentials, name, opts={}) + bucket = nil + safely do + begin + s3_client = s3_client(credentials) + bucket_location = opts['location'] + if bucket_location + bucket = RightAws::S3::Bucket.create(s3_client, name, true, nil, :location => bucket_location) + else + bucket = RightAws::S3::Bucket.create(s3_client, name, true) + end #if + rescue RightAws::AwsError => e + raise e unless e.message =~ /BucketAlreadyExists/ + raise Deltacloud::BackendError.new(409, e.class.to_s, e.message, e.backtrace) + end #begin + end #do + convert_bucket(bucket) + end + +#-- +# Delete_bucket +#-- + def delete_bucket(credentials, name, opts={}) + s3_client = s3_client(credentials) + safely do + s3_client.interface.delete_bucket(name) + end + end + +#-- +# Blobs +#-- + def blobs(credentials, opts = nil) + s3_client = s3_client(credentials) + blobs = [] + safely do + s3_bucket = s3_client.bucket(opts['bucket']) + s3_bucket.keys({}, true).each do |s3_object| + blobs << convert_object(s3_object) + end + end + blobs = filter_on(blobs, :id, opts) + blobs + end + +#-- +# Blob data +#-- + def blob_data(credentials, bucket_id, blob_id, opts) + s3_client = s3_client(credentials) + s3_client.interface.get(bucket_id, blob_id) do |chunk| + yield chunk + end + end + + private + + def new_client(credentials) + opts = { + :access_key_id => credentials.user, + :secret_access_key => credentials.password + } + opts[:server] = ENV['DCLOUD_EC2_URL'] if ENV['DCLOUD_EC2_URL'] + safely do + AWS::EC2::Base.new(opts) + end + end + + def convert_key(key) + Key.new({ + :id => key['keyName'], + :fingerprint => key['keyFingerprint'], + :credential_type => :key, + :pem_rsa_key => key['keyMaterial'] + }) + end + + def convert_image(ec2_image) + Image.new( { + :id=>ec2_image['imageId'], + :name=>ec2_image['name'] || ec2_image['imageId'], + :description=>ec2_image['description'] || ec2_image['imageLocation'] || '', + :owner_id=>ec2_image['imageOwnerId'], + :architecture=>ec2_image['architecture'], + } ) + end + + def convert_realm(ec2_realm) + Realm.new( { + :id=>ec2_realm['zoneName'], + :name=>ec2_realm['zoneName'], + :limit=>ec2_realm['zoneState'].eql?('available') ? :unlimited : 0, + :state=>ec2_realm['zoneState'].upcase, + } ) + end + + def convert_state(ec2_state) + case ec2_state + when "terminated" + "STOPPED" + when "stopped" + "STOPPED" + when "running" + "RUNNING" + when "pending" + "PENDING" + when "shutting-down" + "STOPPED" + end + end + + def convert_instance(ec2_instance, owner_id) + state = convert_state(ec2_instance['instanceState']['name']) + realm_id = ec2_instance['placement']['availabilityZone'] + (realm_id = nil ) if ( realm_id == '' ) + hwp_name = ec2_instance['instanceType'] + instance = Instance.new( { + :id=>ec2_instance['instanceId'], + :name => ec2_instance['imageId'], + :state=>state, + :image_id=>ec2_instance['imageId'], + :owner_id=>owner_id, + :realm_id=>realm_id, + :public_addresses=>( ec2_instance['dnsName'] == '' ? [] : [ec2_instance['dnsName']] ), + :private_addresses=>( ec2_instance['privateDnsName'] == '' ? [] : [ec2_instance['privateDnsName']] ), + :instance_profile =>InstanceProfile.new(hwp_name), + :actions=>instance_actions_for( state ), + :keyname => ec2_instance['keyName'], + :launch_time => ec2_instance['launchTime'] + } ) + instance.authn_error = "Key not set for instance" unless ec2_instance['keyName'] + return instance + end + + def convert_volume(ec2_volume) + StorageVolume.new( { + :id=>ec2_volume['volumeId'], + :created=>ec2_volume['createTime'], + :state=>ec2_volume['status'].upcase, + :capacity=>ec2_volume['size'], + :instance_id=>ec2_volume['snapshotId'], + :device=>ec2_volume['attachmentSet'], + } ) + end + + def convert_snapshot(ec2_snapshot) + StorageSnapshot.new( { + :id=>ec2_snapshot['snapshotId'], + :state=>ec2_snapshot['status'].upcase, + :storage_volume_id=>ec2_snapshot['volumeId'], + :created=>ec2_snapshot['startTime'], + } ) + end + + def s3_client(credentials) + safely do + s3_client = RightAws::S3.new(credentials.user, credentials.password) + end + end + + def convert_bucket(s3_bucket) + #get blob list: + blob_list = [] + s3_bucket.keys.each do |s3_object| + blob_list << s3_object.name + end + #can use AWS::S3::Owner.current.display_name or current.id + Bucket.new( { :id => s3_bucket.name, + :name => s3_bucket.name, + :size => s3_bucket.keys.length, + :blob_list => blob_list + } + ) + end + + def convert_object(s3_object) + Blob.new({ :id => s3_object.name, + :bucket => s3_object.bucket.name.to_s, + :content_length => s3_object.size, + :content_type => s3_object.content_type, + :last_modified => s3_object.last_modified + }) + end + + def catched_exceptions_list + { + :auth => [ AWS::AuthFailure ], + :error => [], + :glob => [ /AWS::(\w+)/ ] + } + end + +end + + end + end +end diff --git a/server/lib/deltacloud/drivers/gogrid/gogrid_client.rb b/server/lib/deltacloud/drivers/gogrid/gogrid_client.rb index c463fa6..43da112 100644 --- a/server/lib/deltacloud/drivers/gogrid/gogrid_client.rb +++ b/server/lib/deltacloud/drivers/gogrid/gogrid_client.rb @@ -1,7 +1,6 @@ require 'digest/md5' require 'cgi' require 'open-uri' -require 'json' class GoGridClient diff --git a/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb b/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb index fd8e756..7de34e2 100644 --- a/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +++ b/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/drivers/gogrid/test.rb b/server/lib/deltacloud/drivers/gogrid/test.rb deleted file mode 100644 index 809081d..0000000 --- a/server/lib/deltacloud/drivers/gogrid/test.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'gogrid_client' -require 'ap' - -user='fbb1de3897597ccf' -password='ngieth10' - -client=GoGridClient.new('https://api.gogrid.com/api', user, password) - -ap client.request('grid/ip/list', { - 'ip.type' => '1', - 'ip.state' => '1', - 'datacenter' => '1' -}) diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb index e1b9e0a..2ef289f 100644 --- a/server/lib/deltacloud/drivers/mock/mock_driver.rb +++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/drivers/rackspace/rackspace_client.rb b/server/lib/deltacloud/drivers/rackspace/rackspace_client.rb index 3d42a06..d803302 100644 --- a/server/lib/deltacloud/drivers/rackspace/rackspace_client.rb +++ b/server/lib/deltacloud/drivers/rackspace/rackspace_client.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/hardware_profile.rb b/server/lib/deltacloud/hardware_profile.rb index 62aca33..9ba235a 100644 --- a/server/lib/deltacloud/hardware_profile.rb +++ b/server/lib/deltacloud/hardware_profile.rb @@ -1,3 +1,20 @@ +# +# Copyright (C) 2009,2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. module Deltacloud class HardwareProfile diff --git a/server/lib/deltacloud/helpers.rb b/server/lib/deltacloud/helpers.rb index 0765962..6cae81c 100644 --- a/server/lib/deltacloud/helpers.rb +++ b/server/lib/deltacloud/helpers.rb @@ -1,3 +1,21 @@ +# +# Copyright (C) 2009,2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + require 'deltacloud/helpers/application_helper' require 'deltacloud/helpers/conversion_helper' require 'deltacloud/helpers/hardware_profiles_helper' diff --git a/server/lib/deltacloud/helpers/application_helper.rb b/server/lib/deltacloud/helpers/application_helper.rb index 00e8bc9..ead4c58 100644 --- a/server/lib/deltacloud/helpers/application_helper.rb +++ b/server/lib/deltacloud/helpers/application_helper.rb @@ -1,5 +1,4 @@ -# -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -17,6 +16,7 @@ # under the License. # Methods added to this helper will be available to all templates in the application. + module ApplicationHelper def bread_crumb diff --git a/server/lib/deltacloud/helpers/conversion_helper.rb b/server/lib/deltacloud/helpers/conversion_helper.rb index e96f9b7..d553253 100644 --- a/server/lib/deltacloud/helpers/conversion_helper.rb +++ b/server/lib/deltacloud/helpers/conversion_helper.rb @@ -1,5 +1,4 @@ -# -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/helpers/hardware_profiles_helper.rb b/server/lib/deltacloud/helpers/hardware_profiles_helper.rb index ff7f239..a394e9f 100644 --- a/server/lib/deltacloud/helpers/hardware_profiles_helper.rb +++ b/server/lib/deltacloud/helpers/hardware_profiles_helper.rb @@ -1,3 +1,20 @@ +# Copyright (C) 2009, 2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + module HardwareProfilesHelper def format_hardware_property(prop) diff --git a/server/lib/deltacloud/method_serializer.rb b/server/lib/deltacloud/method_serializer.rb index 45660c5..c0031bb 100644 --- a/server/lib/deltacloud/method_serializer.rb +++ b/server/lib/deltacloud/method_serializer.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009,2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/models/base_model.rb b/server/lib/deltacloud/models/base_model.rb index bf2a4d2..2c0901e 100644 --- a/server/lib/deltacloud/models/base_model.rb +++ b/server/lib/deltacloud/models/base_model.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/models/blob.rb b/server/lib/deltacloud/models/blob.rb index 44c209d..dfa67fe 100644 --- a/server/lib/deltacloud/models/blob.rb +++ b/server/lib/deltacloud/models/blob.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -17,10 +17,12 @@ # under the License. class Blob < BaseModel + #already has an id from basemodel (for the key) attr_accessor :bucket attr_accessor :content_length attr_accessor :content_type attr_accessor :last_modified attr_accessor :content + end diff --git a/server/lib/deltacloud/models/bucket.rb b/server/lib/deltacloud/models/bucket.rb index 95ead24..1a68c5c 100644 --- a/server/lib/deltacloud/models/bucket.rb +++ b/server/lib/deltacloud/models/bucket.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -21,4 +21,5 @@ class Bucket < BaseModel attr_accessor :name attr_accessor :size attr_accessor :blob_list + end diff --git a/server/lib/deltacloud/models/image.rb b/server/lib/deltacloud/models/image.rb index f921235..6a98657 100644 --- a/server/lib/deltacloud/models/image.rb +++ b/server/lib/deltacloud/models/image.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -16,7 +16,6 @@ # License for the specific language governing permissions and limitations # under the License. - class Image < BaseModel attr_accessor :name @@ -24,4 +23,4 @@ class Image < BaseModel attr_accessor :description attr_accessor :architecture -end \ No newline at end of file +end diff --git a/server/lib/deltacloud/models/instance.rb b/server/lib/deltacloud/models/instance.rb index 0167331..38419e9 100644 --- a/server/lib/deltacloud/models/instance.rb +++ b/server/lib/deltacloud/models/instance.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -16,7 +16,6 @@ # License for the specific language governing permissions and limitations # under the License. - class Instance < BaseModel attr_accessor :owner_id diff --git a/server/lib/deltacloud/models/instance_profile.rb b/server/lib/deltacloud/models/instance_profile.rb index 05e80c6..4e0ce74 100644 --- a/server/lib/deltacloud/models/instance_profile.rb +++ b/server/lib/deltacloud/models/instance_profile.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -18,6 +18,7 @@ # Model to store the hardware profile applied to an instance together with # any instance-specific overrides + class InstanceProfile < BaseModel attr_accessor :memory attr_accessor :storage diff --git a/server/lib/deltacloud/models/key.rb b/server/lib/deltacloud/models/key.rb index 22a69a6..b902ede 100644 --- a/server/lib/deltacloud/models/key.rb +++ b/server/lib/deltacloud/models/key.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/models/load_balancer.rb b/server/lib/deltacloud/models/load_balancer.rb index 546a25f..439b073 100644 --- a/server/lib/deltacloud/models/load_balancer.rb +++ b/server/lib/deltacloud/models/load_balancer.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/models/realm.rb b/server/lib/deltacloud/models/realm.rb index a4c49e9..a7f008a 100644 --- a/server/lib/deltacloud/models/realm.rb +++ b/server/lib/deltacloud/models/realm.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/models/storage_snapshot.rb b/server/lib/deltacloud/models/storage_snapshot.rb index 0c3448b..01702d6 100644 --- a/server/lib/deltacloud/models/storage_snapshot.rb +++ b/server/lib/deltacloud/models/storage_snapshot.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/models/storage_volume.rb b/server/lib/deltacloud/models/storage_volume.rb index 5e9e948..0673f85 100644 --- a/server/lib/deltacloud/models/storage_volume.rb +++ b/server/lib/deltacloud/models/storage_volume.rb @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. +# Copyright (C) 2009, 2010 Red Hat, Inc. # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/server/lib/deltacloud/state_machine.rb b/server/lib/deltacloud/state_machine.rb index 9c4f7ba..8812276 100644 --- a/server/lib/deltacloud/state_machine.rb +++ b/server/lib/deltacloud/state_machine.rb @@ -1,3 +1,20 @@ +# +# Copyright (C) 2009,2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. module Deltacloud class StateMachine diff --git a/server/lib/deltacloud/validation.rb b/server/lib/deltacloud/validation.rb index b4eb3ae..18e71cc 100644 --- a/server/lib/deltacloud/validation.rb +++ b/server/lib/deltacloud/validation.rb @@ -1,3 +1,21 @@ +# +# Copyright (C) 2009,2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + module Deltacloud::Validation class Failure < StandardError diff --git a/server/lib/drivers.rb b/server/lib/drivers.rb index 6e31bb7..83bdebd 100644 --- a/server/lib/drivers.rb +++ b/server/lib/drivers.rb @@ -1,3 +1,21 @@ +# +# Copyright (C) 2009,2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + DRIVERS = { :ec2 => { :name => "EC2" }, :rackspace => { :name => "Rackspace" }, diff --git a/server/libexec/app/views/api/show.html.erb b/server/libexec/app/views/api/show.html.erb deleted file mode 100644 index 33a9d77..0000000 --- a/server/libexec/app/views/api/show.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

API v<%= @version %>

- -
    - <% for entry_point in @entry_points %> -
  • <%= link_to entry_point[0], entry_point[1] %>
  • - <% end %> -
diff --git a/server/libexec/app/views/layouts/application.html.erb b/server/libexec/app/views/layouts/application.html.erb deleted file mode 100644 index 2b05901..0000000 --- a/server/libexec/app/views/layouts/application.html.erb +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - Deltacloud Foundation - <%= stylesheet_link_tag '/yui/reset-fonts-grids/reset-fonts-grids.css' %> - <%= stylesheet_link_tag 'application.css' %> - - - -
-
- <%= link_to image_tag( "logo-wide.png" ), root_url %> - <%= bread_crumb -%> -
-
-
-
- <%= yield %> -
-
-
-
-
- Driver: <%= DRIVER %>
- Copyright 2009 <%= link_to 'Red Hat', 'http://redhat.com' %>
-
-
-
- - diff --git a/server/libexec/app/views/layouts/old.html.erb b/server/libexec/app/views/layouts/old.html.erb deleted file mode 100644 index 78fcbc3..0000000 --- a/server/libexec/app/views/layouts/old.html.erb +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - Deltacloud Foundation - <%= stylesheet_link_tag '/yui/reset-fonts-grids/reset-fonts-grids.css' %> - <%= stylesheet_link_tag 'application.css' %> - - - -
-
- <%= link_to image_tag( "logo-wide.png" ), root_url %> - <%= bread_crumb -%> -
-
-
-
- <%= yield %> -
-
-
-
-
- Driver: <%= DRIVER %>
- Copyright 2009 <%= link_to 'Red Hat', 'http://redhat.com' %> and individual contributors.
-
-
-
- - diff --git a/server/libexec/public/stylesheets/application.css b/server/libexec/public/stylesheets/application.css deleted file mode 100644 index 2ea2ce6..0000000 --- a/server/libexec/public/stylesheets/application.css +++ /dev/null @@ -1,96 +0,0 @@ -html { - background-color: white; } - -body { - font-family: "Trebuchet MS"; } - body a { - color: #441111; } - -#hd { - padding: 1em; - background-image: url('/images/topbar-bg.png'); - margin-bottom: 2em; } - #hd img { - margin-bottom: 1em; } - -#bd { - margin-bottom: 2em; } - - -#bd h1 { - font-size: 160%; - margin-bottom: 1ex; } -#bd h2 { - font-size: 140%; - margin-bottom: 1ex; } -#bd h3 { - font-size: 120%; - margin-bottom: 1ex; } -#bd dl { - font-size: 90%; - margin-bottom: 1em; } - #bd dl di { - display: block; - margin-bottom: 1em; } - #bd dl di dt, #bd dl di dd { - padding: .5ex; } - #bd dl di dt { - font-weight: bold; - background-color: #cccccc; } - #bd dl di dd { - padding-left: 1em; - background-color: #eeeeee; } -#bd ul li { - list-style-type: square; - margin-left: 1em; } -#bd em { - font-style: italic; } - -ul.breadcrumb { - background-color: #eee; - border: 1px solid #46A; - padding: 1ex; } - ul.breadcrumb li { - display: inline; } - ul.breadcrumb li.subsequent:before { - content: " >> "; } - -table { - width: 100%; } - table th, table td { - padding: .5ex; - font-size: 90%; } - table th { - font-weight: bold; - background-color: #cccccc; } - table td { - background-color: #eeeeee; } - -table.states tr { - border-bottom: 1px solid #bbbbbb; } -table.states th, table.states td { - vertical-align: top; } - -.radio-group { - font-size: 90%; - margin-bottom: 1em; - background-color: #cccccc; } - .radio-group label { - font-weight: bold; } - -.radio-group-details { - font-weight: normal; - display: block; - padding-left: 1em; - background-color: #eeeeee; - padding: 1ex; } - -input[type='radio'] { - margin-top: 1ex; - margin-left: 1ex; - margin-bottom: 1ex; } - -#state_graph { - display: block; - margin-bottom: 2em; - text-align: center; } diff --git a/server/libexec/public/stylesheets/sass/application.sass b/server/libexec/public/stylesheets/sass/application.sass deleted file mode 100644 index a36bd48..0000000 --- a/server/libexec/public/stylesheets/sass/application.sass +++ /dev/null @@ -1,109 +0,0 @@ -!main_bg = #ffffff - -!th_bg = #cccccc -!td_bg = #eeeeee - -html - :background-color = !main_bg - -body - :font-family "Trebuchet MS" - a - :color = #411 - -#hd - :padding 1em - :background-image url('/images/topbar-bg.png') - :margin-bottom 2em - img - :margin-bottom 1em - -#bd - :margin-bottom 2em - -#ft - -#bd - h1 - :font-size 160% - :margin-bottom 1ex - h2 - :font-size 140% - :margin-bottom 1ex - h3 - :font-size 120% - :margin-bottom 1ex - dl - :font-size 90% - :margin-bottom 1em - di - :display block - :margin-bottom 1em - dt, dd - :padding .5ex - dt - :font-weight bold - :background-color = !th_bg - dd - :padding-left 1em - :background-color = !td_bg - ul - li - :list-style-type square - :margin-left 1em - - em - :font-style italic - - -ul.breadcrumb - :background-color #eee - :border 1px solid #46A - :padding 1ex - li - :display inline - - &.subsequent:before - content: " >> " - -table - :width 100% - th, td - :padding .5ex - :font-size 90% - th - :font-weight bold - :background-color = !th_bg - td - :background-color = !td_bg - -table.states - tr - :border-bottom = 1px solid !th_bg - #111 - th, td - :vertical-align top - -.radio-group - :font-size 90% - :margin-bottom 1em - :background-color = !th_bg - label - :font-weight bold - -.radio-group-details - :font-weight normal - :display block - :padding-left 1em - :background-color = !td_bg - :padding 1ex - -input[type='radio'] - :margin-top 1ex - :margin-left 1ex - :margin-bottom 1ex - -#state_graph - :display block - :margin-bottom 2em - :text-align center - diff --git a/server/public/stylesheets/application.sass b/server/public/stylesheets/application.sass new file mode 100644 index 0000000..a36bd48 --- /dev/null +++ b/server/public/stylesheets/application.sass @@ -0,0 +1,109 @@ +!main_bg = #ffffff + +!th_bg = #cccccc +!td_bg = #eeeeee + +html + :background-color = !main_bg + +body + :font-family "Trebuchet MS" + a + :color = #411 + +#hd + :padding 1em + :background-image url('/images/topbar-bg.png') + :margin-bottom 2em + img + :margin-bottom 1em + +#bd + :margin-bottom 2em + +#ft + +#bd + h1 + :font-size 160% + :margin-bottom 1ex + h2 + :font-size 140% + :margin-bottom 1ex + h3 + :font-size 120% + :margin-bottom 1ex + dl + :font-size 90% + :margin-bottom 1em + di + :display block + :margin-bottom 1em + dt, dd + :padding .5ex + dt + :font-weight bold + :background-color = !th_bg + dd + :padding-left 1em + :background-color = !td_bg + ul + li + :list-style-type square + :margin-left 1em + + em + :font-style italic + + +ul.breadcrumb + :background-color #eee + :border 1px solid #46A + :padding 1ex + li + :display inline + + &.subsequent:before + content: " >> " + +table + :width 100% + th, td + :padding .5ex + :font-size 90% + th + :font-weight bold + :background-color = !th_bg + td + :background-color = !td_bg + +table.states + tr + :border-bottom = 1px solid !th_bg - #111 + th, td + :vertical-align top + +.radio-group + :font-size 90% + :margin-bottom 1em + :background-color = !th_bg + label + :font-weight bold + +.radio-group-details + :font-weight normal + :display block + :padding-left 1em + :background-color = !td_bg + :padding 1ex + +input[type='radio'] + :margin-top 1ex + :margin-left 1ex + :margin-bottom 1ex + +#state_graph + :display block + :margin-bottom 2em + :text-align center + diff --git a/server/server.rb b/server/server.rb index 5ccf9f6..8222f42 100644 --- a/server/server.rb +++ b/server/server.rb @@ -1,14 +1,31 @@ +# +# Copyright (C) 2009,2010 Red Hat, Inc. +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + require 'sinatra' -require 'deltacloud' -require 'drivers' +require 'haml' require 'json' +require 'deltacloud' require 'sinatra/respond_to' require 'sinatra/static_assets' require 'sinatra/rabbit' require 'sinatra/lazy_auth' -require 'erb' -require 'haml' require 'open3' +require 'erb' require 'lib/deltacloud/helpers/blob_stream' configure do -- 1.7.3.2