kondate 0.1.9 → 0.2.0

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: 871ab4c152c327b20f7cd8161060130dd43a53ac
4
- data.tar.gz: a81682d8ddab3188fa65e3a34b168b9b158af25b
3
+ metadata.gz: 16397f33b1c4373641e5a0cd9dc855fb2aa29803
4
+ data.tar.gz: 6f0f05354451bce1d3d59c973b5ae7ff99a537f2
5
5
  SHA512:
6
- metadata.gz: 09ba01a58f0d283e190a53f6464a71fd4aebb2292f868478406fe87e0621622435d211f97cf278e9d9ddfd9f3a4780f3cba0c39623047e42049c9cca80f4222c
7
- data.tar.gz: d868fd6d2978fee238b35e90bc7d829251aa3df6eba1aff809881b98a722ab9c4d9f80fefe9513ba4d301e7409aecac4422f7c99a7909ea73f871a8ba3456b05
6
+ metadata.gz: 370cef7d73fee3a12081a9448a426f4db51ad1af124bd9b83fe0d6dd8a06375c74c8051a30935b177eb7359635e21a3950cfc56214d5c93447382bf156cf25cd
7
+ data.tar.gz: 19f965b54c0d19f54b2302af0fe6b6957ec499c976aa5b5bc673ea948a374107b18e3abb64ad6bf9162b00843e0f801a67df4c5de363259f9417a48dc0443433
@@ -1,3 +1,9 @@
1
+ # 0.2.0 (2016-04-05)
2
+
3
+ Enhancments:
4
+
5
+ * Support arbitrary hostinfo by HostPlugin
6
+
1
7
  # 0.1.9 (2015-12-11)
2
8
 
3
9
  Enhancments:
data/README.md CHANGED
@@ -280,7 +280,9 @@ plugin_dir: lib
280
280
 
281
281
  ### Interface
282
282
 
283
- What you have to implement are `#initialize`, `#get_environment`, and `#get_roles` methods. Here is an example of file plugin:
283
+ What you have to implement are `#initialize`, `#get_environment`, and `#get_roles` methods.
284
+ `get_hostinfo` method is an optional method to return arbitrary hostinfo of the host (available from kondate 0.2.0).
285
+ Here is an example of file plugin:
284
286
 
285
287
  ```ruby
286
288
  require 'yaml'
@@ -310,6 +312,14 @@ module Kondate
310
312
  def get_roles(host)
311
313
  YAML.load_file(@path)[host]
312
314
  end
315
+
316
+ # Optional
317
+ #
318
+ # @param [String] host hostname
319
+ # @return [Hash] arbitrary hostinfo
320
+ def get_hostinfo(host)
321
+ {}
322
+ end
313
323
  end
314
324
  end
315
325
  end
@@ -19,6 +19,12 @@ module Kondate
19
19
  def get_roles(host)
20
20
  raise NotImplementedError
21
21
  end
22
+
23
+ # @param [String] host hostname
24
+ # @return [Hash] arbitrary host information
25
+ # def get_hostinfo(host)
26
+ # raise NotImplementedError
27
+ # end
22
28
  end
23
29
  end
24
30
  end
@@ -29,6 +29,20 @@ module Kondate
29
29
  end
30
30
  end
31
31
 
32
+ def hostinfo
33
+ @hostinfo ||=
34
+ begin
35
+ if Config.host_plugin.respond_to?(:get_hostinfo)
36
+ Config.host_plugin.get_hostinfo(@host) || {}
37
+ else
38
+ {}
39
+ end
40
+ rescue => e
41
+ $stderr.puts "cannot get hostinfo for host:#{@host}, #{e.class} #{e.message}"
42
+ {}
43
+ end
44
+ end
45
+
32
46
  def filter_roles(filters)
33
47
  return self.roles if filters.nil? or filters.empty?
34
48
  filters = Array(filters).map {|filter| filter.gsub(':', '-') }
@@ -102,6 +116,7 @@ module Kondate
102
116
  'environment' => environment,
103
117
  'role' => role,
104
118
  'roles' => roles,
119
+ 'hostinfo' => hostinfo,
105
120
  }).
106
121
  deep_merge!(environment_property).
107
122
  deep_merge!(secret_environment_property).
@@ -1,3 +1,3 @@
1
1
  module Kondate
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kondate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sonots
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-11 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: itamae
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  requirements: []
185
185
  rubyforge_project:
186
- rubygems_version: 2.4.5
186
+ rubygems_version: 2.5.1
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: Kondate is yet another nodes management framework for Itamae/Serverspec.