stack-kicker 0.0.16 → 0.0.18

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.
data/README.md CHANGED
@@ -28,6 +28,12 @@ So hostnames will be myapp-az1-chef0001, myapp-az1-web0001, myapp-az1-web0002 et
28
28
 
29
29
  post-install scripts are executed from the same host as stack-kicker is being used, using the same credentials as the current user. They are can be used to retrieve information from a freshly built node (like certificates from a chef server), so block progress until the chef-client run has completed (we use this to block percona/galera & rabbitmq cluster builds so that the first node is up & running correctly before we try and add another node to the cluster)
30
30
 
31
+ ### [Global Attributes](id:Global_attributes)
32
+ TODO
33
+ #### :find_file_paths
34
+ An optional array that extends were the find_file fucntion searches for files (find file defaults to ., Stackhome & the gem lib (for shipped templates), the elements of find_file_paths are
35
+ appended to Stackhome
36
+
31
37
  ### [Role Attributes](id:role_attributes)
32
38
  Roles have several attributes, which control how & how many nodes are created, and how they are created. Below shows the default values for these attributes, which can all be overridden.
33
39
 
data/bin/stack-kicker CHANGED
@@ -54,6 +54,8 @@ class App
54
54
  Stack.deploy_all(config)
55
55
  when 'delete'
56
56
  Stack.delete_all(config)
57
+ when 'secgroup-sync'
58
+ Stack.secgroup_sync(config)
57
59
  else
58
60
  error "Sorry, #{task} hasn't been implemented yet"
59
61
  end
@@ -1,5 +1,5 @@
1
1
  module Stack
2
2
  module Kicker
3
- VERSION = "0.0.16"
3
+ VERSION = "0.0.18"
4
4
  end
5
5
  end
data/lib/stack.rb CHANGED
@@ -342,6 +342,13 @@ cookbook_path [ '<%=config[:stackhome]%>/cookbooks' ]
342
342
  config[:site_template] = 'UNKNOWN'
343
343
  end
344
344
 
345
+ if config[:metadata].nil?
346
+ config[:metadata] = Hash.new
347
+ end
348
+
349
+ if config[:find_file_paths].nil?
350
+ config[:find_file_paths] = Array.new
351
+ end
345
352
 
346
353
  if config[:node_details].nil?
347
354
  Logger.debug { "Initializing config[:node_details] and config[:azs]" }
@@ -779,8 +786,22 @@ cookbook_path [ '<%=config[:stackhome]%>/cookbooks' ]
779
786
 
780
787
  Logger.info "Creating #{hostname} in #{node_details[hostname][:az]} with role #{role}"
781
788
 
782
- # this will get put in /meta.js
783
- metadata = { 'region' => node_details[hostname][:az], 'chef_role' => role }
789
+ # this will get put in /meta.js - should look like this:
790
+ # {"region": "az-2.region-a.geo-1", "area": "aw2", "az": "az2", "continent": "dev"}
791
+ metadata = {
792
+ 'region' => node_details[hostname][:az],
793
+ 'continent' => 'unknown', # we could infer this from the region, or default to 'dev'
794
+ 'area' => 'unknown', # we could infer this from the region-a/region-b
795
+ 'az' => node_details[hostname][:az].split('.')[0].sub(/-/, ''),
796
+ 'chef_role' => role
797
+ }
798
+
799
+ Logger.debug "Generated metadata: #{metadata}"
800
+ Logger.debug "Supplied metadata: #{config[:metadata]}"
801
+ # merge with the supplied data, which will override our generated data
802
+
803
+ metadata.merge!(config[:metadata])
804
+ Logger.info "Final metadata: #{metadata}"
784
805
 
785
806
  os = Stack.connect(config, node_details[hostname][:az])
786
807
  newserver = os.create_server(:name => hostname,
@@ -848,10 +869,13 @@ cookbook_path [ '<%=config[:stackhome]%>/cookbooks' ]
848
869
  # find a file, using the standard path precedence
849
870
  # 1) cwd
850
871
  # 2) stackhome
872
+ # 2) stackhome + find_file_paths
851
873
  # 3) gemhome/lib
852
874
  dirs = [ './' ]
853
875
  dirs.push(config[:stackhome])
854
- dirs.push(@@gemhome + '/lib')
876
+ config[:find_file_paths].each { |fp| dirs.push(File.join(config[:stackhome], fp)) }
877
+ dirs.push(File.join(@@gemhome, 'lib'))
878
+ dirs.flatten!
855
879
 
856
880
  Logger.debug "find_file, looking for #{filename} in #{dirs}"
857
881
  filename_fqp = ''
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.16
4
+ version: 0.0.18
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-24 00:00:00.000000000 Z
12
+ date: 2013-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc