Skip to content

Commit

Permalink
Merge branch 'atmos' into services-r6
Browse files Browse the repository at this point in the history
Conflicts:
	base/lib/base/gateway.rb

Change-Id: I54d3f2b7f83590f48ee9ff3a55ea0437f315b131
  • Loading branch information
figo committed Nov 13, 2011
2 parents ff646df + 0270662 commit de4073e
Show file tree
Hide file tree
Showing 60 changed files with 1,021 additions and 1 deletion.
22 changes: 22 additions & 0 deletions atmos/Gemfile
@@ -0,0 +1,22 @@
source :rubygems

gem "eventmachine"
gem "em-http-request"
gem "ruby-hmac"
gem "uuidtools"
gem "datamapper", ">= 0.10.2"
gem "do_sqlite3"
gem "dm-sqlite-adapter"
gem "sinatra"
gem "thin"
gem "xml-simple"

gem 'vcap_common', :path => '../../common'
gem 'vcap_logging', '>=0.1.3', :require => ['vcap/logging']

group :test do
gem "rake"
gem "rspec"
gem "rcov"
gem "ci_reporter"
end
129 changes: 129 additions & 0 deletions atmos/Gemfile.lock
@@ -0,0 +1,129 @@
PATH
remote: ../../common
specs:
vcap_common (0.99)
eventmachine (~> 0.12.10)
logging (>= 1.5.0)
nats
posix-spawn
thin
yajl-ruby

GEM
remote: http://rubygems.org/
specs:
addressable (2.2.4)
bcrypt-ruby (2.1.4)
builder (3.0.0)
ci_reporter (1.6.4)
builder (>= 2.1.2)
daemons (1.1.2)
data_objects (0.10.3)
addressable (~> 2.1)
datamapper (1.1.0)
dm-aggregates (= 1.1.0)
dm-constraints (= 1.1.0)
dm-core (= 1.1.0)
dm-migrations (= 1.1.0)
dm-serializer (= 1.1.0)
dm-timestamps (= 1.1.0)
dm-transactions (= 1.1.0)
dm-types (= 1.1.0)
dm-validations (= 1.1.0)
diff-lcs (1.1.2)
dm-aggregates (1.1.0)
dm-core (~> 1.1.0)
dm-constraints (1.1.0)
dm-core (~> 1.1.0)
dm-core (1.1.0)
addressable (~> 2.2.4)
dm-do-adapter (1.1.0)
data_objects (~> 0.10.2)
dm-core (~> 1.1.0)
dm-migrations (1.1.0)
dm-core (~> 1.1.0)
dm-serializer (1.1.0)
dm-core (~> 1.1.0)
fastercsv (~> 1.5.4)
json (~> 1.4.6)
dm-sqlite-adapter (1.1.0)
dm-do-adapter (~> 1.1.0)
do_sqlite3 (~> 0.10.2)
dm-timestamps (1.1.0)
dm-core (~> 1.1.0)
dm-transactions (1.1.0)
dm-core (~> 1.1.0)
dm-types (1.1.0)
bcrypt-ruby (~> 2.1.4)
dm-core (~> 1.1.0)
fastercsv (~> 1.5.4)
json (~> 1.4.6)
stringex (~> 1.2.0)
uuidtools (~> 2.1.2)
dm-validations (1.1.0)
dm-core (~> 1.1.0)
do_sqlite3 (0.10.3)
data_objects (= 0.10.3)
em-http-request (0.3.0)
addressable (>= 2.0.0)
escape_utils
eventmachine (>= 0.12.9)
escape_utils (0.2.3)
eventmachine (0.12.10)
fastercsv (1.5.4)
json (1.4.6)
json_pure (1.5.1)
little-plugger (1.1.2)
logging (1.5.0)
little-plugger (>= 1.1.2)
nats (0.4.10)
daemons (>= 1.1.0)
eventmachine (>= 0.12.10)
json_pure (>= 1.5.1)
posix-spawn (0.3.6)
rack (1.2.2)
rake (0.8.7)
rcov (0.9.9)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
rspec-mocks (~> 2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
ruby-hmac (0.4.0)
sinatra (1.2.1)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
stringex (1.2.1)
thin (1.2.11)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
tilt (1.2.2)
uuidtools (2.1.2)
vcap_logging (0.1.3)
xml-simple (1.0.15)
yajl-ruby (0.8.3)

PLATFORMS
ruby

DEPENDENCIES
ci_reporter
datamapper (>= 0.10.2)
dm-sqlite-adapter
do_sqlite3
em-http-request
eventmachine
rake
rcov
rspec
ruby-hmac
sinatra
thin
uuidtools
vcap_common!
vcap_logging (>= 0.1.3)
xml-simple
39 changes: 39 additions & 0 deletions atmos/Rakefile
@@ -0,0 +1,39 @@
require 'rake'

desc "Run specs"
task "spec" => ["bundler:install:test", "test:spec"]

desc "Run specs using RCov"
task "spec:rcov" => ["bundler:install:test", "test:spec:rcov"]

namespace "bundler" do
desc "Install gems"
task "install" do
sh("bundle install")
end

desc "Install gems for test"
task "install:test" do
sh("bundle install --without development production")
end

desc "Install gems for production"
task "install:production" do
sh("bundle install --without development test")
end

desc "Install gems for development"
task "install:development" do
sh("bundle install --without test production")
end
end

namespace "test" do
task "spec" do |t|
sh("cd spec && ../../base/bin/nats-util start && rake spec && ../../base/bin/nats-util stop")
end

task "spec:rcov" do |t|
sh("cd spec && rake spec:rcov")
end
end
32 changes: 32 additions & 0 deletions atmos/bin/atmos_gateway
@@ -0,0 +1,32 @@
#!/usr/bin/env ruby
# -*- mode: ruby -*-
#
# Copyright (c) 2009-2011 VMware, Inc.

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'base', 'lib')
require 'base/gateway'

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'atmos_service/provisioner'
require 'atmos_service/atmos_helper'

class VCAP::Services::Atmos::Gateway < VCAP::Services::Base::Gateway

def provisioner_class
VCAP::Services::Atmos::Provisioner
end

def default_config_file
File.join(File.dirname(__FILE__), '..', 'config', 'atmos_gateway.yml')
end

def additional_options
{:atmos => @config[:atmos]}
end
end

VCAP::Services::Atmos::Gateway.new.start


29 changes: 29 additions & 0 deletions atmos/config/atmos_gateway.yml
@@ -0,0 +1,29 @@
---
#cloud_controller_uri: api.vcap.me
service:
name: atmos
version: "1.4"
description: 'Atmos object store'
plans: ['free']
tags: ['atmos', 'atmos-1.4', 'object store']
ip_route: localhost
#proxy:
# host: proxy
# port: 8080
# keepalive: true
index: 0
token: "0xdeadbeef"
mbus: nats://localhost:4222
logging:
level: debug
pid: /var/vcap/sys/run/atmos_service.pid

# atmos configuration
# Not configured by default as it would require revealing
# credentials to a non-local resource.
atmos:
host: "127.0.0.1"
port: "443"
tenant: "tenant"
tenantadmin: "admin"
tenantpasswd: "password"
17 changes: 17 additions & 0 deletions atmos/lib/atmos_service/atmos_error.rb
@@ -0,0 +1,17 @@
# Copyright (c) 2009-2011 VMware, Inc.
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'base', 'lib')

require "base/service_error"

module VCAP
module Services
module Atmos
class AtmosError < VCAP::Services::Base::Error::ServiceError
ATMOS_BACKEND_ERROR_CREATE_SUBTENAT = [31801, HTTP_INTERNAL, 'Atmos create subtenant error. Atmos error code: %s.']
ATMOS_BACKEND_ERROR_DELETE_SUBTENAT = [31802, HTTP_INTERNAL, 'Atmos delete subtenant error. Atmos error code: %s.']
ATMOS_BACKEND_ERROR_CREATE_USER = [31803, HTTP_INTERNAL, 'Atmos create user error. Atmos error code: %s.']
ATMOS_BACKEND_ERROR_DELETE_USER = [31804, HTTP_INTERNAL, 'Atmos delete user error. Atmos error code: %s.']
end
end
end
end

0 comments on commit de4073e

Please sign in to comment.