houcho 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 861b8e2a9dba584c7491cae19e5b89af5d344b3e
4
- data.tar.gz: a002ee817dac79bc4df21a13fbf13e64cea1780a
3
+ metadata.gz: b59ced5d69133f301f1a65871fcb2cd8378ceaca
4
+ data.tar.gz: 8ac6a107ea045d6353df58264fee06e99d527848
5
5
  SHA512:
6
- metadata.gz: 0b7f5057e97c73796f3bad5989ff922896954c64bddef2124e0b80c77893ea38e3dc69504a7e9779331fe945da73ca41c4cca1be6450fc661f08df5a13db609e
7
- data.tar.gz: 9baa6c039dd5caeecac4d9198e53979ab017cb9c0248470435aceaae02b23148c2c72df0c1056dc72029a78449e2c7bb3009a76579f5c25732b0e906e8b0c669
6
+ metadata.gz: fd397c0f4a66a9ad8327b83691cf2b0b77298c9611281c65835fcb9eab166fda6905c5c8de338d1b2ee10538f435c63460e1e2937011cc5740b2f39f265dc8c6
7
+ data.tar.gz: 9ea002fe75a457d41f320a9eb38d9a53fb875a0bb4b6c0c645f877e1e374a600546c685bd1db0c6fd8b64d412975e579ae7bb5a11d574b58ef2a91b7eda6ab82
@@ -11,15 +11,17 @@ class OuterRole
11
11
  class << CloudForecast
12
12
  def load
13
13
  cfdir = Houcho::Config::CFYAMLDIR
14
+ @cfrole = {}
14
15
 
15
16
  Dir::entries(cfdir).each do |file|
16
17
  next if file !~ /\.yaml$/
17
18
  yaml = "#{cfdir}/#{file}"
18
19
  group = load_group(yaml)
19
20
  cfrole = create_cf_role(yaml, group)
20
-
21
- save_outer_role(cfrole, "CloudForecast")
21
+ merge_cf_role(cfrole)
22
22
  end
23
+
24
+ save_outer_role(@cfrole, "CloudForecast")
23
25
  end
24
26
 
25
27
 
@@ -49,7 +51,7 @@ class OuterRole
49
51
  doc["servers"].each do |servers|
50
52
  label = servers["label"].gsub(/\s+/, '_') if servers["label"]
51
53
  outerrole = "#{group[i]}::#{label}::#{servers["config"].sub(/\.yaml$/, "")}"
52
- hosts = servers["hosts"].map { |host| host.split(/\s+/)[1] }
54
+ hosts = (servers["hosts"] || []).map { |host| host.split(/\s+/)[1] }
53
55
 
54
56
  cfrole[outerrole] = hosts
55
57
  end
@@ -57,6 +59,12 @@ class OuterRole
57
59
 
58
60
  cfrole
59
61
  end
62
+
63
+ def merge_cf_role(cfrole)
64
+ cfrole.each do |role, hosts|
65
+ @cfrole[role] = @cfrole[role] ? @cfrole[role].concat(hosts).uniq : hosts
66
+ end
67
+ end
60
68
  end
61
69
  end
62
70
 
@@ -1,3 +1,3 @@
1
1
  module Houcho
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: houcho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi SUZUKI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-14 00:00:00.000000000 Z
11
+ date: 2013-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor