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.
@@ -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": "General helpful actions that expose stats and internals to SimpleRPC clients",
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 License, Version 2.0",
8
- "version": "0.19.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
- "default": null
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
- "default": null
35
+ "type": "string"
36
36
  },
37
37
  "collectives": {
38
38
  "description": "All Collectives",
39
39
  "display_as": "All Collectives",
40
- "default": null
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 daemon",
60
+ "description": "List of threads active in the Choria Server",
61
61
  "display_as": "Threads",
62
- "default": null
62
+ "type": "array"
63
63
  },
64
64
  "agents": {
65
65
  "description": "List of agents loaded",
66
66
  "display_as": "Agents",
67
- "default": null
67
+ "type": "array"
68
68
  },
69
69
  "pid": {
70
- "description": "Process ID of the daemon",
70
+ "description": "Process ID of the Choria Server",
71
71
  "display_as": "PID",
72
- "default": null
72
+ "type": "integer"
73
73
  },
74
74
  "times": {
75
- "description": "Processor time consumed by the daemon",
75
+ "description": "Processor time consumed by the Choria Server",
76
76
  "display_as": "Times",
77
- "default": null
77
+ "type": "hash"
78
78
  },
79
79
  "validated": {
80
- "description": "Messages that passed security validation",
80
+ "description": "Count of messages that passed security validation",
81
81
  "display_as": "Security Validated",
82
- "default": null
82
+ "type": "integer"
83
83
  },
84
84
  "unvalidated": {
85
- "description": "Messages that failed security validation",
85
+ "description": "Count of messages that failed security validation",
86
86
  "display_as": "Failed Security",
87
- "default": null
87
+ "type": "integer"
88
88
  },
89
89
  "passed": {
90
- "description": "Passed filter checks",
90
+ "description": "Count of messages that passed filter checks",
91
91
  "display_as": "Passed Filter",
92
- "default": null
92
+ "type": "integer"
93
93
  },
94
94
  "filtered": {
95
- "description": "Didn't pass filter checks",
95
+ "description": "Count of message that didn't pass filter checks",
96
96
  "display_as": "Failed Filter",
97
- "default": null
97
+ "type": "integer"
98
98
  },
99
99
  "starttime": {
100
- "description": "Time the server started",
100
+ "description": "Time the Choria Server started in unix seconds",
101
101
  "display_as": "Start Time",
102
- "default": null
102
+ "type": "integer"
103
103
  },
104
104
  "total": {
105
- "description": "Total messages received",
105
+ "description": "Count of messages received by the Choria Server",
106
106
  "display_as": "Total Messages",
107
- "default": null
107
+ "type": "integer"
108
108
  },
109
109
  "replies": {
110
- "description": "Replies sent back to clients",
110
+ "description": "Count of replies sent back to clients",
111
111
  "display_as": "Replies",
112
- "default": null
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
- "default": null
117
+ "type": "string"
118
118
  },
119
119
  "version": {
120
- "description": "MCollective Version",
120
+ "description": "Choria Server Version",
121
121
  "display_as": "Version",
122
- "default": null
122
+ "type": "string"
123
123
  },
124
124
  "ttlexpired": {
125
- "description": "Messages that did pass TTL checks",
125
+ "description": "Count of messages that did pass TTL checks",
126
126
  "display_as": "TTL Expired",
127
- "default": null
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": 50
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
- "default": null
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
- "default": null
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
- "default": null
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
- "default": null
273
+ "type": "array"
278
274
  },
279
275
  "facts": {
280
276
  "description": "List of facts and values",
281
277
  "display_as": "Facts",
282
- "default": null
278
+ "type": "hash"
283
279
  },
284
280
  "classes": {
285
281
  "description": "List of classes on the system",
286
282
  "display_as": "Classes",
287
- "default": null
283
+ "type": "array"
288
284
  },
289
285
  "version": {
290
- "description": "MCollective Version",
286
+ "description": "Choria Server Version",
291
287
  "display_as": "Version",
292
- "default": null
288
+ "type": "string"
293
289
  },
294
290
  "main_collective": {
295
291
  "description": "The main Collective",
296
292
  "display_as": "Main Collective",
297
- "default": null
293
+ "type": "string"
298
294
  },
299
295
  "collectives": {
300
296
  "description": "All Collectives",
301
297
  "display_as": "All Collectives",
302
- "default": null
298
+ "type": "array"
303
299
  },
304
300
  "data_plugins": {
305
301
  "description": "List of data plugin names",
306
302
  "display_as": "Data Plugins",
307
- "default": null
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
- "default": null
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.1",
5
+ :version => "0.23.0",
6
6
  :url => "https://choria.io",
7
7
  :provider => "golang",
8
8
  :timeout => 5
@@ -5,7 +5,7 @@
5
5
  "author": "R.I.Pienaar <rip@devco.net>",
6
6
  "timeout": 5,
7
7
  "name": "scout",
8
- "version": "0.0.1",
8
+ "version": "0.23.0",
9
9
  "url": "https://choria.io",
10
10
  "description": "Choria Scout Agent Management API",
11
11
  "provider": "golang"
@@ -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 agent <pluginname> [actions=val,val]
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 rpmpackage or debpackage",
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
- raise "undefined plugin type. cannot generate plugin. valid types are 'agent'" if configuration["target"] == "."
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 # rubocop:disable Metrics/MethodLength
215
- known_plugin_types = [
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
- next unless help.client_activated?
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