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.
Files changed (49) hide show
  1. checksums.yaml +5 -5
  2. data/lib/mcollective.rb +3 -2
  3. data/lib/mcollective/agent/choria_util.ddl +206 -107
  4. data/lib/mcollective/agent/choria_util.json +101 -1
  5. data/lib/mcollective/agent/rpcutil.json +2 -3
  6. data/lib/mcollective/agent/scout.json +107 -135
  7. data/lib/mcollective/application/facts.rb +2 -67
  8. data/lib/mcollective/application/find.rb +1 -1
  9. data/lib/mcollective/application/plugin.rb +2 -15
  10. data/lib/mcollective/client.rb +1 -1
  11. data/lib/mcollective/config.rb +135 -103
  12. data/lib/mcollective/ddl.rb +0 -1
  13. data/lib/mcollective/discovery.rb +11 -63
  14. data/lib/mcollective/discovery/broadcast.ddl +11 -0
  15. data/lib/mcollective/discovery/choria.ddl +6 -4
  16. data/lib/mcollective/discovery/delegate.ddl +13 -0
  17. data/lib/mcollective/discovery/delegate.rb +73 -0
  18. data/lib/mcollective/discovery/external.ddl +13 -0
  19. data/lib/mcollective/discovery/file.ddl +13 -0
  20. data/lib/mcollective/discovery/flatfile.ddl +7 -5
  21. data/lib/mcollective/discovery/inventory.ddl +13 -0
  22. data/lib/mcollective/discovery/mc.ddl +3 -3
  23. data/lib/mcollective/generators.rb +0 -1
  24. data/lib/mcollective/optionparser.rb +1 -1
  25. data/lib/mcollective/pluginpackager/forge_packager.rb +1 -1
  26. data/lib/mcollective/rpc/client.rb +4 -2
  27. data/lib/mcollective/util.rb +25 -35
  28. data/lib/mcollective/util/tasks_support.rb +15 -2
  29. metadata +9 -23
  30. data/lib/mcollective/data.rb +0 -96
  31. data/lib/mcollective/data/agent_data.ddl +0 -22
  32. data/lib/mcollective/data/agent_data.rb +0 -17
  33. data/lib/mcollective/data/base.rb +0 -68
  34. data/lib/mcollective/data/bolt_task_data.ddl +0 -90
  35. data/lib/mcollective/data/bolt_task_data.rb +0 -32
  36. data/lib/mcollective/data/collective_data.ddl +0 -20
  37. data/lib/mcollective/data/collective_data.rb +0 -9
  38. data/lib/mcollective/data/fact_data.ddl +0 -28
  39. data/lib/mcollective/data/fact_data.rb +0 -55
  40. data/lib/mcollective/data/fstat_data.ddl +0 -89
  41. data/lib/mcollective/data/fstat_data.rb +0 -54
  42. data/lib/mcollective/data/result.rb +0 -50
  43. data/lib/mcollective/ddl/dataddl.rb +0 -56
  44. data/lib/mcollective/discovery/choria.rb +0 -223
  45. data/lib/mcollective/discovery/flatfile.rb +0 -47
  46. data/lib/mcollective/discovery/stdin.ddl +0 -11
  47. data/lib/mcollective/discovery/stdin.rb +0 -67
  48. data/lib/mcollective/generators/data_generator.rb +0 -50
  49. data/lib/mcollective/generators/templates/data_input_snippet.erb +0 -7
@@ -1,67 +0,0 @@
1
- # discovers against stdin instead of the traditional network discovery
2
- # the input must be a flat file with a node name per line which should match identities as configured,
3
- # or it should be a json string as output by the -j option of mco rpc
4
- require "mcollective/rpc/helpers"
5
-
6
- module MCollective
7
- class Discovery
8
- class Stdin
9
- def self.discover(filter, timeout, limit=0, client=nil)
10
- if client.options[:discovery_options].empty?
11
- type = "auto"
12
- else
13
- type = client.options[:discovery_options].first.downcase
14
- end
15
-
16
- discovered = []
17
-
18
- file = $stdin.read
19
-
20
- raise("data piped on STDIN contained only whitespace - could not discover hosts from it.") if file =~ /^\s*$/
21
-
22
- if type == "auto"
23
- if file =~ /^\s*\[/
24
- type = "json"
25
- else
26
- type = "text"
27
- end
28
- end
29
-
30
- Log.debug("Parsing STDIN input as type %s" % type)
31
-
32
- case type
33
- when "json"
34
- hosts = RPC::Helpers.extract_hosts_from_json(file)
35
- when "text"
36
- hosts = file.split("\n")
37
- else
38
- raise("stdin discovery plugin only knows the types auto/text/json, not \"#{type}\"")
39
- end
40
-
41
- hosts.map do |host|
42
- raise 'Identities can only match /\w\.\-/' unless host.match(/^[\w.\-]+$/)
43
-
44
- host
45
- end
46
-
47
- # this plugin only supports identity filters, do regex matches etc against
48
- # the list found in the flatfile
49
- if filter["identity"].empty?
50
- discovered = hosts
51
- else
52
- filter["identity"].each do |identity|
53
- identity = Regexp.new(identity.gsub("\/", "")) if identity.match("^/")
54
-
55
- if identity.is_a?(Regexp)
56
- discovered = hosts.grep(identity)
57
- elsif hosts.include?(identity)
58
- discovered << identity
59
- end
60
- end
61
- end
62
-
63
- discovered
64
- end
65
- end
66
- end
67
- end
@@ -1,50 +0,0 @@
1
- module MCollective
2
- module Generators
3
- class DataGenerator < Base
4
- attr_accessor :ddl, :content
5
-
6
- def initialize(plugin_name, outputs=[], name=nil, description=nil, author=nil,
7
- license=nil, version=nil, url=nil, timeout=nil)
8
-
9
- super(name, description, author, license, version, url, timeout)
10
- @mod_name = "Data"
11
- @pclass = "Base"
12
- @plugin_name = plugin_name
13
- @outputs = outputs
14
- @ddl = create_ddl
15
- @content = create_plugin_content
16
- @plugin = create_plugin_string
17
- write_plugins
18
- end
19
-
20
- def create_ddl
21
- query_text = "dataquery :description => \"Query information\" do\n"
22
- query_text += ERB.new(File.read(File.join(File.dirname(__FILE__), "templates", "data_input_snippet.erb"))).result
23
-
24
- @outputs.each_with_index do |output, i|
25
- query_text += "%2s%s" % [" ", "output :#{output},\n"]
26
- query_text += "%9s%s" % [" ", ":description => \"%DESCRIPTION%\",\n"]
27
- query_text += "%9s%s" % [" ", ":display_as => \"%DESCRIPTION%\"\n"]
28
- query_text += "\n" unless @outputs.size == (i + 1)
29
- end
30
-
31
- query_text += "end"
32
-
33
- # Use inherited method to create metadata part of the ddl
34
- create_metadata_string + query_text
35
- end
36
-
37
- def create_plugin_content
38
- content_text = "%6s%s" % [" ", "query do |what|\n"]
39
-
40
- @outputs.each do |output|
41
- content_text += "%8s%s" % [" ", "result[:#{output}] = nil\n"]
42
- end
43
- content_text += "%6s%s" % [" ", "end\n"]
44
-
45
- # Add actions to agent file
46
- content_text
47
- end
48
- end
49
- end
50
- end
@@ -1,7 +0,0 @@
1
- input :query,
2
- :prompt => "%PROMP%",
3
- :description => "%DESCRIPTION%",
4
- :type => %TYPE%,
5
- :validation => %VALIDATION%,
6
- :maxlength => %MAXLENGTH%
7
-