kitchen_hooks 1.7.0 → 1.7.1

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: 57e367c61cc0d252a78fa6a7a934347f702b59bd
4
- data.tar.gz: e3c96ae9eb5a51e064f968d564c7f90772ffd57e
3
+ metadata.gz: c55fcb4b71fbb2010f6d46b256f2d84b4953dd9c
4
+ data.tar.gz: 3efdac0901f9b235e3c237dff23e52e99fae879f
5
5
  SHA512:
6
- metadata.gz: 0448e0bd79eddca8a029766ee64bfb6ce9767795492be28e13a91925c06b59ad1bfbe387d43f13097ffc4ddf6e01d06500db95e34124dd4c641a6222ebc7ab08
7
- data.tar.gz: 37295349df30512542481063ddc17cf69a3c7fb0a171ddf7dcbe5bf664336fd1b72e4fe7420a5082fea59458b51e41dc071c1b9325a79efd17f0901116d85224
6
+ metadata.gz: 6648b4f9e50981912b9d0199bf09d45ec9d970b125131832a0534dda5c70c8e5e5d002f13c5459adf4d0f3e966e6a933641f8d7f8b73018419fcf142217fc7fe
7
+ data.tar.gz: 9186ae05a8d2d515b3a6ba1a1e89268bbdd3650507fa736ef0b6968c5aab3c00f3a75529974cefd2adfe95c6c351fdf501ff5ba40605d9bb777ec826bdd46235
data/Readme.md CHANGED
@@ -119,6 +119,10 @@ The `server` command also exposes some options for Sinatra configuration. See
119
119
 
120
120
  ### Changelog
121
121
 
122
+ ### 1.7
123
+
124
+ * Sync nodes between Chef servers
125
+
122
126
  ### 1.6
123
127
 
124
128
  * First public release
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 1.7.1
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.add_runtime_dependency 'daybreak', '~> 0.3'
18
18
  s.add_runtime_dependency 'retryable', '~> 2'
19
19
  s.add_runtime_dependency 'berkshelf', '~> 3'
20
- s.add_runtime_dependency 'chef', '~> 12.0.0'
20
+ s.add_runtime_dependency 'chef', '< 12'
21
21
  s.add_runtime_dependency 'thor', '~> 0'
22
22
  s.add_runtime_dependency 'git', '~> 1.2'
23
23
  s.add_runtime_dependency 'sinatra', '~> 1.4'
@@ -8,10 +8,10 @@ class SyncServers
8
8
 
9
9
 
10
10
  def initialize knives
11
- @knives = knives
11
+ @knives = knives
12
12
  @started = Time.now
13
- @status = sync_servers.merge \
14
- elapsed: Time.now - @started
13
+ @status = sync_servers.merge \
14
+ elapsed: Time.now - @started rescue nil
15
15
  end
16
16
 
17
17
 
@@ -24,14 +24,22 @@ private
24
24
  end
25
25
 
26
26
  def all_nodes
27
+ @clients ||= {}
27
28
  @all_nodes ||= ridleys.flat_map do |ridley|
28
- ridley.partial_search(:node, '*:*', %w[ ohai_time ])
29
+ clients = ridley.client.all
30
+ nodes = ridley.partial_search(:node, '*:*', %w[ ohai_time ])
31
+
32
+ nodes.each do |n|
33
+ c = clients.select { |c| c.name == n.name }.shift
34
+ @clients[n.name] = c unless c.nil?
35
+ end
36
+
37
+ nodes
29
38
  end
30
39
  end
31
40
 
32
-
33
41
  def merged_nodes
34
- @merged_nodes ||= all_nodes.group_by(&:name).pmap do |name, copies|
42
+ @merged_nodes ||= all_nodes.group_by(&:name).pmap do |_, copies|
35
43
  copies.sort_by { |c| c.automatic.ohai_time }.last
36
44
  end
37
45
  end
@@ -41,13 +49,21 @@ private
41
49
  nodes = merged_nodes
42
50
  failures = Set.new
43
51
 
44
- nodes.peach(8) do |n|
52
+ nodes.peach(16) do |n|
45
53
  n.reload
54
+
46
55
  ridleys.peach(4) do |ridley|
47
56
  ridley.node.create(n) \
48
57
  rescue ridley.node.update(n) \
49
58
  rescue failures << n.name
59
+
60
+ c = @clients[n.name]
61
+ next if c.nil?
62
+ ridley.client.create(c) \
63
+ rescue ridley.client.update(c) \
64
+ rescue puts('WARNING: Client sync failed for node "%s"' % n.name)
50
65
  end
66
+
51
67
  puts 'Synced node "%s"' % n.name
52
68
  end
53
69
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen_hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2015-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hipchat
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: chef
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - "<"
74
74
  - !ruby/object:Gem::Version
75
- version: 12.0.0
75
+ version: '12'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - "<"
81
81
  - !ruby/object:Gem::Version
82
- version: 12.0.0
82
+ version: '12'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: thor
85
85
  requirement: !ruby/object:Gem::Requirement