choria-mcorpc-support 2.23.1 → 2.24.2
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 +5 -5
- data/lib/mcollective.rb +3 -2
- data/lib/mcollective/agent/choria_util.ddl +206 -107
- data/lib/mcollective/agent/choria_util.json +101 -1
- data/lib/mcollective/agent/rpcutil.json +2 -3
- data/lib/mcollective/agent/scout.json +107 -135
- data/lib/mcollective/application/facts.rb +2 -67
- data/lib/mcollective/application/find.rb +1 -1
- data/lib/mcollective/application/plugin.rb +2 -15
- data/lib/mcollective/client.rb +1 -1
- data/lib/mcollective/config.rb +135 -103
- data/lib/mcollective/ddl.rb +0 -1
- data/lib/mcollective/discovery.rb +11 -63
- data/lib/mcollective/discovery/broadcast.ddl +11 -0
- data/lib/mcollective/discovery/choria.ddl +6 -4
- data/lib/mcollective/discovery/delegate.ddl +13 -0
- data/lib/mcollective/discovery/delegate.rb +73 -0
- data/lib/mcollective/discovery/external.ddl +13 -0
- data/lib/mcollective/discovery/file.ddl +13 -0
- data/lib/mcollective/discovery/flatfile.ddl +7 -5
- data/lib/mcollective/discovery/inventory.ddl +13 -0
- data/lib/mcollective/discovery/mc.ddl +3 -3
- data/lib/mcollective/generators.rb +0 -1
- data/lib/mcollective/optionparser.rb +1 -1
- data/lib/mcollective/pluginpackager/forge_packager.rb +1 -1
- data/lib/mcollective/rpc/client.rb +4 -2
- data/lib/mcollective/util.rb +25 -35
- data/lib/mcollective/util/tasks_support.rb +15 -2
- metadata +9 -23
- data/lib/mcollective/data.rb +0 -96
- data/lib/mcollective/data/agent_data.ddl +0 -22
- data/lib/mcollective/data/agent_data.rb +0 -17
- data/lib/mcollective/data/base.rb +0 -68
- data/lib/mcollective/data/bolt_task_data.ddl +0 -90
- data/lib/mcollective/data/bolt_task_data.rb +0 -32
- data/lib/mcollective/data/collective_data.ddl +0 -20
- data/lib/mcollective/data/collective_data.rb +0 -9
- data/lib/mcollective/data/fact_data.ddl +0 -28
- data/lib/mcollective/data/fact_data.rb +0 -55
- data/lib/mcollective/data/fstat_data.ddl +0 -89
- data/lib/mcollective/data/fstat_data.rb +0 -54
- data/lib/mcollective/data/result.rb +0 -50
- data/lib/mcollective/ddl/dataddl.rb +0 -56
- data/lib/mcollective/discovery/choria.rb +0 -223
- data/lib/mcollective/discovery/flatfile.rb +0 -47
- data/lib/mcollective/discovery/stdin.ddl +0 -11
- data/lib/mcollective/discovery/stdin.rb +0 -67
- data/lib/mcollective/generators/data_generator.rb +0 -50
- data/lib/mcollective/generators/templates/data_input_snippet.erb +0 -7
@@ -308,8 +308,7 @@
|
|
308
308
|
},
|
309
309
|
"machines": {
|
310
310
|
"description": "Autonomous Agents",
|
311
|
-
"display_as": "Machines"
|
312
|
-
"default": null
|
311
|
+
"display_as": "Machines"
|
313
312
|
}
|
314
313
|
},
|
315
314
|
"display": "always",
|
@@ -330,4 +329,4 @@
|
|
330
329
|
"description": "Responds to requests for PING with PONG"
|
331
330
|
}
|
332
331
|
]
|
333
|
-
}
|
332
|
+
}
|
@@ -1,122 +1,58 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "https://choria.io/schemas/mcorpc/ddl/v1/agent.json",
|
3
3
|
"metadata": {
|
4
|
-
"name": "scout",
|
5
|
-
"description": "Choria Scout Agent Management API",
|
6
|
-
"author": "R.I.Pienaar <rip@devco.net>",
|
7
4
|
"license": "Apache-2.0",
|
5
|
+
"author": "R.I.Pienaar <rip@devco.net>",
|
6
|
+
"timeout": 5,
|
7
|
+
"name": "scout",
|
8
8
|
"version": "0.0.1",
|
9
9
|
"url": "https://choria.io",
|
10
|
-
"
|
11
|
-
"
|
10
|
+
"description": "Choria Scout Agent Management API",
|
11
|
+
"provider": "golang"
|
12
12
|
},
|
13
13
|
"actions": [
|
14
14
|
{
|
15
15
|
"action": "checks",
|
16
|
-
"
|
17
|
-
|
16
|
+
"display": "ok",
|
17
|
+
"description": "Obtain a list of checks and their current status",
|
18
|
+
"input": {},
|
18
19
|
"output": {
|
19
20
|
"checks": {
|
20
21
|
"description": "Details about each check",
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"type": "array"
|
22
|
+
"type": "array",
|
23
|
+
"display_as": "Checks"
|
24
24
|
}
|
25
|
-
}
|
26
|
-
"display": "ok",
|
27
|
-
"description": "Obtain a list of checks and their current status"
|
25
|
+
}
|
28
26
|
},
|
29
27
|
{
|
30
|
-
"action": "
|
28
|
+
"action": "resume",
|
31
29
|
"input": {
|
32
|
-
"
|
33
|
-
"prompt": "
|
34
|
-
"description": "
|
35
|
-
"type": "
|
36
|
-
"
|
37
|
-
"optional": false,
|
38
|
-
"validation": ".+",
|
39
|
-
"maxlength": 256
|
40
|
-
},
|
41
|
-
"vars": {
|
42
|
-
"prompt": "Vars File",
|
43
|
-
"description": "Path to a file to use as template variables",
|
44
|
-
"type": "string",
|
45
|
-
"default": null,
|
46
|
-
"optional": true,
|
47
|
-
"validation": ".+",
|
48
|
-
"maxlength": 256
|
30
|
+
"checks": {
|
31
|
+
"prompt": "Checks",
|
32
|
+
"description": "Check to resume, empty means all",
|
33
|
+
"type": "array",
|
34
|
+
"optional": true
|
49
35
|
}
|
50
36
|
},
|
51
37
|
"output": {
|
52
|
-
"
|
53
|
-
"description": "
|
54
|
-
"display_as": "Failed
|
55
|
-
"default": null,
|
56
|
-
"type": "integer"
|
57
|
-
},
|
58
|
-
"results": {
|
59
|
-
"description": "The full test results",
|
60
|
-
"display_as": "Results",
|
61
|
-
"default": null,
|
38
|
+
"failed": {
|
39
|
+
"description": "List of checks that could not be resumed",
|
40
|
+
"display_as": "Failed",
|
62
41
|
"type": "array"
|
63
42
|
},
|
64
|
-
"
|
65
|
-
"description": "
|
66
|
-
"display_as": "
|
67
|
-
"
|
68
|
-
"type": "integer"
|
69
|
-
},
|
70
|
-
"success": {
|
71
|
-
"description": "Indicates if the test passed",
|
72
|
-
"display_as": "Success",
|
73
|
-
"default": null,
|
74
|
-
"type": "string"
|
75
|
-
},
|
76
|
-
"summary": {
|
77
|
-
"description": "A human friendly test result",
|
78
|
-
"display_as": "Summary",
|
79
|
-
"default": null,
|
80
|
-
"type": "string"
|
43
|
+
"transitioned": {
|
44
|
+
"description": "List of checks that were resumed",
|
45
|
+
"display_as": "Triggered",
|
46
|
+
"type": "array"
|
81
47
|
},
|
82
|
-
"
|
83
|
-
"description": "
|
84
|
-
"display_as": "
|
85
|
-
"
|
86
|
-
"type": "integer"
|
48
|
+
"skipped": {
|
49
|
+
"description": "List of checks that was skipped",
|
50
|
+
"display_as": "Skipped",
|
51
|
+
"type": "array"
|
87
52
|
}
|
88
53
|
},
|
89
54
|
"display": "failed",
|
90
|
-
"description": "
|
91
|
-
"aggregate": [
|
92
|
-
{
|
93
|
-
"function": "summary",
|
94
|
-
"args": [
|
95
|
-
"tests",
|
96
|
-
{
|
97
|
-
"format": "%s Test Cases on %d node(s)"
|
98
|
-
}
|
99
|
-
]
|
100
|
-
},
|
101
|
-
{
|
102
|
-
"function": "summary",
|
103
|
-
"args": [
|
104
|
-
"failures",
|
105
|
-
{
|
106
|
-
"format": "%s Failed Cases on %d node(s)"
|
107
|
-
}
|
108
|
-
]
|
109
|
-
},
|
110
|
-
{
|
111
|
-
"function": "summary",
|
112
|
-
"args": [
|
113
|
-
"success",
|
114
|
-
{
|
115
|
-
"format": "%s Passed Cases on %d node(s)"
|
116
|
-
}
|
117
|
-
]
|
118
|
-
}
|
119
|
-
]
|
55
|
+
"description": "Resume active checking of one or more checks"
|
120
56
|
},
|
121
57
|
{
|
122
58
|
"action": "maintenance",
|
@@ -125,7 +61,6 @@
|
|
125
61
|
"prompt": "Checks",
|
126
62
|
"description": "Check to pause, empty means all",
|
127
63
|
"type": "array",
|
128
|
-
"default": null,
|
129
64
|
"optional": true
|
130
65
|
}
|
131
66
|
},
|
@@ -133,19 +68,16 @@
|
|
133
68
|
"failed": {
|
134
69
|
"description": "List of checks that could not be paused",
|
135
70
|
"display_as": "Failed",
|
136
|
-
"default": null,
|
137
|
-
"type": "array"
|
138
|
-
},
|
139
|
-
"skipped": {
|
140
|
-
"description": "List of checks that was skipped",
|
141
|
-
"display_as": "Skipped",
|
142
|
-
"default": null,
|
143
71
|
"type": "array"
|
144
72
|
},
|
145
73
|
"transitioned": {
|
146
74
|
"description": "List of checks that were paused",
|
147
75
|
"display_as": "Triggered",
|
148
|
-
"
|
76
|
+
"type": "array"
|
77
|
+
},
|
78
|
+
"skipped": {
|
79
|
+
"description": "List of checks that was skipped",
|
80
|
+
"display_as": "Skipped",
|
149
81
|
"type": "array"
|
150
82
|
}
|
151
83
|
},
|
@@ -153,38 +85,82 @@
|
|
153
85
|
"description": "Pause checking of one or more checks"
|
154
86
|
},
|
155
87
|
{
|
156
|
-
"action": "
|
88
|
+
"action": "goss_validate",
|
89
|
+
"description": "Performs a Goss validation using a specific file",
|
90
|
+
"display": "failed",
|
91
|
+
"aggregate": [
|
92
|
+
{
|
93
|
+
"function": "summary",
|
94
|
+
"args": [
|
95
|
+
"tests",
|
96
|
+
{"format": "%s Tests on %d node(s)"}
|
97
|
+
]
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"function": "summary",
|
101
|
+
"args": [
|
102
|
+
"failures",
|
103
|
+
{"format": "%s Failed test on %d node(s)"}
|
104
|
+
]
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"function": "summary",
|
108
|
+
"args": [
|
109
|
+
"success",
|
110
|
+
{"format": "%s Passed tests on %d node(s)"}
|
111
|
+
]
|
112
|
+
}
|
113
|
+
],
|
157
114
|
"input": {
|
158
|
-
"
|
159
|
-
"prompt": "
|
160
|
-
"description": "
|
161
|
-
"type": "
|
162
|
-
"
|
115
|
+
"file": {
|
116
|
+
"prompt": "Goss File",
|
117
|
+
"description": "Path to the Goss validation specification",
|
118
|
+
"type": "string",
|
119
|
+
"maxlength": 256,
|
120
|
+
"validation": ".+",
|
121
|
+
"optional": false
|
122
|
+
},
|
123
|
+
"vars": {
|
124
|
+
"prompt": "Vars File",
|
125
|
+
"description": "Path to a file to use as template variables",
|
126
|
+
"type": "string",
|
127
|
+
"maxlength": 256,
|
128
|
+
"validation": ".+",
|
163
129
|
"optional": true
|
164
130
|
}
|
165
131
|
},
|
166
132
|
"output": {
|
167
|
-
"
|
168
|
-
"description": "
|
169
|
-
"display_as": "
|
170
|
-
"
|
171
|
-
"type": "array"
|
133
|
+
"tests": {
|
134
|
+
"description": "The number of tests that were run",
|
135
|
+
"display_as": "Tests",
|
136
|
+
"type": "integer"
|
172
137
|
},
|
173
|
-
"
|
174
|
-
"description": "
|
175
|
-
"display_as": "
|
176
|
-
"
|
177
|
-
"type": "array"
|
138
|
+
"failures": {
|
139
|
+
"description": "The number of tests that failed",
|
140
|
+
"display_as": "Failed Tests",
|
141
|
+
"type": "integer"
|
178
142
|
},
|
179
|
-
"
|
180
|
-
"description": "
|
181
|
-
"display_as": "
|
182
|
-
"
|
143
|
+
"runtime": {
|
144
|
+
"description": "The time it took to run the tests, in seconds",
|
145
|
+
"display_as": "Runtime",
|
146
|
+
"type": "integer"
|
147
|
+
},
|
148
|
+
"success": {
|
149
|
+
"description": "Indicates if the test passed",
|
150
|
+
"display_as": "Success",
|
151
|
+
"type": "string"
|
152
|
+
},
|
153
|
+
"summary": {
|
154
|
+
"description": "A human friendly test result",
|
155
|
+
"display_as": "Summary",
|
156
|
+
"type": "string"
|
157
|
+
},
|
158
|
+
"results": {
|
159
|
+
"description": "The full test results",
|
160
|
+
"display_as": "Results",
|
183
161
|
"type": "array"
|
184
162
|
}
|
185
|
-
}
|
186
|
-
"display": "failed",
|
187
|
-
"description": "Resume active checking of one or more checks"
|
163
|
+
}
|
188
164
|
},
|
189
165
|
{
|
190
166
|
"action": "trigger",
|
@@ -193,7 +169,6 @@
|
|
193
169
|
"prompt": "Checks",
|
194
170
|
"description": "Check to trigger, empty means all",
|
195
171
|
"type": "array",
|
196
|
-
"default": null,
|
197
172
|
"optional": true
|
198
173
|
}
|
199
174
|
},
|
@@ -201,19 +176,16 @@
|
|
201
176
|
"failed": {
|
202
177
|
"description": "List of checks that could not be triggered",
|
203
178
|
"display_as": "Failed",
|
204
|
-
"default": null,
|
205
|
-
"type": "array"
|
206
|
-
},
|
207
|
-
"skipped": {
|
208
|
-
"description": "List of checks that was skipped",
|
209
|
-
"display_as": "Skipped",
|
210
|
-
"default": null,
|
211
179
|
"type": "array"
|
212
180
|
},
|
213
181
|
"transitioned": {
|
214
182
|
"description": "List of checks that were triggered",
|
215
183
|
"display_as": "Triggered",
|
216
|
-
"
|
184
|
+
"type": "array"
|
185
|
+
},
|
186
|
+
"skipped": {
|
187
|
+
"description": "List of checks that was skipped",
|
188
|
+
"display_as": "Skipped",
|
217
189
|
"type": "array"
|
218
190
|
}
|
219
191
|
},
|
@@ -221,4 +193,4 @@
|
|
221
193
|
"description": "Force an immediate check of one or more checks"
|
222
194
|
}
|
223
195
|
]
|
224
|
-
}
|
196
|
+
}
|
@@ -1,71 +1,6 @@
|
|
1
1
|
class MCollective::Application::Facts < MCollective::Application # rubocop:disable Style/ClassAndModuleChildren
|
2
2
|
description "Reports on usage for a specific fact"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
def validate_configuration(configuration)
|
9
|
-
raise "Please specify a fact to report for" unless configuration.include?(:fact)
|
10
|
-
end
|
11
|
-
|
12
|
-
def show_single_fact_report(fact, facts, verbose=false)
|
13
|
-
puts("Report for fact: #{fact}\n\n")
|
14
|
-
|
15
|
-
facts = stringify_facts_hash(facts)
|
16
|
-
|
17
|
-
field_size = MCollective::Util.field_size(facts.keys)
|
18
|
-
facts.keys.sort.each do |k|
|
19
|
-
printf(" %-#{field_size}s found %d times\n", k, facts[k].size)
|
20
|
-
|
21
|
-
next unless verbose
|
22
|
-
|
23
|
-
puts
|
24
|
-
|
25
|
-
facts[k].sort.each do |f|
|
26
|
-
puts(" #{f}")
|
27
|
-
end
|
28
|
-
|
29
|
-
puts
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def stringify_facts_hash(facts)
|
34
|
-
res = Hash.new([])
|
35
|
-
facts.each { |k, v| res[k.to_s] += v }
|
36
|
-
res
|
37
|
-
end
|
38
|
-
|
39
|
-
def main
|
40
|
-
rpcutil = rpcclient("rpcutil")
|
41
|
-
rpcutil.progress = false
|
42
|
-
|
43
|
-
facts = {}
|
44
|
-
|
45
|
-
rpcutil.get_fact(:fact => configuration[:fact]) do |resp|
|
46
|
-
begin
|
47
|
-
value = resp[:body][:data][:value].to_s
|
48
|
-
|
49
|
-
if resp[:body][:data].include?(:value)
|
50
|
-
if facts.include?(value)
|
51
|
-
facts[value] << resp[:senderid]
|
52
|
-
else
|
53
|
-
facts[value] = [resp[:senderid]]
|
54
|
-
end
|
55
|
-
end
|
56
|
-
rescue Exception => e # rubocop:disable Lint/RescueException
|
57
|
-
warn "Could not parse facts for #{resp[:senderid]}: #{e.class}: #{e}"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
if facts.empty?
|
62
|
-
puts "No values found for fact #{configuration[:fact]}\n"
|
63
|
-
else
|
64
|
-
show_single_fact_report(configuration[:fact], facts, options[:verbose])
|
65
|
-
end
|
66
|
-
|
67
|
-
printrpcstats
|
68
|
-
|
69
|
-
halt rpcutil.stats
|
70
|
-
end
|
4
|
+
external(:command => "choria", :args => ["facts"])
|
5
|
+
external_help(:command => "choria", :args => ["facts", "--help"])
|
71
6
|
end
|
@@ -16,7 +16,7 @@ class MCollective::Application::Find < MCollective::Application # rubocop:disabl
|
|
16
16
|
|
17
17
|
nodes.each {|c| puts c}
|
18
18
|
|
19
|
-
warn "\nDiscovered %s nodes in %.2f seconds using the %s discovery plugin" % [nodes.size, discoverytime, mc.client.
|
19
|
+
warn "\nDiscovered %s nodes in %.2f seconds using the %s discovery plugin" % [nodes.size, discoverytime, mc.client.options[:discovery_method]] if options[:verbose]
|
20
20
|
|
21
21
|
!nodes.empty? ? exit(0) : exit(1)
|
22
22
|
end
|
@@ -9,7 +9,6 @@ mco plugin package [options] <directory>
|
|
9
9
|
mco plugin doc <plugin>
|
10
10
|
mco plugin doc <type/plugin>
|
11
11
|
mco plugin generate agent <pluginname> [actions=val,val]
|
12
|
-
mco plugin generate data <pluginname> [outputs=val,val]
|
13
12
|
|
14
13
|
info : Display plugin information including package details.
|
15
14
|
package : Create all available plugin packages.
|
@@ -116,11 +115,6 @@ mco plugin package [options] <directory>
|
|
116
115
|
:arguments => ["--actions [ACTIONS]"],
|
117
116
|
:type => Array
|
118
117
|
|
119
|
-
option :outputs,
|
120
|
-
:description => "Outputs to be generated for an Data Plugin",
|
121
|
-
:arguments => ["--outputs [OUTPUTS]"],
|
122
|
-
:type => Array
|
123
|
-
|
124
118
|
option :keep_artifacts,
|
125
119
|
:description => "Don't remove artifacts after building packages",
|
126
120
|
:arguments => ["--keep-artifacts"],
|
@@ -167,7 +161,7 @@ mco plugin package [options] <directory>
|
|
167
161
|
|
168
162
|
# Generate a plugin skeleton
|
169
163
|
def generate_command
|
170
|
-
raise "undefined plugin type. cannot generate plugin. valid types are 'agent'
|
164
|
+
raise "undefined plugin type. cannot generate plugin. valid types are 'agent'" if configuration["target"] == "."
|
171
165
|
|
172
166
|
unless configuration[:pluginname]
|
173
167
|
puts "No plugin name specified. Using 'new_plugin'"
|
@@ -181,12 +175,6 @@ mco plugin package [options] <directory>
|
|
181
175
|
Generators::AgentGenerator.new(configuration[:pluginname], configuration[:actions], configuration[:pluginname],
|
182
176
|
configuration[:description], configuration[:author], configuration[:license],
|
183
177
|
configuration[:version], configuration[:url], configuration[:timeout])
|
184
|
-
when "data"
|
185
|
-
raise "data plugin must have at least one output" unless configuration[:outputs]
|
186
|
-
|
187
|
-
Generators::DataGenerator.new(configuration[:pluginname], configuration[:outputs], configuration[:pluginname],
|
188
|
-
configuration[:description], configuration[:author], configuration[:license],
|
189
|
-
configuration[:version], configuration[:url], configuration[:timeout])
|
190
178
|
else
|
191
179
|
raise "invalid plugin type. cannot generate plugin '#{configuration[:target]}'"
|
192
180
|
end
|
@@ -228,7 +216,6 @@ mco plugin package [options] <directory>
|
|
228
216
|
["Agents", :agent],
|
229
217
|
["Aggregate", :aggregate],
|
230
218
|
["Connectors", :connector],
|
231
|
-
["Data Queries", :data],
|
232
219
|
["Discovery Methods", :discovery],
|
233
220
|
["Validator Plugins", :validator]
|
234
221
|
]
|
@@ -345,7 +332,7 @@ mco plugin package [options] <directory>
|
|
345
332
|
# Return the name of the type of plugin as a string
|
346
333
|
def identify_plugin
|
347
334
|
plugintype = Dir.glob(File.join(configuration[:target], "*")).select do |file|
|
348
|
-
File.directory?(file) && file.match(/(connector|facts|registration|security|audit|pluginpackager|
|
335
|
+
File.directory?(file) && file.match(/(connector|facts|registration|security|audit|pluginpackager|discovery|validator)/)
|
349
336
|
end
|
350
337
|
|
351
338
|
raise "more than one plugin type detected in directory" if plugintype.size > 1
|