cloudster 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +12 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +0 -9
- data/README.md +32 -15
- data/VERSION +1 -1
- data/cloudster.gemspec +6 -5
- data/lib/cloudster.rb +2 -0
- data/lib/cloudster/chef_client.rb +126 -0
- data/lib/cloudster/deep_merge.rb +10 -0
- data/lib/cloudster/ec2.rb +2 -1
- data/lib/cloudster/options_manager.rb +1 -1
- data/spec/chef_client_spec.rb +84 -0
- data/spec/cloud_spec.rb +6 -6
- metadata +7 -19
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,14 +2,6 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
builder (3.1.4)
|
5
|
-
columnize (0.3.6)
|
6
|
-
debugger (1.2.0)
|
7
|
-
columnize (>= 0.3.1)
|
8
|
-
debugger-linecache (~> 1.1.1)
|
9
|
-
debugger-ruby_core_source (~> 1.1.3)
|
10
|
-
debugger-linecache (1.1.2)
|
11
|
-
debugger-ruby_core_source (>= 1.1.1)
|
12
|
-
debugger-ruby_core_source (1.1.3)
|
13
5
|
diff-lcs (1.1.3)
|
14
6
|
excon (0.14.2)
|
15
7
|
fog (1.4.0)
|
@@ -54,7 +46,6 @@ PLATFORMS
|
|
54
46
|
|
55
47
|
DEPENDENCIES
|
56
48
|
bundler
|
57
|
-
debugger
|
58
49
|
fog
|
59
50
|
jeweler (~> 1.8.4)
|
60
51
|
json
|
data/README.md
CHANGED
@@ -3,58 +3,74 @@
|
|
3
3
|
Cloudster exposes simple helper methods to provision your AWS cloud.
|
4
4
|
Cloudster uses the AWS APIs to provision stacks on Amazon Cloud.
|
5
5
|
|
6
|
-
|
7
|
-
- This gem is under active development. Currently supports only a basic EC2 resource .
|
8
|
-
|
9
6
|
##Installation
|
10
7
|
|
11
8
|
gem install cloudster
|
12
9
|
|
13
10
|
## Usage
|
14
11
|
|
15
|
-
Create AWS
|
12
|
+
Create AWS resources as shown here:
|
16
13
|
|
17
14
|
app_server = Cloudster::Ec2.new(:name => 'AppServer',
|
18
15
|
:key_name => 'mykey',
|
19
16
|
:image_id => 'ami_image_id',
|
20
17
|
:instance_type => 't1.micro'
|
21
18
|
)
|
19
|
+
|
20
|
+
chef_client = Cloudster::ChefClient.new(
|
21
|
+
:validation_key => 'asd3e33880889098asdnmnnasd8900890a8sdmasdjna9s880808asdnmnasd90-a',
|
22
|
+
:server_url => 'http://10.50.60.70:4000',
|
23
|
+
:node_name => 'project.environment.appserver_1'
|
24
|
+
)
|
25
|
+
|
26
|
+
chef_client.add_to(app_server)
|
27
|
+
|
22
28
|
app_server_2 = Cloudster::Ec2.new(:name => 'AppServer2',
|
23
29
|
:key_name => 'mykey',
|
24
30
|
:image_id => 'ami_image_id'
|
25
31
|
)
|
32
|
+
|
33
|
+
#Add your app servers to the ElasticLoadBalancer
|
26
34
|
load_balancer = Cloudster::Elb.new(:name => 'LoadBalancer',
|
27
35
|
:instance_names => ['AppServer', 'AppServer2']
|
28
36
|
)
|
29
37
|
|
30
|
-
|
38
|
+
database = Cloudster::Rds.new(
|
39
|
+
:name => 'MySqlDB',
|
40
|
+
:instance_class => 'db.t1.micro',
|
41
|
+
:storage_class => '100',
|
42
|
+
:username => 'admin',
|
43
|
+
:password => 'admin123',
|
44
|
+
:engine => 'MySQL'
|
45
|
+
)
|
31
46
|
|
32
|
-
|
33
|
-
|
34
|
-
|
47
|
+
Make a cloud :
|
48
|
+
|
49
|
+
cloud = Cloudster::Cloud.new(:access_key_id => 'accesskeyid', :secret_access_key => 'topsecretaccesskey')
|
35
50
|
|
36
51
|
- Get the CloudFormation template for a resource in Ruby Hash :
|
37
52
|
|
38
53
|
app_server.template
|
39
54
|
- Get the CloudFormation template for the stack :
|
40
55
|
|
41
|
-
|
56
|
+
cloud.template(:resources => [app_server, app_server_2, load_balancer, database], :description => 'Description of the stack')
|
42
57
|
|
43
58
|
- Provision the stack :
|
44
59
|
|
45
|
-
|
60
|
+
cloud.provision(:resources => [app_server, app_server_2, load_balancer, database], :stack_name => 'TestStack', :description => 'Description of the stack')
|
46
61
|
|
47
62
|
- Update the stack :
|
48
63
|
|
49
|
-
|
64
|
+
cloud.update(:resources => [app_server, app_server_2], :stack_name => 'TestStack', :description => 'Description of the stack')
|
65
|
+
|
66
|
+
- Delete the stack and it's attached resources :
|
50
67
|
|
51
|
-
|
68
|
+
cloud.delete(:stack_name => 'TestStack')
|
52
69
|
|
53
|
-
|
70
|
+
- Describe the events of a stack using :
|
54
71
|
|
55
|
-
|
72
|
+
cloud.events(:stack_name => 'TestStack')
|
56
73
|
|
57
|
-
stack.delete(:stack_name => 'TestStack')
|
58
74
|
|
59
75
|
|
60
76
|
##License
|
@@ -62,3 +78,4 @@ Now you can do stuff like :
|
|
62
78
|
MIT
|
63
79
|
|
64
80
|
*Free Software, Forever . YEAH !*
|
81
|
+
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/eafd00c3c74c7362ed850f6a50120c30 "githalytics.com")](http://githalytics.com/emilsoman/cloudster)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.0
|
data/cloudster.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "cloudster"
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Emil Soman"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-11-09"
|
13
13
|
s.description = "Cloudster uses the AWS APIs to provision stacks on Amazon Cloud."
|
14
14
|
s.email = "emil.soman@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".rspec",
|
22
|
+
".travis.yml",
|
22
23
|
"Gemfile",
|
23
24
|
"Gemfile.lock",
|
24
25
|
"LICENSE.txt",
|
@@ -27,11 +28,14 @@ Gem::Specification.new do |s|
|
|
27
28
|
"VERSION",
|
28
29
|
"cloudster.gemspec",
|
29
30
|
"lib/cloudster.rb",
|
31
|
+
"lib/cloudster/chef_client.rb",
|
30
32
|
"lib/cloudster/cloud.rb",
|
33
|
+
"lib/cloudster/deep_merge.rb",
|
31
34
|
"lib/cloudster/ec2.rb",
|
32
35
|
"lib/cloudster/elb.rb",
|
33
36
|
"lib/cloudster/options_manager.rb",
|
34
37
|
"lib/cloudster/rds.rb",
|
38
|
+
"spec/chef_client_spec.rb",
|
35
39
|
"spec/cloud_spec.rb",
|
36
40
|
"spec/ec2_spec.rb",
|
37
41
|
"spec/elb_spec.rb",
|
@@ -54,7 +58,6 @@ Gem::Specification.new do |s|
|
|
54
58
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
55
59
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
56
60
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
57
|
-
s.add_development_dependency(%q<debugger>, [">= 0"])
|
58
61
|
else
|
59
62
|
s.add_dependency(%q<fog>, [">= 0"])
|
60
63
|
s.add_dependency(%q<json>, [">= 0"])
|
@@ -62,7 +65,6 @@ Gem::Specification.new do |s|
|
|
62
65
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
63
66
|
s.add_dependency(%q<bundler>, [">= 0"])
|
64
67
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
65
|
-
s.add_dependency(%q<debugger>, [">= 0"])
|
66
68
|
end
|
67
69
|
else
|
68
70
|
s.add_dependency(%q<fog>, [">= 0"])
|
@@ -71,7 +73,6 @@ Gem::Specification.new do |s|
|
|
71
73
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
72
74
|
s.add_dependency(%q<bundler>, [">= 0"])
|
73
75
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
74
|
-
s.add_dependency(%q<debugger>, [">= 0"])
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
data/lib/cloudster.rb
CHANGED
@@ -3,8 +3,10 @@
|
|
3
3
|
require 'json'
|
4
4
|
require 'fog'
|
5
5
|
require 'cloudster/options_manager'
|
6
|
+
require 'cloudster/deep_merge'
|
6
7
|
include OptionsManager
|
7
8
|
require 'cloudster/ec2'
|
8
9
|
require 'cloudster/elb'
|
9
10
|
require 'cloudster/rds'
|
10
11
|
require 'cloudster/cloud'
|
12
|
+
require 'cloudster/chef_client'
|
@@ -0,0 +1,126 @@
|
|
1
|
+
module Cloudster
|
2
|
+
#==UserData for Chef Client bootstrap
|
3
|
+
class ChefClient
|
4
|
+
|
5
|
+
# Initialize an ChefClient configuration
|
6
|
+
#
|
7
|
+
# ==== Notes
|
8
|
+
# options parameter must include values for :instance_name, :validation_key, :server_url and :node_name
|
9
|
+
#
|
10
|
+
# ==== Examples
|
11
|
+
# chef_client = Cloudster::ChefClient.new(
|
12
|
+
# :instance_name => 'AppServer',
|
13
|
+
# :validation_key => 'asd3e33880889098asdnmnnasd8900890a8sdmasdjna9s880808asdnmnasd90-a',
|
14
|
+
# :server_url => 'http://10.50.60.70:4000',
|
15
|
+
# :node_name => 'project.environment.appserver_1'
|
16
|
+
# )
|
17
|
+
#
|
18
|
+
# ==== Parameters
|
19
|
+
# * options<~Hash> -
|
20
|
+
# * :instance_name: String containing the name of EC2 element on which chef-client is to be bootstrapped. Mandatory field
|
21
|
+
# * :validation_key: String containing the key used for validating this client with the server. This can be taken from the chef-server validation.pem file. Mandatory field
|
22
|
+
# * :server_url: String containing the fully qualified domain name of the chef-server. Mandatory field
|
23
|
+
# * :node_name: String containing the name for the chef node. It has to be unique across all nodes in the particular chef client-server ecosystem. Mandatory field
|
24
|
+
def initialize(options = {})
|
25
|
+
require_options(options, [:validation_key, :server_url, :node_name])
|
26
|
+
@validation_key = options[:validation_key]
|
27
|
+
@server_url = options[:server_url]
|
28
|
+
@node_name = options[:node_name]
|
29
|
+
end
|
30
|
+
|
31
|
+
# Merges the required CloudFormation template for installing the Chef Client to the template of the EC2 instance
|
32
|
+
#
|
33
|
+
#
|
34
|
+
# ==== Examples
|
35
|
+
# chef_client = Cloudster::ChefClient.new(
|
36
|
+
# :instance_name => 'AppServer',
|
37
|
+
# :validation_key => 'asd3e33880889098asdnmnnasd8900890a8sdmasdjna9s880808asdnmnasd90-a',
|
38
|
+
# :server_url => 'http://10.50.60.70:4000',
|
39
|
+
# :node_name => 'project.environment.appserver_1'
|
40
|
+
# )
|
41
|
+
# ec2 = Cloudster::Ec2.new(
|
42
|
+
# :name => 'AppServer',
|
43
|
+
# :key_name => 'mykey',
|
44
|
+
# :image_id => 'ami_image_id',
|
45
|
+
# :instance_type => 't1.micro'
|
46
|
+
# )
|
47
|
+
#
|
48
|
+
# chef_client.add_to ec2
|
49
|
+
#
|
50
|
+
# ==== Parameters
|
51
|
+
# * instance of EC2
|
52
|
+
def add_to(ec2)
|
53
|
+
ec2_template = ec2.template
|
54
|
+
@instance_name = ec2.name
|
55
|
+
chef_client_template = template
|
56
|
+
ec2.template.deep_merge(chef_client_template)
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def template
|
62
|
+
return "Resources" => {
|
63
|
+
@instance_name => {
|
64
|
+
"Metadata" => {
|
65
|
+
"AWS::CloudFormation::Init" => {
|
66
|
+
"config" => {
|
67
|
+
"packages" => {
|
68
|
+
"rubygems" => {
|
69
|
+
"chef" => [],
|
70
|
+
"ohai" => []
|
71
|
+
},
|
72
|
+
"apt" => {
|
73
|
+
"ruby" => [],
|
74
|
+
"ruby-dev" => [],
|
75
|
+
"libopenssl-ruby" => [],
|
76
|
+
"rdoc" => [],
|
77
|
+
"ri" => [],
|
78
|
+
"irb" => [],
|
79
|
+
"build-essential" => [],
|
80
|
+
"wget" => [],
|
81
|
+
"ssl-cert" => [],
|
82
|
+
"rubygems" => []
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
},
|
88
|
+
"Properties"=> {
|
89
|
+
"UserData" => { "Fn::Base64" => { "Fn::Join" => ["", [
|
90
|
+
"#!/bin/bash -v\n",
|
91
|
+
"function error_exit\n",
|
92
|
+
"{\n",
|
93
|
+
" exit 1\n",
|
94
|
+
"}\n",
|
95
|
+
|
96
|
+
"mkdir /etc/chef\n",
|
97
|
+
"cat << EOF > /etc/chef/solo.rb\n",
|
98
|
+
"file_cache_path \"/tmp/chef-solo\"\n",
|
99
|
+
"cookbook_path \"/tmp/chef-solo/cookbooks\"\n",
|
100
|
+
"EOF\n",
|
101
|
+
"cat << EOF > /etc/chef/chef.json\n",
|
102
|
+
"{\n",
|
103
|
+
"\"chef_server\": {\n",
|
104
|
+
" \"server_url\": \"http://localhost:4000\",\n",
|
105
|
+
" \"webui_enabled\": true,\n",
|
106
|
+
" \"node_name\": \"#{@node_name}\"\n",
|
107
|
+
"},\n",
|
108
|
+
"\"run_list\": [\"recipe[chef-client::config]\", \"recipe[chef-client]\"]\n",
|
109
|
+
"}\n",
|
110
|
+
"EOF\n",
|
111
|
+
|
112
|
+
"# Bootstrap chef\n",
|
113
|
+
"chef-solo -c /etc/chef/solo.rb -j /etc/chef/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz > /tmp/chef_solo.log 2>&1 || error_exit 'Failed to bootstrap chef client'\n",
|
114
|
+
|
115
|
+
"# Fixup the server URL in client.rb\n",
|
116
|
+
"echo \"#{@validation_key}\" > /etc/chef/validation.pem 2>&1 || error_exit 'Failed to get Chef Server validation key'\n",
|
117
|
+
"sed -i 's|http://localhost:4000|", @server_url , "|g' /etc/chef/client.rb\n",
|
118
|
+
"chef-client -i 20 > /tmp/chef_client.log 2>&1 || error_exit 'Failed to initialize host via chef client' \n"
|
119
|
+
]]}}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
data/lib/cloudster/ec2.rb
CHANGED
@@ -2,6 +2,7 @@ module Cloudster
|
|
2
2
|
#==Ec2 resource
|
3
3
|
class Ec2
|
4
4
|
|
5
|
+
attr_accessor :template, :name
|
5
6
|
# Initialize an Ec2 instance
|
6
7
|
#
|
7
8
|
# ==== Notes
|
@@ -43,7 +44,7 @@ module Cloudster
|
|
43
44
|
# ==== Returns
|
44
45
|
# * Ruby hash version of the Cloud Formation template for the resource instance
|
45
46
|
def template
|
46
|
-
Ec2.template({:name =>@name, :key_name => @key_name, :image_id => @image_id, :instance_type => @instance_type})
|
47
|
+
@template ||= Ec2.template({:name =>@name, :key_name => @key_name, :image_id => @image_id, :instance_type => @instance_type})
|
47
48
|
end
|
48
49
|
|
49
50
|
# Class method that returns a Ruby hash version of the Cloud Formation template
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Cloudster::ChefClient do
|
4
|
+
describe 'initialize' do
|
5
|
+
it "should raise argument error if no argument is not provided" do
|
6
|
+
expect { Cloudster::ChefClient.new() }.to raise_error(ArgumentError, 'Missing required argument: validation_key,server_url,node_name')
|
7
|
+
end
|
8
|
+
it "should not raise argument error if all arguments are provided" do
|
9
|
+
expect { Cloudster::ChefClient.new(:validation_key => 'somekey', :server_url => 'testurl', :node_name => 'uniquename') }.to_not raise_error
|
10
|
+
end
|
11
|
+
end
|
12
|
+
describe '#add_to' do
|
13
|
+
it "should add chef client configuration to ec2 template" do
|
14
|
+
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', :name => 'AppServer', :instance_type => 't1.micro' )
|
15
|
+
chef_client = Cloudster::ChefClient.new(:validation_key => 'somekey', :server_url => 'testurl', :node_name => 'uniquename')
|
16
|
+
chef_client.add_to ec2
|
17
|
+
ec2.template.should ==
|
18
|
+
{
|
19
|
+
"Resources"=>{
|
20
|
+
"AppServer"=>{
|
21
|
+
"Type"=>"AWS::EC2::Instance",
|
22
|
+
"Properties"=>{
|
23
|
+
"KeyName"=>"testkey",
|
24
|
+
"ImageId"=>"image_id",
|
25
|
+
"InstanceType"=>"t1.micro",
|
26
|
+
"UserData"=>{
|
27
|
+
"Fn::Base64"=>{
|
28
|
+
"Fn::Join"=>["", [
|
29
|
+
"#!/bin/bash -v\n",
|
30
|
+
"function error_exit\n",
|
31
|
+
"{\n", " exit 1\n", "}\n",
|
32
|
+
"mkdir /etc/chef\n",
|
33
|
+
"cat << EOF > /etc/chef/solo.rb\n",
|
34
|
+
"file_cache_path \"/tmp/chef-solo\"\n",
|
35
|
+
"cookbook_path \"/tmp/chef-solo/cookbooks\"\n",
|
36
|
+
"EOF\n", "cat << EOF > /etc/chef/chef.json\n",
|
37
|
+
"{\n", "\"chef_server\": {\n",
|
38
|
+
" \"server_url\": \"http://localhost:4000\",\n",
|
39
|
+
" \"webui_enabled\": true,\n",
|
40
|
+
" \"node_name\": \"uniquename\"\n",
|
41
|
+
"},\n",
|
42
|
+
"\"run_list\": [\"recipe[chef-client::config]\", \"recipe[chef-client]\"]\n",
|
43
|
+
"}\n",
|
44
|
+
"EOF\n",
|
45
|
+
"# Bootstrap chef\n",
|
46
|
+
"chef-solo -c /etc/chef/solo.rb -j /etc/chef/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz > /tmp/chef_solo.log 2>&1 || error_exit 'Failed to bootstrap chef client'\n",
|
47
|
+
"# Fixup the server URL in client.rb\n",
|
48
|
+
"echo \"somekey\" > /etc/chef/validation.pem 2>&1 || error_exit 'Failed to get Chef Server validation key'\n",
|
49
|
+
"sed -i 's|http://localhost:4000|", "testurl", "|g' /etc/chef/client.rb\n",
|
50
|
+
"chef-client -i 20 > /tmp/chef_client.log 2>&1 || error_exit 'Failed to initialize host via chef client' \n"
|
51
|
+
]]
|
52
|
+
}
|
53
|
+
}
|
54
|
+
},
|
55
|
+
"Metadata"=>{
|
56
|
+
"AWS::CloudFormation::Init"=>{
|
57
|
+
"config"=>{
|
58
|
+
"packages"=>{
|
59
|
+
"rubygems"=>{
|
60
|
+
"chef"=>[],
|
61
|
+
"ohai"=>[]
|
62
|
+
},
|
63
|
+
"apt"=>{
|
64
|
+
"ruby"=>[],
|
65
|
+
"ruby-dev"=>[],
|
66
|
+
"libopenssl-ruby"=>[],
|
67
|
+
"rdoc"=>[],
|
68
|
+
"ri"=>[],
|
69
|
+
"irb"=>[],
|
70
|
+
"build-essential"=>[],
|
71
|
+
"wget"=>[],
|
72
|
+
"ssl-cert"=>[],
|
73
|
+
"rubygems"=>[]
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/spec/cloud_spec.rb
CHANGED
@@ -11,8 +11,8 @@ describe Cloudster::Cloud do
|
|
11
11
|
end
|
12
12
|
describe '#template' do
|
13
13
|
it "should return a ruby hash for the stack cloudformation template" do
|
14
|
-
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', name
|
15
|
-
ec2_1 = Cloudster::Ec2.new(:key_name => 'testkey1', :image_id => 'image_id1', name
|
14
|
+
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', :name => 'name')
|
15
|
+
ec2_1 = Cloudster::Ec2.new(:key_name => 'testkey1', :image_id => 'image_id1', :name => 'name1')
|
16
16
|
rds = Cloudster::Rds.new(:name => 'MySqlDB', :storage_size => '10')
|
17
17
|
elb = Cloudster::Elb.new(:name => 'ELB', :instance_names => ['name','name1'])
|
18
18
|
cloud = Cloudster::Cloud.new(:access_key_id => 'test', :secret_access_key => 'test')
|
@@ -70,14 +70,14 @@ describe Cloudster::Cloud do
|
|
70
70
|
|
71
71
|
describe '#provision' do
|
72
72
|
it "should raise argument error if resources not provided" do
|
73
|
-
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', name
|
73
|
+
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', :name => 'name')
|
74
74
|
cloud = Cloudster::Cloud.new(:access_key_id => 'test', :secret_access_key => 'test')
|
75
75
|
expect { cloud.provision(:description => 'test') }.to raise_error(ArgumentError, 'Missing required argument: resources,stack_name' )
|
76
76
|
end
|
77
77
|
it "should trigger stack creation" do
|
78
78
|
cloud_formation = double('CloudFormation')
|
79
79
|
Fog::AWS::CloudFormation.should_receive(:new).with(:aws_access_key_id => 'test', :aws_secret_access_key => 'test').and_return cloud_formation
|
80
|
-
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', name
|
80
|
+
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', :name => 'name')
|
81
81
|
elb = Cloudster::Elb.new(:name => 'ELB', :instance_names => ['name','name1'])
|
82
82
|
rds = Cloudster::Rds.new(:name => 'MySqlDB', :storage_size => '10')
|
83
83
|
cloud = Cloudster::Cloud.new(:access_key_id => 'test', :secret_access_key => 'test')
|
@@ -88,14 +88,14 @@ describe Cloudster::Cloud do
|
|
88
88
|
|
89
89
|
describe '#update' do
|
90
90
|
it "should raise argument error if resources not provided" do
|
91
|
-
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', name
|
91
|
+
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', :name => 'name')
|
92
92
|
cloud = Cloudster::Cloud.new(:access_key_id => 'test', :secret_access_key => 'test')
|
93
93
|
expect { cloud.update(:description => 'test') }.to raise_error(ArgumentError, 'Missing required argument: resources,stack_name' )
|
94
94
|
end
|
95
95
|
it "should trigger stack update" do
|
96
96
|
cloud_formation = double('CloudFormation')
|
97
97
|
Fog::AWS::CloudFormation.should_receive(:new).with(:aws_access_key_id => 'test', :aws_secret_access_key => 'test').and_return cloud_formation
|
98
|
-
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', name
|
98
|
+
ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', :name => 'name')
|
99
99
|
cloud = Cloudster::Cloud.new(:access_key_id => 'test', :secret_access_key => 'test')
|
100
100
|
cloud_formation.should_receive('update_stack').with('stack_name', 'TemplateBody' => cloud.template(:resources => [ec2], :description => 'testDescription'))
|
101
101
|
cloud.update(:resources => [ec2], :stack_name => 'stack_name', :description => 'testDescription')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -107,22 +107,6 @@ dependencies:
|
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 1.8.4
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: debugger
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
110
|
description: Cloudster uses the AWS APIs to provision stacks on Amazon Cloud.
|
127
111
|
email: emil.soman@gmail.com
|
128
112
|
executables: []
|
@@ -133,6 +117,7 @@ extra_rdoc_files:
|
|
133
117
|
files:
|
134
118
|
- .document
|
135
119
|
- .rspec
|
120
|
+
- .travis.yml
|
136
121
|
- Gemfile
|
137
122
|
- Gemfile.lock
|
138
123
|
- LICENSE.txt
|
@@ -141,11 +126,14 @@ files:
|
|
141
126
|
- VERSION
|
142
127
|
- cloudster.gemspec
|
143
128
|
- lib/cloudster.rb
|
129
|
+
- lib/cloudster/chef_client.rb
|
144
130
|
- lib/cloudster/cloud.rb
|
131
|
+
- lib/cloudster/deep_merge.rb
|
145
132
|
- lib/cloudster/ec2.rb
|
146
133
|
- lib/cloudster/elb.rb
|
147
134
|
- lib/cloudster/options_manager.rb
|
148
135
|
- lib/cloudster/rds.rb
|
136
|
+
- spec/chef_client_spec.rb
|
149
137
|
- spec/cloud_spec.rb
|
150
138
|
- spec/ec2_spec.rb
|
151
139
|
- spec/elb_spec.rb
|
@@ -166,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
154
|
version: '0'
|
167
155
|
segments:
|
168
156
|
- 0
|
169
|
-
hash: -
|
157
|
+
hash: -233709777
|
170
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
159
|
none: false
|
172
160
|
requirements:
|