kelbim 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72724c20ce7d6b2ffe1a5fe2fed4cbf8f396d837
4
- data.tar.gz: d2d5b6aa164862a296815658f253dc75e97d34db
3
+ metadata.gz: 04d4c853c7425e98afd1041b5fed2a4f89bad141
4
+ data.tar.gz: 32fd2090817185faa83916511b7bc1c476f81401
5
5
  SHA512:
6
- metadata.gz: 970a1ec948939dbaa1d3fa1505542f3db07472538c9eef488d59efbcb77a7e5214edeb3bbfad9575dbaf711c33c74e69a8c67fae3ebd742442a88bcfae39179b
7
- data.tar.gz: b4e0b65eeaaa748530b6f0b6c9e8842665c126e5acde1588b654d214e596f8e6cf59adbcbc40288970cde48c4e0f4c77246cc78c936ea073dcecc4568b1c76ee
6
+ metadata.gz: ee179bd28ca6b0021e3c23fa560014d695a27aaac2226652bfe2193e4141be922eae7b9a4da81491ba68fdd64c171374da04661e8f69f23b93bc105dec88245f
7
+ data.tar.gz: 0cd47fe00fd776bea9c602dac1de57215675fae6d72041ed201ddf32785fca0169fbe39b8674f816b6bf8be561ff5d7693f493a89347e9c95f98567d519a2229
data/README.md CHANGED
@@ -4,6 +4,7 @@ Kelbim is a tool to manage ELB.
4
4
 
5
5
  It defines the state of ELB using DSL, and updates ELB according to DSL.
6
6
 
7
+ [![Gem Version](https://badge.fury.io/rb/kelbim.png)](http://badge.fury.io/rb/kelbim)
7
8
  [![Build Status](https://drone.io/bitbucket.org/winebarrel/kelbim/status.png)](https://drone.io/bitbucket.org/winebarrel/kelbim/latest)
8
9
 
9
10
  **Notice**
@@ -137,6 +138,3 @@ Test `ELBfile`
137
138
  Finished in 3.16 seconds
138
139
  3 examples, 0 failures
139
140
  ```
140
-
141
- ## Link
142
- * [RubyGems.org site](http://rubygems.org/gems/kelbim)
data/bin/kelbim CHANGED
@@ -86,7 +86,7 @@ begin
86
86
  output_file = DEFAULT_FILENAME if output_file == '-'
87
87
  requires = []
88
88
 
89
- client.export(options[:elb_names]) do |exported, converter|
89
+ client.export(options) do |exported, converter|
90
90
  exported.each do |vpc, elbs|
91
91
  if split == :more
92
92
  elb_dir = File.join(File.dirname(output_file), "#{vpc || :classic}")
@@ -127,10 +127,10 @@ begin
127
127
  else
128
128
  if output_file == '-'
129
129
  logger.info('# Export ELB')
130
- puts client.export(options[:elb_names])
130
+ puts client.export(options)
131
131
  else
132
132
  logger.info("Export ELB to `#{output_file}`")
133
- open(output_file, 'wb') {|f| f.puts client.export(options[:elb_names]) }
133
+ open(output_file, 'wb') {|f| f.puts client.export(options) }
134
134
  end
135
135
  end
136
136
  when :apply
data/lib/kelbim/client.rb CHANGED
@@ -74,12 +74,12 @@ module Kelbim
74
74
  return retval
75
75
  end
76
76
 
77
- def export(elb_names = nil)
77
+ def export(opts = {})
78
78
  exported = nil
79
79
  instance_names = nil
80
80
 
81
81
  AWS.memoize do
82
- exported = Exporter.export(@options.elb, :elb_names => elb_names)
82
+ exported = Exporter.export(@options.elb, opts)
83
83
  instance_names = @options.ec2.instance_names
84
84
  end
85
85
 
@@ -11,14 +11,22 @@ module Kelbim
11
11
 
12
12
  def initialize(elb, options = {})
13
13
  @elb = elb
14
- @fetch_policies = options[:fetch_policies]
15
- @elb_names = options[:elb_names]
14
+ @options = options
16
15
  end
17
16
 
18
17
  def export
19
18
  result = {}
20
19
  lbs = @elb.load_balancers
21
- lbs = @elb_names.map {|i| lbs[i] } if @elb_names
20
+
21
+ ec2s = @options[:ec2s]
22
+ elb_names = @options[:elb_names]
23
+
24
+ if ec2s or elb_names
25
+ lbs = lbs.select do |lb|
26
+ (ec2s.nil? or ec2s.include?(lb.vpc_id || 'classic')) &&
27
+ (elb_names.nil? or elb_names.include?(lb.name))
28
+ end
29
+ end
22
30
 
23
31
  lbs.each do |lb|
24
32
  result[lb.vpc_id] ||= {}
@@ -39,7 +47,7 @@ module Kelbim
39
47
  :attributes => load_balancer.attributes,
40
48
  }
41
49
 
42
- if @fetch_policies and load_balancer.policies.first
50
+ if @options[:fetch_policies] and load_balancer.policies.first
43
51
  attrs[:policies] = h = {}
44
52
  load_balancer.policies.each {|i| h[i.name] = i.type }
45
53
  end
@@ -1,5 +1,5 @@
1
1
  module Kelbim
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
4
4
 
5
5
  Version = Kelbim::VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kelbim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - winebarrel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-01 00:00:00.000000000 Z
11
+ date: 2013-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
- rubygems_version: 2.1.8
184
+ rubygems_version: 2.0.14
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: Kelbim is a tool to manage ELB.