jnewland-capsize 0.5.1 → 0.5.2

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.
@@ -1,3 +1,15 @@
1
+ == 2008/08/24 (0.5.2)
2
+
3
+ * Fix bug in create_keypair so that setup task works again (Ches Martin)
4
+ * Support availability zone specification in run_instance (Ches Martin)
5
+
6
+ == 2008/07/13 (0.5.1)
7
+
8
+ * Support for Elastic IP addresses (Brendan Schwartz)
9
+ * Project home now on GitHub: http://github.com/jnewland/capsize
10
+
11
+ == In the year that followed, dragons ate Hitler. History books were rewritten.
12
+
1
13
  == 2007/06/13
2
14
 
3
15
  * Re-branded Capsize 'Capsize' with 'Capazon' no more...
@@ -15,4 +27,4 @@
15
27
  == 2007/03/27
16
28
 
17
29
  * Initial Release
18
- * Provides Capistrano tasks wrapping the Amazon EC2 API
30
+ * Provides Capistrano tasks wrapping the Amazon EC2 API
@@ -1,7 +1,7 @@
1
1
  History.txt
2
2
  License.txt
3
3
  Manifest.txt
4
- README.txt
4
+ README.textile
5
5
  Rakefile
6
6
  config/hoe.rb
7
7
  config/requirements.rb
@@ -32,8 +32,8 @@ require 'capsize'
32
32
  </code>
33
33
  </pre>
34
34
 
35
- * Run @cap deploy:setup@
36
- * Paste the generated config into @config/deploy.rb@
35
+ * Run @cap ec2:setup@
36
+ * Read the task's output for example usage.
37
37
 
38
38
  h2. Tasks
39
39
 
@@ -35,7 +35,7 @@ VERS = Capsize::VERSION::STRING + (REV ? ".#{REV}" : "")
35
35
  RDOC_OPTS = ['--quiet', '--title', 'capsize documentation',
36
36
  "--opname", "index.html",
37
37
  "--line-numbers",
38
- "--main", "README.txt",
38
+ "--main", "README.textile",
39
39
  "--inline-source"]
40
40
 
41
41
  class Hoe
@@ -60,11 +60,11 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
60
60
  # == Optional
61
61
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
62
62
  #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
63
- p.extra_deps = [['capistrano', '>= 2.1.0'], ['amazon-ec2', '>= 0.2.6'], ['rcov', '>= 0.8.1.2.0'], ['SQS', '>= 0.1.5'], ['builder', '>= 2.1.2'], ['RedCloth', '>= 3.0.4']]
63
+ p.extra_deps = [['capistrano', '>= 2.1.0'], ['amazon-ec2', '>= 0.2.14'], ['rcov', '>= 0.8.1.2.0'], ['SQS', '>= 0.1.5'], ['builder', '>= 2.1.2'], ['RedCloth', '>= 3.0.4']]
64
64
 
65
65
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
66
66
  p.spec_extras = {
67
- :extra_rdoc_files => ["README.txt", "History.txt"],
67
+ :extra_rdoc_files => ["README.textile", "History.txt"],
68
68
  :rdoc_options => RDOC_OPTS,
69
69
  :autorequire => "capsize"
70
70
  }
@@ -30,8 +30,9 @@ common: &common
30
30
  # SECURITY GROUP CONFIG
31
31
  ##########################################################
32
32
  # Set the default security group to apply firewall ingress rules to.
33
- # Defaults, appropriately, to 'default' security group.
34
- #group_name: 'default'
33
+ # Defaults to a group named from the 'application' Cap variable, and
34
+ # such a group is created by 'cap ec2:setup' by default as well.
35
+ #group_name: 'my_app'
35
36
 
36
37
  # Set the default security group ip protocol to apply firewall ingress rules to.
37
38
  # Defaults, appropriately, to 'tcp'.
@@ -55,7 +55,7 @@ module Capsize
55
55
  when :group_description
56
56
  # the :group_description should fall back to the application name if not provided.
57
57
  if fetch(:group_description, nil).nil?
58
- set symbol, fetch(:application)
58
+ set symbol, "Security group for the #{fetch(:application)} application."
59
59
  end
60
60
  end
61
61
 
@@ -22,7 +22,7 @@ Capistrano::Configuration.instance.load do
22
22
 
23
23
  # defaults for new security groups
24
24
  set :group_name, nil
25
- set :group_description, "Default security group for the application."
25
+ set :group_description, nil
26
26
 
27
27
  set :ip_protocol, 'tcp'
28
28
  set :from_port, nil
@@ -40,5 +40,6 @@ Capistrano::Configuration.instance.load do
40
40
  # set :queue_name, "#{application}"
41
41
  set :user_data, nil
42
42
  set :addressing_type, 'public'
43
+ set :availability_zone, nil
43
44
 
44
45
  end
@@ -103,12 +103,7 @@ module Capsize
103
103
 
104
104
  key_file = get_key_file(:key_name => options[:key_name], :key_dir => options[:key_dir])
105
105
 
106
- # Verify keypair doesn't already exist on EC2 servers...
107
- unless amazon.describe_keypairs(:key_name => options[:key_name]).keySet.nil?
108
- raise Exception, "Sorry, a keypair with the name \"#{options[:key_name]}\" already exists on EC2."
109
- end
110
-
111
- # and doesn't exist locally either...
106
+ # Verify local private key file doesn't already exist...
112
107
  file_exists_message = <<-MESSAGE
113
108
  \n
114
109
  Warning! A keypair with the name \"#{key_file}\"
@@ -118,8 +113,16 @@ module Capsize
118
113
  MESSAGE
119
114
  raise Exception, file_exists_message if File.exists?(key_file)
120
115
 
121
- #All is good, so we create the new keypair
122
- private_key = amazon.create_keypair(:key_name => options[:key_name])
116
+ # Try to create the new keypair
117
+ begin
118
+ private_key = amazon.create_keypair(:key_name => options[:key_name])
119
+ rescue EC2::InvalidKeyPairDuplicate
120
+ # keypair already exists with this :key_name
121
+ # Re-raising will provide a useful message, so we don't need to
122
+ raise
123
+ rescue EC2::InvalidKeyPairNotFound
124
+ # this is a new keypair, continue
125
+ end
123
126
 
124
127
  # write private key to file
125
128
  File.open(key_file, 'w') do |file|
@@ -208,7 +211,8 @@ module Capsize
208
211
  :group_name => nil,
209
212
  :user_data => get(:user_data),
210
213
  :addressing_type => get(:addressing_type),
211
- :instance_type => get(:instance_type)
214
+ :instance_type => get(:instance_type),
215
+ :availability_zone => get(:availability_zone)
212
216
  }.merge(options)
213
217
 
214
218
  # What security group should we run as?
@@ -12,9 +12,10 @@ Capistrano::Configuration.instance.load do
12
12
  - Create :capsize_secure_config_dir
13
13
  - Copy capsize.yml.template to :capsize_config_dir/capsize.yml unless it already exists
14
14
  - Automatically generate :capsize_secure_config_dir/secure.yml unless it already exists
15
- - Instruct user to test configuration with "cap ec2:images:describe"
16
- - Instruct user how to create a new keypair
17
- - Instruct user how to setup a new security group.
15
+ - Automatically test authentication configuration with "cap ec2:setup:check"
16
+ - Automatically create a new keypair named by :key_name, or default to :application
17
+ - Automatically create a new security group named by :group_name, or default to :application
18
+ - Add ingress rules for this security group permitting global access on ports 22, 80 and 443
18
19
  DESC
19
20
  task :default do
20
21
 
@@ -28,7 +29,7 @@ Capistrano::Configuration.instance.load do
28
29
  FileUtils.mkdir fetch(:capsize_secure_config_dir)
29
30
  end
30
31
 
31
- # copy the standard config file template, unless the dest file alread exists
32
+ # copy the standard config file template, unless the dest file already exists
32
33
  unless File.exists?("#{fetch(:capsize_secure_config_dir)}/#{fetch(:capsize_secure_config_file_name)}")
33
34
  puts "Please enter your EC2 account information."
34
35
  puts "We'll then write it to a config file at #{fetch(:capsize_secure_config_dir)}/#{fetch(:capsize_secure_config_file_name)}"
@@ -117,7 +118,7 @@ EOF
117
118
  are likely most important).
118
119
 
119
120
  Now lets connect to it with SSH (this may take a few tries, sometimes it takes a
120
- minute for the new instance to respond to SSH):
121
+ few minutes for the new instance to respond to SSH):
121
122
 
122
123
  cap ec2:instances:ssh INSTANCE_ID='i-xxxxxx'
123
124
 
@@ -149,8 +150,8 @@ EOF
149
150
 
150
151
  end
151
152
 
152
- end
153
+ end # end namespace :setup
153
154
 
154
- end
155
+ end # end namespace :ec2
155
156
 
156
157
  end
@@ -2,7 +2,7 @@ module Capsize #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- TINY = 0
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jnewland-capsize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Newland