choria-mcorpc-support 2.24.2 → 2.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mcollective/agent/choria_provision.ddl +283 -0
- data/lib/mcollective/agent/choria_provision.json +309 -0
- data/lib/mcollective/agent/choria_registry.ddl +65 -0
- data/lib/mcollective/agent/choria_registry.json +74 -0
- data/lib/mcollective/agent/choria_util.ddl +24 -4
- data/lib/mcollective/agent/choria_util.json +24 -24
- data/lib/mcollective/agent/rpcutil.ddl +242 -183
- data/lib/mcollective/agent/rpcutil.json +53 -56
- data/lib/mcollective/agent/scout.ddl +1 -1
- data/lib/mcollective/agent/scout.json +1 -1
- data/lib/mcollective/application/plugin.rb +7 -159
- data/lib/mcollective/config.rb +10 -0
- data/lib/mcollective/discovery/delegate.rb +4 -2
- data/lib/mcollective/log.rb +1 -2
- data/lib/mcollective/util/choria.rb +14 -8
- data/lib/mcollective/util/tasks_support.rb +13 -3
- data/lib/mcollective.rb +0 -1
- metadata +12 -8
- data/lib/mcollective/generators/agent_generator.rb +0 -50
- data/lib/mcollective/generators/base.rb +0 -45
- data/lib/mcollective/generators/templates/action_snippet.erb +0 -13
- data/lib/mcollective/generators/templates/ddl.erb +0 -8
- data/lib/mcollective/generators/templates/plugin.erb +0 -7
- data/lib/mcollective/generators.rb +0 -6
@@ -2,10 +2,10 @@
|
|
2
2
|
"$schema": "https://choria.io/schemas/mcorpc/ddl/v1/agent.json",
|
3
3
|
"metadata": {
|
4
4
|
"name": "rpcutil",
|
5
|
-
"description": "
|
5
|
+
"description": "Utility actions that expose information about the state of the running Server",
|
6
6
|
"author": "R.I.Pienaar <rip@devco.net>",
|
7
|
-
"license": "Apache
|
8
|
-
"version": "0.
|
7
|
+
"license": "Apache-2.0",
|
8
|
+
"version": "0.23.0",
|
9
9
|
"url": "https://choria.io/",
|
10
10
|
"timeout": 2
|
11
11
|
},
|
@@ -18,11 +18,11 @@
|
|
18
18
|
"agents": {
|
19
19
|
"description": "List of agents on the server",
|
20
20
|
"display_as": "Agents",
|
21
|
-
"
|
21
|
+
"type": "array"
|
22
22
|
}
|
23
23
|
},
|
24
24
|
"display": "always",
|
25
|
-
"description": "Inventory of all agents on the server"
|
25
|
+
"description": "Inventory of all agents on the server including versions, licenses and more"
|
26
26
|
},
|
27
27
|
{
|
28
28
|
"action": "collective_info",
|
@@ -32,16 +32,16 @@
|
|
32
32
|
"main_collective": {
|
33
33
|
"description": "The main Collective",
|
34
34
|
"display_as": "Main Collective",
|
35
|
-
"
|
35
|
+
"type": "string"
|
36
36
|
},
|
37
37
|
"collectives": {
|
38
38
|
"description": "All Collectives",
|
39
39
|
"display_as": "All Collectives",
|
40
|
-
"
|
40
|
+
"type": "array"
|
41
41
|
}
|
42
42
|
},
|
43
43
|
"display": "always",
|
44
|
-
"description": "Info about the main and sub collectives",
|
44
|
+
"description": "Info about the main and sub collectives that the server belongs to",
|
45
45
|
"aggregate": [
|
46
46
|
{
|
47
47
|
"function": "summary",
|
@@ -57,74 +57,74 @@
|
|
57
57
|
},
|
58
58
|
"output": {
|
59
59
|
"threads": {
|
60
|
-
"description": "List of threads active in the
|
60
|
+
"description": "List of threads active in the Choria Server",
|
61
61
|
"display_as": "Threads",
|
62
|
-
"
|
62
|
+
"type": "array"
|
63
63
|
},
|
64
64
|
"agents": {
|
65
65
|
"description": "List of agents loaded",
|
66
66
|
"display_as": "Agents",
|
67
|
-
"
|
67
|
+
"type": "array"
|
68
68
|
},
|
69
69
|
"pid": {
|
70
|
-
"description": "Process ID of the
|
70
|
+
"description": "Process ID of the Choria Server",
|
71
71
|
"display_as": "PID",
|
72
|
-
"
|
72
|
+
"type": "integer"
|
73
73
|
},
|
74
74
|
"times": {
|
75
|
-
"description": "Processor time consumed by the
|
75
|
+
"description": "Processor time consumed by the Choria Server",
|
76
76
|
"display_as": "Times",
|
77
|
-
"
|
77
|
+
"type": "hash"
|
78
78
|
},
|
79
79
|
"validated": {
|
80
|
-
"description": "
|
80
|
+
"description": "Count of messages that passed security validation",
|
81
81
|
"display_as": "Security Validated",
|
82
|
-
"
|
82
|
+
"type": "integer"
|
83
83
|
},
|
84
84
|
"unvalidated": {
|
85
|
-
"description": "
|
85
|
+
"description": "Count of messages that failed security validation",
|
86
86
|
"display_as": "Failed Security",
|
87
|
-
"
|
87
|
+
"type": "integer"
|
88
88
|
},
|
89
89
|
"passed": {
|
90
|
-
"description": "
|
90
|
+
"description": "Count of messages that passed filter checks",
|
91
91
|
"display_as": "Passed Filter",
|
92
|
-
"
|
92
|
+
"type": "integer"
|
93
93
|
},
|
94
94
|
"filtered": {
|
95
|
-
"description": "
|
95
|
+
"description": "Count of message that didn't pass filter checks",
|
96
96
|
"display_as": "Failed Filter",
|
97
|
-
"
|
97
|
+
"type": "integer"
|
98
98
|
},
|
99
99
|
"starttime": {
|
100
|
-
"description": "Time the
|
100
|
+
"description": "Time the Choria Server started in unix seconds",
|
101
101
|
"display_as": "Start Time",
|
102
|
-
"
|
102
|
+
"type": "integer"
|
103
103
|
},
|
104
104
|
"total": {
|
105
|
-
"description": "
|
105
|
+
"description": "Count of messages received by the Choria Server",
|
106
106
|
"display_as": "Total Messages",
|
107
|
-
"
|
107
|
+
"type": "integer"
|
108
108
|
},
|
109
109
|
"replies": {
|
110
|
-
"description": "
|
110
|
+
"description": "Count of replies sent back to clients",
|
111
111
|
"display_as": "Replies",
|
112
|
-
"
|
112
|
+
"type": "integer"
|
113
113
|
},
|
114
114
|
"configfile": {
|
115
115
|
"description": "Config file used to start the daemon",
|
116
116
|
"display_as": "Config File",
|
117
|
-
"
|
117
|
+
"type": "string"
|
118
118
|
},
|
119
119
|
"version": {
|
120
|
-
"description": "
|
120
|
+
"description": "Choria Server Version",
|
121
121
|
"display_as": "Version",
|
122
|
-
"
|
122
|
+
"type": "string"
|
123
123
|
},
|
124
124
|
"ttlexpired": {
|
125
|
-
"description": "
|
125
|
+
"description": "Count of messages that did pass TTL checks",
|
126
126
|
"display_as": "TTL Expired",
|
127
|
-
"
|
127
|
+
"type": "integer"
|
128
128
|
}
|
129
129
|
},
|
130
130
|
"display": "always",
|
@@ -151,22 +151,20 @@
|
|
151
151
|
"prompt": "Configuration Item",
|
152
152
|
"description": "The item to retrieve from the server",
|
153
153
|
"type": "string",
|
154
|
-
"default": null,
|
155
154
|
"optional": false,
|
156
155
|
"validation": "^.+$",
|
157
|
-
"maxlength":
|
156
|
+
"maxlength": 120
|
158
157
|
}
|
159
158
|
},
|
160
159
|
"output": {
|
161
160
|
"item": {
|
162
161
|
"description": "The config property being retrieved",
|
163
162
|
"display_as": "Property",
|
164
|
-
"
|
163
|
+
"type": "string"
|
165
164
|
},
|
166
165
|
"value": {
|
167
166
|
"description": "The value that is in use",
|
168
|
-
"display_as": "Value"
|
169
|
-
"default": null
|
167
|
+
"display_as": "Value"
|
170
168
|
}
|
171
169
|
},
|
172
170
|
"display": "always",
|
@@ -187,7 +185,6 @@
|
|
187
185
|
"prompt": "Data Source",
|
188
186
|
"description": "The data plugin to retrieve information from",
|
189
187
|
"type": "string",
|
190
|
-
"default": null,
|
191
188
|
"optional": false,
|
192
189
|
"validation": "^\\w+$",
|
193
190
|
"maxlength": 50
|
@@ -202,8 +199,7 @@
|
|
202
199
|
"maxlength": 200
|
203
200
|
}
|
204
201
|
},
|
205
|
-
"output": {
|
206
|
-
},
|
202
|
+
"output": {},
|
207
203
|
"display": "always",
|
208
204
|
"description": "Get data from a data plugin"
|
209
205
|
},
|
@@ -224,7 +220,7 @@
|
|
224
220
|
"fact": {
|
225
221
|
"description": "The name of the fact being returned",
|
226
222
|
"display_as": "Fact",
|
227
|
-
"
|
223
|
+
"type": "string"
|
228
224
|
},
|
229
225
|
"value": {
|
230
226
|
"description": "The value of the fact",
|
@@ -247,7 +243,7 @@
|
|
247
243
|
"action": "get_facts",
|
248
244
|
"input": {
|
249
245
|
"facts": {
|
250
|
-
"prompt": "Comma-separated list of facts",
|
246
|
+
"prompt": "Comma-separated list of facts to retrieve",
|
251
247
|
"description": "Facts to retrieve",
|
252
248
|
"type": "string",
|
253
249
|
"default": null,
|
@@ -260,7 +256,7 @@
|
|
260
256
|
"values": {
|
261
257
|
"description": "List of values of the facts",
|
262
258
|
"display_as": "Values",
|
263
|
-
"
|
259
|
+
"type": "hash"
|
264
260
|
}
|
265
261
|
},
|
266
262
|
"display": "always",
|
@@ -274,41 +270,42 @@
|
|
274
270
|
"agents": {
|
275
271
|
"description": "List of agent names",
|
276
272
|
"display_as": "Agents",
|
277
|
-
"
|
273
|
+
"type": "array"
|
278
274
|
},
|
279
275
|
"facts": {
|
280
276
|
"description": "List of facts and values",
|
281
277
|
"display_as": "Facts",
|
282
|
-
"
|
278
|
+
"type": "hash"
|
283
279
|
},
|
284
280
|
"classes": {
|
285
281
|
"description": "List of classes on the system",
|
286
282
|
"display_as": "Classes",
|
287
|
-
"
|
283
|
+
"type": "array"
|
288
284
|
},
|
289
285
|
"version": {
|
290
|
-
"description": "
|
286
|
+
"description": "Choria Server Version",
|
291
287
|
"display_as": "Version",
|
292
|
-
"
|
288
|
+
"type": "string"
|
293
289
|
},
|
294
290
|
"main_collective": {
|
295
291
|
"description": "The main Collective",
|
296
292
|
"display_as": "Main Collective",
|
297
|
-
"
|
293
|
+
"type": "string"
|
298
294
|
},
|
299
295
|
"collectives": {
|
300
296
|
"description": "All Collectives",
|
301
297
|
"display_as": "All Collectives",
|
302
|
-
"
|
298
|
+
"type": "array"
|
303
299
|
},
|
304
300
|
"data_plugins": {
|
305
301
|
"description": "List of data plugin names",
|
306
302
|
"display_as": "Data Plugins",
|
307
|
-
"
|
303
|
+
"type": "array"
|
308
304
|
},
|
309
305
|
"machines": {
|
310
306
|
"description": "Autonomous Agents",
|
311
|
-
"display_as": "Machines"
|
307
|
+
"display_as": "Machines",
|
308
|
+
"type": "hash"
|
312
309
|
}
|
313
310
|
},
|
314
311
|
"display": "always",
|
@@ -320,9 +317,9 @@
|
|
320
317
|
},
|
321
318
|
"output": {
|
322
319
|
"pong": {
|
323
|
-
"description": "The local timestamp",
|
320
|
+
"description": "The local Unix timestamp",
|
324
321
|
"display_as": "Timestamp",
|
325
|
-
"
|
322
|
+
"type": "string"
|
326
323
|
}
|
327
324
|
},
|
328
325
|
"display": "always",
|
@@ -2,7 +2,7 @@ metadata :name => "scout",
|
|
2
2
|
:description => "Choria Scout Agent Management API",
|
3
3
|
:author => "R.I.Pienaar <rip@devco.net>",
|
4
4
|
:license => "Apache-2.0",
|
5
|
-
:version => "0.0
|
5
|
+
:version => "0.23.0",
|
6
6
|
:url => "https://choria.io",
|
7
7
|
:provider => "golang",
|
8
8
|
:timeout => 5
|
@@ -8,18 +8,14 @@ mco plugin package [options] <directory>
|
|
8
8
|
mco plugin info <directory>
|
9
9
|
mco plugin doc <plugin>
|
10
10
|
mco plugin doc <type/plugin>
|
11
|
-
mco plugin generate
|
11
|
+
mco plugin generate client <ddl> <target>
|
12
|
+
mco plugin generate ddl <json_output> <ruby_output>
|
12
13
|
|
13
14
|
info : Display plugin information including package details.
|
14
15
|
package : Create all available plugin packages.
|
15
16
|
doc : Display documentation for a specific plugin.
|
16
17
|
END_OF_USAGE
|
17
18
|
|
18
|
-
option :pluginname,
|
19
|
-
:description => "Plugin name",
|
20
|
-
:arguments => ["-n", "--name NAME"],
|
21
|
-
:type => String
|
22
|
-
|
23
19
|
option :postinstall,
|
24
20
|
:description => "Post install script",
|
25
21
|
:arguments => ["--postinstall POSTINSTALL"],
|
@@ -66,7 +62,7 @@ mco plugin package [options] <directory>
|
|
66
62
|
:type => :array
|
67
63
|
|
68
64
|
option :format,
|
69
|
-
:description => "Package output format. Defaults to
|
65
|
+
:description => "Package output format. Defaults to forge",
|
70
66
|
:arguments => ["--format OUTPUTFORMAT"],
|
71
67
|
:type => String
|
72
68
|
|
@@ -80,41 +76,11 @@ mco plugin package [options] <directory>
|
|
80
76
|
:arguments => ["--template HELPTEMPLATE"],
|
81
77
|
:type => String
|
82
78
|
|
83
|
-
option :description,
|
84
|
-
:description => "Plugin description",
|
85
|
-
:arguments => ["--description DESCRIPTION"],
|
86
|
-
:type => String
|
87
|
-
|
88
|
-
option :author,
|
89
|
-
:description => "The author of the plugin",
|
90
|
-
:arguments => ["--author AUTHOR"],
|
91
|
-
:type => String
|
92
|
-
|
93
|
-
option :license,
|
94
|
-
:description => "The license under which the plugin is distributed",
|
95
|
-
:arguments => ["--license LICENSE"],
|
96
|
-
:type => String
|
97
|
-
|
98
79
|
option :version,
|
99
80
|
:description => "The version of the plugin",
|
100
81
|
:arguments => ["--pluginversion VERSION"],
|
101
82
|
:type => String
|
102
83
|
|
103
|
-
option :url,
|
104
|
-
:description => "Url at which information about the plugin can be found",
|
105
|
-
:arguments => ["--url URL"],
|
106
|
-
:type => String
|
107
|
-
|
108
|
-
option :timeout,
|
109
|
-
:description => "The plugin's timeout",
|
110
|
-
:arguments => ["--timeout TIMEOUT"],
|
111
|
-
:type => Integer
|
112
|
-
|
113
|
-
option :actions,
|
114
|
-
:description => "Actions to be generated for an Agent Plugin",
|
115
|
-
:arguments => ["--actions [ACTIONS]"],
|
116
|
-
:type => Array
|
117
|
-
|
118
84
|
option :keep_artifacts,
|
119
85
|
:description => "Don't remove artifacts after building packages",
|
120
86
|
:arguments => ["--keep-artifacts"],
|
@@ -131,53 +97,12 @@ mco plugin package [options] <directory>
|
|
131
97
|
configuration[:action] = ARGV.delete_at(0)
|
132
98
|
|
133
99
|
configuration[:target] = ARGV.delete_at(0) || "."
|
134
|
-
|
135
|
-
if configuration[:action] == "generate"
|
136
|
-
unless ARGV[0] && ARGV[0].match(/(actions|outputs)=(.+)/i)
|
137
|
-
if configuration[:pluginname] # rubocop:disable Metrics/BlockNesting
|
138
|
-
ARGV.delete_at(0)
|
139
|
-
else
|
140
|
-
configuration[:pluginname] = ARGV.delete_at(0)
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
ARGV.each do |argument|
|
145
|
-
if argument.match(/(actions|outputs)=(.+)/i)
|
146
|
-
configuration[$1.downcase.to_sym] = $2.split(",")
|
147
|
-
else
|
148
|
-
raise "Could not parse --arg '#{argument}'"
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
100
|
end
|
153
101
|
end
|
154
102
|
|
155
|
-
# Display info about plugin
|
156
|
-
def info_command
|
157
|
-
plugin = prepare_plugin
|
158
|
-
packager = PluginPackager["#{configuration[:format].capitalize}Packager"]
|
159
|
-
packager.new(plugin).package_information
|
160
|
-
end
|
161
|
-
|
162
103
|
# Generate a plugin skeleton
|
163
104
|
def generate_command
|
164
|
-
|
165
|
-
|
166
|
-
unless configuration[:pluginname]
|
167
|
-
puts "No plugin name specified. Using 'new_plugin'"
|
168
|
-
configuration[:pluginname] = "new_plugin"
|
169
|
-
end
|
170
|
-
|
171
|
-
load_plugin_config_values
|
172
|
-
|
173
|
-
case configuration[:target].downcase
|
174
|
-
when "agent"
|
175
|
-
Generators::AgentGenerator.new(configuration[:pluginname], configuration[:actions], configuration[:pluginname],
|
176
|
-
configuration[:description], configuration[:author], configuration[:license],
|
177
|
-
configuration[:version], configuration[:url], configuration[:timeout])
|
178
|
-
else
|
179
|
-
raise "invalid plugin type. cannot generate plugin '#{configuration[:target]}'"
|
180
|
-
end
|
105
|
+
puts "CRITICAL: mco plugin generate is deprecated, please use 'choria plugin generate'"
|
181
106
|
end
|
182
107
|
|
183
108
|
# Package plugin
|
@@ -211,75 +136,10 @@ mco plugin package [options] <directory>
|
|
211
136
|
end
|
212
137
|
|
213
138
|
# Show application list and plugin help
|
214
|
-
def doc_command
|
215
|
-
|
216
|
-
["Agents", :agent],
|
217
|
-
["Aggregate", :aggregate],
|
218
|
-
["Connectors", :connector],
|
219
|
-
["Discovery Methods", :discovery],
|
220
|
-
["Validator Plugins", :validator]
|
221
|
-
]
|
222
|
-
|
223
|
-
if configuration.include?(:target) && configuration[:target] != "."
|
224
|
-
if configuration[:target] =~ /^(.+?)\/(.+)$/
|
225
|
-
ddl = load_plugin_ddl($2.to_sym, $1)
|
226
|
-
else
|
227
|
-
found_plugin_type = nil
|
228
|
-
|
229
|
-
known_plugin_types.each do |plugin_type|
|
230
|
-
PluginManager.find(plugin_type[1], "ddl").each do |ddlf|
|
231
|
-
pluginname = ddlf.gsub(/_#{plugin_type[1]}$/, "")
|
232
|
-
|
233
|
-
abort "Duplicate plugin name found, please specify a full path like agent/rpcutil" if pluginname == configuration[:target] && found_plugin_type
|
234
|
-
|
235
|
-
found_plugin_type = plugin_type[1] if pluginname == configuration[:target]
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
abort "Could not find a plugin named '%s' in any supported plugin type" % configuration[:target] unless found_plugin_type
|
240
|
-
ddl = load_plugin_ddl(configuration[:target], found_plugin_type)
|
241
|
-
end
|
242
|
-
|
243
|
-
if ddl
|
244
|
-
puts ddl.help(configuration[:rpctemplate])
|
245
|
-
else
|
246
|
-
abort "Could not find a '%s' plugin named '%s'" % configuration[:target].split("/")
|
247
|
-
end
|
248
|
-
|
249
|
-
else
|
250
|
-
puts "Please specify a plugin. Available plugins are:"
|
251
|
-
puts
|
252
|
-
|
253
|
-
load_errors = []
|
254
|
-
|
255
|
-
known_plugin_types.each do |plugin_type|
|
256
|
-
puts "%s:" % plugin_type[0]
|
257
|
-
|
258
|
-
PluginManager.find(plugin_type[1], "ddl").each do |ddlf|
|
259
|
-
begin
|
260
|
-
help = DDL.new(ddlf, plugin_type[1], false)
|
139
|
+
def doc_command
|
140
|
+
puts "WARNING: mco plugin doc is deprecated, please use choria plugin doc"
|
261
141
|
|
262
|
-
|
263
|
-
|
264
|
-
help.loadddlfile
|
265
|
-
pluginname = ddlf.gsub(/_#{plugin_type[1]}$/, "")
|
266
|
-
puts " %-25s %s" % [pluginname, help.meta[:description]]
|
267
|
-
rescue => e
|
268
|
-
load_errors << [plugin_type[1], ddlf, e]
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
puts
|
273
|
-
end
|
274
|
-
|
275
|
-
unless load_errors.empty?
|
276
|
-
puts "Plugin Load Errors:"
|
277
|
-
|
278
|
-
load_errors.each do |e|
|
279
|
-
puts " %-25s %s" % ["#{e[0]}/#{e[1]}", Util.colorize(:yellow, e[2])]
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
142
|
+
exec("choria plugin doc %s" % [configuration[:target]])
|
283
143
|
end
|
284
144
|
|
285
145
|
# Creates the correct package plugin object.
|
@@ -341,18 +201,6 @@ mco plugin package [options] <directory>
|
|
341
201
|
File.basename(plugintype[0])
|
342
202
|
end
|
343
203
|
|
344
|
-
# Load preset metadata values from config if they are present
|
345
|
-
# This makes it possible to override metadata values in a local
|
346
|
-
# client config file.
|
347
|
-
#
|
348
|
-
# Example : plugin.metadata.license = Apache 2
|
349
|
-
def load_plugin_config_values
|
350
|
-
config = Config.instance
|
351
|
-
[:pluginname, :description, :author, :license, :version, :url, :timeout].each do |confoption|
|
352
|
-
configuration[confoption] = config.pluginconf["metadata.#{confoption}"] unless configuration[confoption]
|
353
|
-
end
|
354
|
-
end
|
355
|
-
|
356
204
|
def main
|
357
205
|
abort "No action specified, please run 'mco help plugin' for help" unless configuration.include?(:action)
|
358
206
|
|