arborist 0.4.0 → 0.5.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ChangeLog +80 -12
- data/History.md +16 -0
- data/TODO.md +2 -7
- data/lib/arborist.rb +1 -1
- data/lib/arborist/event/node.rb +10 -0
- data/lib/arborist/node.rb +58 -41
- data/lib/arborist/node/host.rb +7 -0
- data/lib/arborist/node/resource.rb +7 -0
- data/lib/arborist/node/root.rb +7 -0
- data/lib/arborist/node/service.rb +7 -0
- data/spec/arborist/node/host_spec.rb +6 -0
- data/spec/arborist/node/resource_spec.rb +4 -0
- data/spec/arborist/node/root_spec.rb +3 -0
- data/spec/arborist/node/service_spec.rb +6 -0
- data/spec/arborist/node_spec.rb +58 -5
- metadata +26 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c26cccca966e48b6453e1e9ff531d67a0aaf3f8db0b7039b5813493bad362dba
|
4
|
+
data.tar.gz: '08c9aa0a7dedd5c8ebc9b53b861ca6ac367c6f9708a2d18af32ad5858a6aef20'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce6fd29af320dead516687333728c4b2a807314566e955ef16fb098d9c2213528332691e64122bb327103e12645e993bd02a4717e272bef51b5ad6adf82ea8d8
|
7
|
+
data.tar.gz: ee8625c1284c077be2171897d62bdc6908da998c971d763c010c6c4ca087b8d94a3f264d084fa708e4cccd616ea5b6c4692fa3fcfe44bdab99c80960e4f670f6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
@@ -1,8 +1,86 @@
|
|
1
|
+
2019-01-16 Mahlon E. Smith <mahlon@martini.nu>
|
2
|
+
|
3
|
+
o * lib/arborist.rb, lib/arborist/command/cert.rb:
|
4
|
+
| initial zauth experiment
|
5
|
+
| [f8556458f0bd] [tip]
|
6
|
+
|
|
7
|
+
2019-03-13 Michael Granger <ged@FaerieMUD.org>
|
8
|
+
|
9
|
+
| @ * History.md, lib/arborist.rb:
|
10
|
+
| | Bump the minor version, update history.
|
11
|
+
| | [e9656402084f]
|
12
|
+
| |
|
13
|
+
2019-03-06 Michael Granger <ged@FaerieMUD.org>
|
14
|
+
|
15
|
+
| | o * TODO.md, lib/arborist/manager.rb, lib/arborist/node.rb,
|
16
|
+
| | | lib/arborist/node/root.rb, spec/arborist/node/root_spec.rb:
|
17
|
+
| | | Move all event dispatch into propagate_events
|
18
|
+
| | | [73886e081c0e]
|
19
|
+
| | |
|
20
|
+
2019-01-16 Michael Granger <ged@FaerieMUD.org>
|
21
|
+
|
22
|
+
| | o * lib/arborist/node.rb, lib/arborist/subscription.rb,
|
23
|
+
| | | spec/arborist/subscription_spec.rb:
|
24
|
+
| | | Make the return from Subscription#on_events consistent
|
25
|
+
| | | [c52fc8e96127]
|
26
|
+
| | |
|
27
|
+
| | o * lib/arborist/node_subscription.rb,
|
28
|
+
| | | spec/arborist/node_subscription_spec.rb:
|
29
|
+
| | | Propagate events resulting from NodeSubscription publishing
|
30
|
+
| | | [296f00916348]
|
31
|
+
| | |
|
32
|
+
2019-03-06 Michael Granger <ged@FaerieMUD.org>
|
33
|
+
|
34
|
+
| o | * lib/arborist/node.rb, spec/arborist/node_spec.rb:
|
35
|
+
| |/ Include new property keys in delta event
|
36
|
+
| | [93959adf2f65]
|
37
|
+
| |
|
38
|
+
2019-02-20 Mahlon E. Smith <mahlon@martini.nu>
|
39
|
+
|
40
|
+
| o * lib/arborist/node.rb, lib/arborist/node/host.rb,
|
41
|
+
| | lib/arborist/node/resource.rb, lib/arborist/node/root.rb,
|
42
|
+
| | lib/arborist/node/service.rb, spec/arborist/node/host_spec.rb,
|
43
|
+
| | spec/arborist/node/resource_spec.rb,
|
44
|
+
| | spec/arborist/node/root_spec.rb, spec/arborist/node/service_spec.rb,
|
45
|
+
| | spec/arborist/node_spec.rb:
|
46
|
+
| | Add "family" as a node attribute, so observable consumers can make
|
47
|
+
| | decisions about serialized nodes.
|
48
|
+
| | [88c4ac151003]
|
49
|
+
| |
|
50
|
+
2019-02-27 Mahlon E. Smith <mahlon@martini.nu>
|
51
|
+
|
52
|
+
| o * lib/arborist/node.rb:
|
53
|
+
| | Ensure errors and warnings remain structured in the delta event.
|
54
|
+
| | [83bfe5c0ec6f]
|
55
|
+
| |
|
56
|
+
2018-11-07 Michael Granger <ged@FaerieMUD.org>
|
57
|
+
|
58
|
+
| o * .hgignore, lib/arborist/event/node.rb, lib/arborist/node.rb:
|
59
|
+
| | Add more event instrumentation
|
60
|
+
| | [1c769c35064c]
|
61
|
+
| |
|
62
|
+
2018-10-19 Michael Granger <ged@FaerieMUD.org>
|
63
|
+
|
64
|
+
| o * spec/arborist/node_spec.rb:
|
65
|
+
|/ Add better coverage for node operational attribute method
|
66
|
+
| [75191095ed57]
|
67
|
+
|
|
68
|
+
2018-12-08 Mahlon E. Smith <mahlon@martini.nu>
|
69
|
+
|
70
|
+
o * TODO.md, lib/arborist/node.rb:
|
71
|
+
| Don't save/restore state for a node's status_history_size - it
|
72
|
+
| should be set from the node config (or defaulted globally.)
|
73
|
+
| [e462aa07d6bd]
|
74
|
+
|
|
75
|
+
o * lib/arborist/node.rb:
|
76
|
+
| Node#handle_event shouldn't return nil.
|
77
|
+
| [b62dfc6cf44d]
|
78
|
+
|
|
1
79
|
2018-11-21 Mahlon E. Smith <mahlon@martini.nu>
|
2
80
|
|
3
|
-
|
81
|
+
o * .hgsigs:
|
4
82
|
| Added signature for changeset b4227ca091d2
|
5
|
-
| [5f37211d2302]
|
83
|
+
| [5f37211d2302]
|
6
84
|
|
|
7
85
|
o * .hgtags:
|
8
86
|
| Added tag v0.4.0 for changeset cfafc1efb759
|
@@ -30,16 +108,6 @@ o * lib/arborist/event.rb, lib/arborist/event/node_delta.rb,
|
|
30
108
|
| Add informational node predicate to node
|
31
109
|
| [2444837aae2a]
|
32
110
|
|
|
33
|
-
| o * .hgignore, lib/arborist/event/node.rb, lib/arborist/node.rb:
|
34
|
-
|/ Add more event instrumentation
|
35
|
-
| [ab5b16539fdf]
|
36
|
-
|
|
37
|
-
2018-10-19 Michael Granger <ged@FaerieMUD.org>
|
38
|
-
|
39
|
-
| o * spec/arborist/node_spec.rb:
|
40
|
-
|/ Add better coverage for node operational attribute method
|
41
|
-
| [cd09eab560b7]
|
42
|
-
|
|
43
111
|
2018-10-17 Mahlon E. Smith <mahlon@martini.nu>
|
44
112
|
|
45
113
|
o * lib/arborist/event/node.rb, lib/arborist/node.rb,
|
data/History.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## v0.5.0 [2019-03-06] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Enhancements:
|
4
|
+
|
5
|
+
- Include new property keys in delta event
|
6
|
+
- Add "family" as a node attribute, so observable consumers can make
|
7
|
+
decisions about serialized nodes.
|
8
|
+
|
9
|
+
Fixes:
|
10
|
+
|
11
|
+
- Node#handle_event shouldn't return nil.
|
12
|
+
- Don't save/restore state for a node's status_history_size - it
|
13
|
+
should be set from the node config (or defaulted globally.)
|
14
|
+
- Ensure errors and warnings remain structured in the delta event.
|
15
|
+
|
16
|
+
|
1
17
|
## v0.4.0 [2018-11-21] Mahlon E. Smith <mahlon@martini.nu>
|
2
18
|
|
3
19
|
Enhancements:
|
data/TODO.md
CHANGED
@@ -15,26 +15,21 @@
|
|
15
15
|
|
16
16
|
* Potential federation / referral for sibling managers
|
17
17
|
* Add optional authentication support (ZAUTH)
|
18
|
+
* HTTP server/endpoint for node updates without ZMQ
|
18
19
|
|
19
20
|
|
20
21
|
### Nodes
|
21
22
|
|
22
23
|
* Allow 'address' host DSL to accept multiple addresses in one call
|
23
|
-
* Allow disabling an ACKed node (kschies)
|
24
24
|
|
25
25
|
|
26
26
|
### Observers
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
* Flapping state detection
|
31
|
-
|
28
|
+
(none)
|
32
29
|
|
33
30
|
|
34
31
|
### Monitors
|
35
32
|
|
36
|
-
* Add a one-shot runner command for development of monitors. Loads and runs a monitor one time, maybe with some output describing how often it'd run, what its skew is, etc. [will@laika]
|
37
|
-
|
38
33
|
* Add some default monitor types and utilities
|
39
34
|
- ftp
|
40
35
|
- imap
|
data/lib/arborist.rb
CHANGED
data/lib/arborist/event/node.rb
CHANGED
@@ -38,6 +38,16 @@ class Arborist::Event::Node < Arborist::Event
|
|
38
38
|
end
|
39
39
|
|
40
40
|
|
41
|
+
### Return the detail portion of the #inspect string appropriate for this event type.
|
42
|
+
def inspect_details
|
43
|
+
return "%s(%s)%s" % [
|
44
|
+
self.node.identifier,
|
45
|
+
self.node.type,
|
46
|
+
self.node.flapping? ? ' (flapping)' : '',
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
|
41
51
|
### Inject useful node metadata into the generated hash.
|
42
52
|
def to_h
|
43
53
|
return super.merge(
|
data/lib/arborist/node.rb
CHANGED
@@ -39,6 +39,7 @@ class Arborist::Node
|
|
39
39
|
# The attributes of a node which are used in the operation of the system
|
40
40
|
OPERATIONAL_ATTRIBUTES = %i[
|
41
41
|
type
|
42
|
+
family
|
42
43
|
status
|
43
44
|
tags
|
44
45
|
parent
|
@@ -444,6 +445,13 @@ class Arborist::Node
|
|
444
445
|
end
|
445
446
|
|
446
447
|
|
448
|
+
### Return the node family, so observers can know ancestry after
|
449
|
+
### serialization for custom node types that inherit from this class.
|
450
|
+
def family
|
451
|
+
return :node
|
452
|
+
end
|
453
|
+
|
454
|
+
|
447
455
|
### Set one or more node +attributes+. This should be overridden by subclasses which
|
448
456
|
### wish to allow their operational attributes to be set/updated via the Tree API
|
449
457
|
### (+modify+ and +graft+). Supported attributes are: +parent+, +description+,
|
@@ -622,8 +630,46 @@ class Arborist::Node
|
|
622
630
|
self.update_errors( monitor_key, new_properties.delete('error') )
|
623
631
|
self.update_warnings( monitor_key, new_properties.delete('warning') )
|
624
632
|
|
625
|
-
self.
|
626
|
-
|
633
|
+
self.merge_new_properties( new_properties )
|
634
|
+
end
|
635
|
+
|
636
|
+
|
637
|
+
### Merge the specified Hash of +new_properties+ with the node's current property
|
638
|
+
### Hash.
|
639
|
+
def merge_new_properties( new_properties )
|
640
|
+
props = self.properties.dup
|
641
|
+
updated_properties, properties_delta = self.merge_and_record_delta( props, new_properties )
|
642
|
+
|
643
|
+
compact_hash( updated_properties )
|
644
|
+
self.properties.replace( updated_properties )
|
645
|
+
|
646
|
+
self.update_delta['properties'] = properties_delta unless properties_delta.empty?
|
647
|
+
end
|
648
|
+
|
649
|
+
|
650
|
+
### Merge the specified +newval+ into the node's properties at the given +key+, recording
|
651
|
+
### each change in the node's #update_delta if the +oldval+ is different.
|
652
|
+
def merge_and_record_delta( properties, new_properties )
|
653
|
+
delta = {}
|
654
|
+
new_properties.each_key do |key|
|
655
|
+
newval = new_properties[ key ]
|
656
|
+
oldval = properties[ key ]
|
657
|
+
subdelta = nil
|
658
|
+
|
659
|
+
# Merge them (recursively) if they're both merge-able
|
660
|
+
if oldval.respond_to?( :merge! ) && newval.respond_to?( :merge! )
|
661
|
+
newval, subdelta = self.merge_and_record_delta( oldval, newval )
|
662
|
+
|
663
|
+
# Otherwise just directly compare them and record any changes
|
664
|
+
elsif oldval != newval
|
665
|
+
subdelta = [ oldval, newval ]
|
666
|
+
end
|
667
|
+
|
668
|
+
properties[ key ] = newval
|
669
|
+
delta[ key ] = subdelta if subdelta
|
670
|
+
end
|
671
|
+
|
672
|
+
return properties, delta
|
627
673
|
end
|
628
674
|
|
629
675
|
|
@@ -683,35 +729,6 @@ class Arborist::Node
|
|
683
729
|
end
|
684
730
|
|
685
731
|
|
686
|
-
### Merge the specified +new_properties+ into the node's properties, recording
|
687
|
-
### each change in the node's #update_delta.
|
688
|
-
def merge_and_record_delta( key, oldval, newval, prefixes=[] )
|
689
|
-
self.log.debug "Merging property %s: %p -> %p" % [
|
690
|
-
(prefixes + [key]).join('.'),
|
691
|
-
oldval,
|
692
|
-
newval
|
693
|
-
]
|
694
|
-
|
695
|
-
# Merge them (recursively) if they're both merge-able
|
696
|
-
if oldval.respond_to?( :merge! ) && newval.respond_to?( :merge! )
|
697
|
-
return oldval.merge( newval ) do |ikey, ioldval, inewval|
|
698
|
-
self.merge_and_record_delta( ikey, ioldval, inewval, prefixes + [key] )
|
699
|
-
end
|
700
|
-
|
701
|
-
# Otherwise just directly compare them and record any changes
|
702
|
-
else
|
703
|
-
unless oldval == newval
|
704
|
-
prefixed_delta = prefixes.inject( self.update_delta ) do |hash, key|
|
705
|
-
hash[ key ]
|
706
|
-
end
|
707
|
-
prefixed_delta[ key ] = [ oldval, newval ]
|
708
|
-
end
|
709
|
-
|
710
|
-
return newval
|
711
|
-
end
|
712
|
-
end
|
713
|
-
|
714
|
-
|
715
732
|
### Clear out the state used during a transition to track changes.
|
716
733
|
def clear_transition_temp_vars
|
717
734
|
self.previous_ack = nil
|
@@ -765,6 +782,8 @@ class Arborist::Node
|
|
765
782
|
array_val.include?( self.status )
|
766
783
|
when 'type'
|
767
784
|
array_val.include?( self.type )
|
785
|
+
when 'family'
|
786
|
+
array_val.include?( self.family.to_s )
|
768
787
|
when 'parent'
|
769
788
|
array_val.include?( self.parent )
|
770
789
|
when 'tag' then @tags.include?( val.to_s )
|
@@ -836,7 +855,7 @@ class Arborist::Node
|
|
836
855
|
def broadcast_events( *events )
|
837
856
|
events.flatten!
|
838
857
|
results = self.children.flat_map do |identifier, child|
|
839
|
-
self.log.debug "Broadcasting
|
858
|
+
self.log.debug "Broadcasting events to %p: %p" % [ identifier, events ]
|
840
859
|
events.flat_map do |event|
|
841
860
|
child.handle_event( event )
|
842
861
|
end
|
@@ -849,7 +868,7 @@ class Arborist::Node
|
|
849
868
|
### Handle the specified +event+, delivered either via broadcast or secondary
|
850
869
|
### dependency subscription.
|
851
870
|
def handle_event( event )
|
852
|
-
self.log.debug "Handling %p" % [ event ]
|
871
|
+
self.log.debug "Handling event %p" % [ event ]
|
853
872
|
handler_name = "handle_%s_event" % [ event.type.gsub('.', '_') ]
|
854
873
|
|
855
874
|
if self.respond_to?( handler_name )
|
@@ -860,7 +879,7 @@ class Arborist::Node
|
|
860
879
|
end
|
861
880
|
|
862
881
|
# Don't transition on informational events
|
863
|
-
return if event.informational?
|
882
|
+
return [] if event.informational?
|
864
883
|
super # to state-machine
|
865
884
|
|
866
885
|
results = self.pending_change_events.clone
|
@@ -870,7 +889,7 @@ class Arborist::Node
|
|
870
889
|
child_results = self.broadcast_events( *results )
|
871
890
|
results.concat( child_results )
|
872
891
|
|
873
|
-
self.publish_events( *results )
|
892
|
+
self.publish_events( *results ) unless results.empty?
|
874
893
|
|
875
894
|
return results
|
876
895
|
ensure
|
@@ -1106,7 +1125,6 @@ class Arborist::Node
|
|
1106
1125
|
@last_contacted = old_node.last_contacted
|
1107
1126
|
@status_changed = old_node.status_changed
|
1108
1127
|
@status_history = old_node.status_history
|
1109
|
-
@status_history_size = old_node.status_history_size
|
1110
1128
|
@flapping = old_node.flapping?
|
1111
1129
|
@errors = old_node.errors
|
1112
1130
|
@warnings = old_node.warnings
|
@@ -1128,6 +1146,7 @@ class Arborist::Node
|
|
1128
1146
|
identifier: self.identifier,
|
1129
1147
|
type: self.class.name.to_s.sub( /.+::/, '' ).downcase,
|
1130
1148
|
parent: self.parent,
|
1149
|
+
family: self.family,
|
1131
1150
|
description: self.description,
|
1132
1151
|
tags: self.tags,
|
1133
1152
|
config: self.config,
|
@@ -1138,7 +1157,6 @@ class Arborist::Node
|
|
1138
1157
|
status_changed: self.status_changed ? self.status_changed.iso8601 : nil,
|
1139
1158
|
status_last_changed: self.status_last_changed ? self.status_last_changed.iso8601 : nil,
|
1140
1159
|
status_history: self.status_history,
|
1141
|
-
status_history_size: self.status_history_size,
|
1142
1160
|
flapping: self.flapping?,
|
1143
1161
|
errors: self.errors,
|
1144
1162
|
warnings: self.warnings,
|
@@ -1182,7 +1200,6 @@ class Arborist::Node
|
|
1182
1200
|
@status_changed = Time.parse( hash[:status_changed] )
|
1183
1201
|
@status_last_changed = Time.parse( hash[:status_last_changed] )
|
1184
1202
|
@status_history = hash[:status_history]
|
1185
|
-
@status_history_size = hash[:status_history_size]
|
1186
1203
|
@flapping = hash[:flapping]
|
1187
1204
|
@ack = Arborist::Node::Ack.from_hash( hash[:ack] ) if hash[:ack]
|
1188
1205
|
|
@@ -1383,14 +1400,14 @@ class Arborist::Node
|
|
1383
1400
|
### Callback for when a node goes from up to down
|
1384
1401
|
def on_node_down( transition )
|
1385
1402
|
self.log.error "%s is %s" % [ self.identifier, self.status_description ]
|
1386
|
-
self.update_delta[ 'errors' ] = [ nil, self.
|
1403
|
+
self.update_delta[ 'errors' ] = [ nil, self.errors ]
|
1387
1404
|
end
|
1388
1405
|
|
1389
1406
|
|
1390
1407
|
### Callback for when a node goes from up to warn
|
1391
1408
|
def on_node_warn( transition )
|
1392
1409
|
self.log.error "%s is %s" % [ self.identifier, self.status_description ]
|
1393
|
-
self.update_delta[ 'warnings' ] = [ nil, self.
|
1410
|
+
self.update_delta[ 'warnings' ] = [ nil, self.warnings ]
|
1394
1411
|
end
|
1395
1412
|
|
1396
1413
|
|
@@ -1437,7 +1454,7 @@ class Arborist::Node
|
|
1437
1454
|
|
1438
1455
|
### Retain the status in the node's history.
|
1439
1456
|
###
|
1440
|
-
def record_status_history
|
1457
|
+
def record_status_history( transition )
|
1441
1458
|
retain = self.status_history_size
|
1442
1459
|
return if retain.zero?
|
1443
1460
|
|
data/lib/arborist/node/host.rb
CHANGED
@@ -54,6 +54,13 @@ class Arborist::Node::Host < Arborist::Node
|
|
54
54
|
dsl_accessor :hostname
|
55
55
|
|
56
56
|
|
57
|
+
### Return the node family, so observers can know ancestry after
|
58
|
+
### serialization for custom node types that inherit from this class.
|
59
|
+
def family
|
60
|
+
return :host
|
61
|
+
end
|
62
|
+
|
63
|
+
|
57
64
|
### Set one or more node +attributes+. Supported attributes (in addition to
|
58
65
|
### those supported by Node) are: +addresses+.
|
59
66
|
def modify( attributes )
|
@@ -24,6 +24,13 @@ class Arborist::Node::Resource < Arborist::Node
|
|
24
24
|
end
|
25
25
|
|
26
26
|
|
27
|
+
### Return the node family, so observers can know ancestry after
|
28
|
+
### serialization for custom node types that inherit from this class.
|
29
|
+
def family
|
30
|
+
return :resource
|
31
|
+
end
|
32
|
+
|
33
|
+
|
27
34
|
### Set service +attributes+.
|
28
35
|
def modify( attributes )
|
29
36
|
attributes = stringify_keys( attributes )
|
data/lib/arborist/node/root.rb
CHANGED
@@ -45,6 +45,13 @@ class Arborist::Node::Root < Arborist::Node
|
|
45
45
|
end
|
46
46
|
|
47
47
|
|
48
|
+
### Return the node family, so observers can know ancestry after
|
49
|
+
### serialization for custom node types that inherit from this class.
|
50
|
+
def family
|
51
|
+
return :root
|
52
|
+
end
|
53
|
+
|
54
|
+
|
48
55
|
### Ignore restores of serialized root nodes.
|
49
56
|
def restore( other_node )
|
50
57
|
self.log.info "Ignoring restored root node."
|
@@ -67,6 +67,13 @@ class Arborist::Node::Service < Arborist::Node
|
|
67
67
|
dsl_accessor :protocol
|
68
68
|
|
69
69
|
|
70
|
+
### Return the node family, so observers can know ancestry after
|
71
|
+
### serialization for custom node types that inherit from this class.
|
72
|
+
def family
|
73
|
+
return :service
|
74
|
+
end
|
75
|
+
|
76
|
+
|
70
77
|
### Set service +attributes+.
|
71
78
|
def modify( attributes )
|
72
79
|
attributes = stringify_keys( attributes )
|
@@ -13,6 +13,12 @@ describe Arborist::Node::Host do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
|
16
|
+
it "knows its family catagorization" do
|
17
|
+
result = described_class.new( 'testhost' )
|
18
|
+
expect( result.family ).to eq( :host )
|
19
|
+
end
|
20
|
+
|
21
|
+
|
16
22
|
it "can be created with a single IPv4 address" do
|
17
23
|
result = described_class.new( 'testhost' ) do
|
18
24
|
address '192.168.118.3'
|
@@ -43,6 +43,10 @@ describe Arborist::Node::Resource do
|
|
43
43
|
described_class.new( 'disk', host )
|
44
44
|
end
|
45
45
|
|
46
|
+
it "knows its family catagorization" do
|
47
|
+
expect( host.family ).to eq( :host )
|
48
|
+
expect( node.family ).to eq( :resource )
|
49
|
+
end
|
46
50
|
|
47
51
|
it "can be matched with one of its host's addresses" do
|
48
52
|
expect( node ).to match_criteria( address: '192.168.66.12' )
|
@@ -13,6 +13,12 @@ describe Arborist::Node::Service do
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
it "knows its family catagorization" do
|
17
|
+
result = described_class.new( 'ssh', host )
|
18
|
+
expect( host.family ).to eq( :host )
|
19
|
+
expect( result.family ).to eq( :service )
|
20
|
+
end
|
21
|
+
|
16
22
|
|
17
23
|
it "can be created without reasonable defaults based on its identifier" do
|
18
24
|
result = described_class.new( 'ssh', host )
|
data/spec/arborist/node_spec.rb
CHANGED
@@ -207,6 +207,9 @@ describe Arborist::Node do
|
|
207
207
|
expect( parent_node.children ).to include( node.identifier )
|
208
208
|
end
|
209
209
|
|
210
|
+
it "knows its family catagorization" do
|
211
|
+
expect( parent_node.family ).to eq( :node )
|
212
|
+
end
|
210
213
|
|
211
214
|
it "raises an error if a node which specifies a different parent is added to it" do
|
212
215
|
stranger_node = concrete_class.new( identifier2 ) do
|
@@ -1062,16 +1065,38 @@ describe Arborist::Node do
|
|
1062
1065
|
|
1063
1066
|
expect( delta_event.node ).to be( node )
|
1064
1067
|
expect( delta_event.payload ).to eq({
|
1065
|
-
'
|
1066
|
-
|
1067
|
-
'
|
1068
|
-
'
|
1068
|
+
'properties' => {
|
1069
|
+
'song' => ['Around the World' , 'Motherboard'],
|
1070
|
+
'sausage' => {
|
1071
|
+
'price' => {
|
1072
|
+
'currency' => ['usd', 'eur']
|
1073
|
+
}
|
1069
1074
|
}
|
1070
1075
|
}
|
1071
1076
|
})
|
1072
1077
|
end
|
1073
1078
|
|
1074
1079
|
|
1080
|
+
it "generates a node.delta event when an update adds a new property" do
|
1081
|
+
events = node.update(
|
1082
|
+
'genre' => "Sclerotic Neck-Funk",
|
1083
|
+
)
|
1084
|
+
|
1085
|
+
expect( events ).to be_an( Array )
|
1086
|
+
expect( events ).to all( be_a(Arborist::Event) )
|
1087
|
+
expect( events.size ).to eq( 2 )
|
1088
|
+
|
1089
|
+
delta_event = events.find {|ev| ev.type == 'node.delta' }
|
1090
|
+
|
1091
|
+
expect( delta_event.node ).to be( node )
|
1092
|
+
expect( delta_event.payload ).to eq({
|
1093
|
+
'properties' => {
|
1094
|
+
'genre' => [nil, 'Sclerotic Neck-Funk'],
|
1095
|
+
}
|
1096
|
+
})
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
|
1075
1100
|
it "includes status changes in delta events" do
|
1076
1101
|
events = node.update( error: "Couldn't talk to it!" )
|
1077
1102
|
delta_event = events.find {|ev| ev.type == 'node.delta' }
|
@@ -1259,6 +1284,10 @@ describe Arborist::Node do
|
|
1259
1284
|
expect( node ).to_not match_criteria( type: 'service' )
|
1260
1285
|
end
|
1261
1286
|
|
1287
|
+
it "can be matched with its family" do
|
1288
|
+
expect( node ).to match_criteria( family: 'node' )
|
1289
|
+
expect( node ).to_not match_criteria( family: 'hurrrgh' )
|
1290
|
+
end
|
1262
1291
|
|
1263
1292
|
it "can be matched with its parent" do
|
1264
1293
|
expect( node ).to match_criteria( parent: 'bar' )
|
@@ -1449,7 +1478,7 @@ describe Arborist::Node do
|
|
1449
1478
|
end
|
1450
1479
|
|
1451
1480
|
|
1452
|
-
describe "operational
|
1481
|
+
describe "operational attributes" do
|
1453
1482
|
|
1454
1483
|
let( :node ) do
|
1455
1484
|
concrete_class.new( 'foo' ) do
|
@@ -1489,6 +1518,30 @@ describe Arborist::Node do
|
|
1489
1518
|
node.modify( tags: 'single' )
|
1490
1519
|
expect( node.tags ).to eq( %w[single] )
|
1491
1520
|
end
|
1521
|
+
|
1522
|
+
|
1523
|
+
it "knows what its operational values are" do
|
1524
|
+
values = node.operational_values
|
1525
|
+
|
1526
|
+
expect( values ).to be_a( Hash )
|
1527
|
+
expect( values ).to include(
|
1528
|
+
type: node.type,
|
1529
|
+
status: node.status,
|
1530
|
+
tags: an_instance_of( Array ),
|
1531
|
+
parent: an_instance_of( String ),
|
1532
|
+
description: an_instance_of( String ),
|
1533
|
+
dependencies: an_instance_of( Arborist::Dependency ),
|
1534
|
+
status_changed: an_instance_of( Time ),
|
1535
|
+
status_last_changed: an_instance_of( Time ),
|
1536
|
+
last_contacted: an_instance_of( Time ),
|
1537
|
+
ack: nil,
|
1538
|
+
errors: an_instance_of( Hash ),
|
1539
|
+
warnings: an_instance_of( Hash ),
|
1540
|
+
quieted_reasons: an_instance_of( Hash ),
|
1541
|
+
config: an_instance_of( Hash )
|
1542
|
+
)
|
1543
|
+
end
|
1544
|
+
|
1492
1545
|
end
|
1493
1546
|
|
1494
1547
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arborist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -11,27 +11,31 @@ bindir: bin
|
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
14
|
+
MIIENDCCApygAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdtYWhs
|
15
|
+
b24vREM9bWFydGluaS9EQz1udTAeFw0xODEyMDkwMzMxNTJaFw0xOTEyMDkwMzMx
|
16
|
+
NTJaMCIxIDAeBgNVBAMMF21haGxvbi9EQz1tYXJ0aW5pL0RDPW51MIIBojANBgkq
|
17
|
+
hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA3cz7ILM8n+Y5nvz7mVRVqE8LusWdT8NX
|
18
|
+
nlnETynDndenI+a2S3j22DR+U4ooGUjuCHE3iR1CVmTDGbxFfNRfmnC1AN9Hybat
|
19
|
+
ewW+onvMBye7yfO0bJB5vkqaW5vd35rzquOffgBtJMo7rPRu6pX8RkL34Wnew4J7
|
20
|
+
POooUcYbWSAO934HSCUC8wVm6b4v/ejVF1Lk44Dz45jtMqtR7KTAtpipdbTXAarO
|
21
|
+
HQy3eVes/0oTqhk4CP50r1KP09nUHTn2lzVaCN9vmNE/Jwe0AuQ9ImvZXPpCsMMl
|
22
|
+
V03/tuJ++48sVmOIusJkASPupXcdI6zqsjYw2vLMFtuYNskRSvwbn6Wm6x9hLWWj
|
23
|
+
IRp5FvHPORLRCHFizXRmXZ3PyFHqbv6m4yG0SyfMzOXPk3Hn5dqqmK+BFCihTZIN
|
24
|
+
fqpBmuxyNEE21fSO9ALLlWeW9ffg9Ye5Sc1n3yEyv8rPb9VDvi1B5N6xIcDFMNVs
|
25
|
+
RiCamNbET4Sq9VIYwYtcB1f6EataqFEhAgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYD
|
26
|
+
VR0PBAQDAgSwMB0GA1UdDgQWBBR8KtAhZIhe2uPQHCgU5HurIG7crTAcBgNVHREE
|
27
|
+
FTATgRFtYWhsb25AbWFydGluaS5udTAcBgNVHRIEFTATgRFtYWhsb25AbWFydGlu
|
28
|
+
aS5udTANBgkqhkiG9w0BAQsFAAOCAYEABMyF43FOfY+DULlLbR/S6k62DxsJn6dA
|
29
|
+
YE1DI0o/IGN9t6ga7iQT944HM3gg1AIsONBvFwU31/VLG3Pp91k6YVEQvZITKBOz
|
30
|
+
EVjhTfKBvoqWyuwMKCYn9ZtCASfZDFec7SMsgwIbKuncb6RKjH9cYauuDOtd55lC
|
31
|
+
pie+OmOF330StWH/Z/WY5WiRGstpL5/Qk0y4NMqcV/T59fNIVNxG4k5/VNgVYQIM
|
32
|
+
4Yrvx5tkYPIvPOroIGfDu6CfrQVNg4QJrQN2LZmXGoEV47v1kdV9kMAeFDBkTmPS
|
33
|
+
XqnsRK6X7WhFON8/7CliGvF+T8dmfGJS5R46x7FIzendFMA6pY4IknfGEabzyL9O
|
34
|
+
8IIu155/luqHPnzYLlRi4n+hzwkwGh9erCmbMqrsATqVf4C20H7EAOlDlhmNDqiV
|
35
|
+
g3nSb5geweeDxf7Phf3qyZgglWB4UGR0aUkzOwj6yFj1ugCU2R7CwNhqgmtdkvYm
|
36
|
+
tuLuv1oCfpuEmRh93FiLFsOLV3auiU+c
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2019-03-13 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: schedulability
|
@@ -474,7 +478,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
474
478
|
version: '0'
|
475
479
|
requirements: []
|
476
480
|
rubyforge_project:
|
477
|
-
rubygems_version: 2.7.
|
481
|
+
rubygems_version: 2.7.8
|
478
482
|
signing_key:
|
479
483
|
specification_version: 4
|
480
484
|
summary: Arborist is a monitoring toolkit that follows the UNIX philosophy of small
|
metadata.gz.sig
CHANGED
Binary file
|