puppetdb_query 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/puppetdb_query/sync.rb +0 -2
- data/lib/puppetdb_query/updater.rb +10 -5
- data/lib/puppetdb_query/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a5b1ad53ece3f1e0cdbbfeb3cb0f73cf2146f39
|
4
|
+
data.tar.gz: c6bf6b738648819a82de72ba51456f3bee19e3c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b1f053c70c6f7b06e933b750c69abaccac71d78828e84530f6cdfbeb8680cc2c3f8d144e1db2453c4357d3deeae25d61fe5bb542f6cfecdf1f722e875f9f86b
|
7
|
+
data.tar.gz: ccdbf761cd99a8890daa6a7c4f8fe7e453c9bcc21b7825ed8035336e9052c2c5a6c79ef436ce11fc330e2148f530331b37ce0f5f068cee0b84be64859e97c9bb
|
data/lib/puppetdb_query/sync.rb
CHANGED
@@ -7,10 +7,12 @@ module PuppetDBQuery
|
|
7
7
|
|
8
8
|
attr_reader :source
|
9
9
|
attr_reader :destination
|
10
|
+
attr_reader :source_node_properties
|
10
11
|
|
11
12
|
def initialize(source, destination)
|
12
13
|
@source = source
|
13
14
|
@destination = destination
|
15
|
+
@source_node_properties = {}
|
14
16
|
end
|
15
17
|
|
16
18
|
# update by deleting missing nodes and iterating over all nodes and
|
@@ -18,9 +20,10 @@ module PuppetDBQuery
|
|
18
20
|
#
|
19
21
|
# mongo: 1598 nodes in 63.46 seconds
|
20
22
|
def update1
|
23
|
+
update_node_properties
|
21
24
|
logger.info "update1 started (full update)"
|
22
25
|
tsb = Time.now
|
23
|
-
source_nodes =
|
26
|
+
source_nodes = source_node_properties.keys
|
24
27
|
destination_nodes = destination.nodes
|
25
28
|
delete_missing(destination_nodes, source_nodes)
|
26
29
|
errors = false
|
@@ -42,9 +45,10 @@ module PuppetDBQuery
|
|
42
45
|
#
|
43
46
|
# mongo: 1597 nodes in 35.31 seconds
|
44
47
|
def update2
|
48
|
+
update_node_properties
|
45
49
|
logger.info "update2 started (full update)"
|
46
50
|
tsb = Time.now
|
47
|
-
source_nodes =
|
51
|
+
source_nodes = source_node_properties.keys
|
48
52
|
destination_nodes = destination.nodes
|
49
53
|
delete_missing(destination_nodes, source_nodes)
|
50
54
|
errors = false
|
@@ -67,9 +71,10 @@ module PuppetDBQuery
|
|
67
71
|
#
|
68
72
|
# mongo: 56 nodes in 2.62 seconds
|
69
73
|
def update3(last_update_timestamp)
|
74
|
+
update_node_properties
|
70
75
|
logger.info "update3 started (incremental)"
|
71
76
|
tsb = Time.now
|
72
|
-
source_nodes =
|
77
|
+
source_nodes = source_node_properties.keys
|
73
78
|
destination_nodes = destination.nodes
|
74
79
|
delete_missing(destination_nodes, source_nodes)
|
75
80
|
errors = false
|
@@ -93,10 +98,10 @@ module PuppetDBQuery
|
|
93
98
|
def update_node_properties
|
94
99
|
logger.info "update_node_properties started"
|
95
100
|
tsb = Time.now
|
96
|
-
source_node_properties = source.node_properties
|
101
|
+
@source_node_properties = source.node_properties
|
97
102
|
destination.node_properties_update(source_node_properties)
|
98
103
|
tse = Time.now
|
99
|
-
logger.info "update_node_properties
|
104
|
+
logger.info "update_node_properties got #{source_node_properties.size} nodes " \
|
100
105
|
"in #{tse - tsb}"
|
101
106
|
destination.meta_node_properties_update(tsb, tse)
|
102
107
|
end
|