stack-kicker 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -241,6 +241,11 @@ In addition to the the ruby dependencies which gem will install for you, access
241
241
  5. Support for AWS EC2 (from aws-kicker)
242
242
  5. Support for DNS Updates on instance creation (from aws-kicker)
243
243
 
244
+ ## Releasing
245
+
246
+ 1. gem bump
247
+ 2. gem release
248
+
244
249
  ## Contributing
245
250
 
246
251
  1. Fork it
data/bin/stack-kicker CHANGED
@@ -28,7 +28,7 @@ class App
28
28
  include Methadone::CLILogging
29
29
 
30
30
  main do |task|
31
- debug { "#{options}" }
31
+ debug { "options = #{options}" }
32
32
  # pass the logger.level into the Stack module
33
33
  Stack.log_level(logger.level)
34
34
 
@@ -36,6 +36,9 @@ class App
36
36
  config = Stack.select_stack(options[:stackfile], options['stack'])
37
37
  end
38
38
 
39
+ # pass some command line options into the config
40
+ config['skip-secgroup-sync-deletes'] = options['skip-secgroup-sync-deletes'].nil? ? false : true
41
+
39
42
  case task
40
43
  when 'validate'
41
44
  Stack.validate(config)
@@ -74,6 +77,7 @@ class App
74
77
  on("--stackfile Stackfile", "Specify an alternative Stackfile")
75
78
  on("--stack mystack", "Specify the stack in Stackfile that you want to work with")
76
79
  on("--ssh-user USER", "User to be used for SSH access")
80
+ on("--skip-secgroup-sync-deletes", "Skip deletes during secgroup-sync, handy for running multiple stacks in the one account with overlapping group names")
77
81
 
78
82
  arg :task, "task to be performed validate|configure-knife|show-stacks|show-stack|show-running|build|replace|delete|secgroup-sync|ssh"
79
83
  version Stack::Kicker::VERSION
@@ -1,5 +1,5 @@
1
1
  module Stack
2
2
  module Kicker
3
- VERSION = "0.0.15"
3
+ VERSION = "0.0.16"
4
4
  end
5
5
  end
data/lib/stack.rb CHANGED
@@ -201,7 +201,7 @@ module Stack
201
201
  Logger.warn "#{config[:key_pair]} isn't available, uploading the key"
202
202
 
203
203
  # upload the key
204
- key = os.create_keypair({:name=> config[:key_pair], :public_key=> File.read(config[:key_public])})
204
+ key = os.create_keypair({:name=> config[:key_pair], :public_key=> File.read(File.expand_path(config[:key_public]))})
205
205
  Logger.warn "#{config[:key_pair]} fingerprint=#{key[:fingerprint]}"
206
206
  else
207
207
  Logger.info "#{config[:key_pair]} fingerprint=#{keypairs[config[:key_pair].to_sym][:fingerprint]}"
@@ -215,7 +215,7 @@ module Stack
215
215
  sg_names = security_groups.map { |secgroup, secgroup_details| secgroup_details[:name] }
216
216
 
217
217
  config[:roles].each do |role, role_details|
218
- # is does the secgroup exist?
218
+ # does the secgroup exist?
219
219
  if sg_names.include?(role_details[:security_group])
220
220
  Logger.info "security group #{role_details[:security_group]} exists in #{az}"
221
221
  else
@@ -575,6 +575,8 @@ cookbook_path [ '<%=config[:stackhome]%>/cookbooks' ]
575
575
  end
576
576
 
577
577
  def Stack.delete_all(config)
578
+ # check that we have OS_* vars loaded etc
579
+ Stack.syntax_check(config)
578
580
  # this also populates out unspecified defaults, like az
579
581
  Stack.populate_config(config)
580
582
 
@@ -648,12 +650,16 @@ cookbook_path [ '<%=config[:stackhome]%>/cookbooks' ]
648
650
  sg_json.write(secgroup_ips.to_json)
649
651
  sg_json.close
650
652
 
651
- if File.exists?('secgroups.json')
653
+ # should we skip deletes
654
+ skip_deletes = config['skip-secgroup-sync-deletes'] ? "--skip-deletes" : ""
655
+
656
+ secgroups_json_abs = Stack.find_file(config, "secgroups.json")
657
+ if File.exists?(secgroups_json_abs)
652
658
  Logger.info "Found secgroups.json, syncing secgroups across AZ"
653
659
  # run the secgroup-sync tool, across each AZ/REGION
654
660
  config[:azs].each do |az|
655
661
  Logger.info "Syncing security groups in #{az}"
656
- system("stackhelper --os-region-name #{az} secgroup-sync --secgroup-json secgroups.json --additional-group-json #{sg_json.path}")
662
+ system("stackhelper --os-region-name #{az} secgroup-sync #{skip_deletes} --secgroup-json #{secgroups_json_abs} --additional-group-json #{sg_json.path}")
657
663
  end
658
664
  else
659
665
  Logger.info "No secgroups.json found, skipping secgroup sync"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack-kicker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
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: 2013-05-23 00:00:00.000000000 Z
12
+ date: 2013-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc