choria-mcorpc-support 2.24.1 → 2.25.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/mcollective.rb CHANGED
@@ -43,7 +43,6 @@ module MCollective
43
43
  require "mcollective/log"
44
44
  require "mcollective/message"
45
45
  require "mcollective/optionparser"
46
- require "mcollective/generators"
47
46
  require "mcollective/pluginmanager"
48
47
  require "mcollective/pluginpackager"
49
48
  require "mcollective/rpc"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: choria-mcorpc-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.24.1
4
+ version: 2.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - R.I.Pienaar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2021-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu
@@ -37,6 +37,9 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0.6'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: 0.7.0
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,6 +47,9 @@ dependencies:
44
47
  - - "~>"
45
48
  - !ruby/object:Gem::Version
46
49
  version: '0.6'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: 0.7.0
47
53
  description: Libraries enabling Ruby support for the Choria Orchestration Server
48
54
  email: rip@devco.net
49
55
  executables:
@@ -57,6 +63,8 @@ files:
57
63
  - lib/mcollective/agent/bolt_tasks.ddl
58
64
  - lib/mcollective/agent/bolt_tasks.json
59
65
  - lib/mcollective/agent/bolt_tasks.rb
66
+ - lib/mcollective/agent/choria_provision.ddl
67
+ - lib/mcollective/agent/choria_provision.json
60
68
  - lib/mcollective/agent/choria_util.ddl
61
69
  - lib/mcollective/agent/choria_util.json
62
70
  - lib/mcollective/agent/rpcutil.ddl
@@ -118,12 +126,6 @@ files:
118
126
  - lib/mcollective/facts.rb
119
127
  - lib/mcollective/facts/base.rb
120
128
  - lib/mcollective/facts/yaml_facts.rb
121
- - lib/mcollective/generators.rb
122
- - lib/mcollective/generators/agent_generator.rb
123
- - lib/mcollective/generators/base.rb
124
- - lib/mcollective/generators/templates/action_snippet.erb
125
- - lib/mcollective/generators/templates/ddl.erb
126
- - lib/mcollective/generators/templates/plugin.erb
127
129
  - lib/mcollective/log.rb
128
130
  - lib/mcollective/logger.rb
129
131
  - lib/mcollective/logger/base.rb
@@ -1,50 +0,0 @@
1
- module MCollective
2
- module Generators
3
- class AgentGenerator < Base
4
- attr_accessor :ddl, :content
5
-
6
- def initialize(plugin_name, actions=[], 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
- @plugin_name = plugin_name
11
- @actions = actions || []
12
- @ddl = create_ddl
13
- @mod_name = "Agent"
14
- @pclass = "RPC::Agent"
15
- @content = create_plugin_content
16
- @plugin = create_plugin_string
17
- write_plugins
18
- end
19
-
20
- def create_ddl
21
- action_text = ""
22
- @actions.each_with_index do |action, i|
23
- action_text += "action \"#{action}\", :description => \"%ACTIONDESCRIPTION%\" do\n"
24
- action_text += action_help if i == 0
25
- action_text += "end\n"
26
- action_text += "\n" unless @actions.size == (i + 1)
27
- end
28
- # Use inherited method to create metadata part of the ddl
29
- create_metadata_string + action_text
30
- end
31
-
32
- def create_plugin_content
33
- content_text = ""
34
-
35
- # Add actions to agent file
36
- @actions.each_with_index do |action, i|
37
- content_text += "%6s%s" % [" ", "action \"#{action}\" do\n"]
38
- content_text += "%6s%s" % [" ", "end\n"]
39
- content_text += "\n" unless @actions.size == (i + 1)
40
- end
41
- content_text
42
- end
43
-
44
- def action_help
45
- action_snippet = File.read(File.join(File.dirname(__FILE__), "templates", "action_snippet.erb"))
46
- ERB.new(action_snippet).result
47
- end
48
- end
49
- end
50
- end
@@ -1,45 +0,0 @@
1
- module MCollective
2
- module Generators
3
- class Base
4
- attr_accessor :meta, :plugin_name, :mod_name
5
-
6
- def initialize(name, description, author, license, version, url, timeout)
7
- @meta = {:name => name,
8
- :description => description,
9
- :author => author,
10
- :license => license,
11
- :version => version,
12
- :url => url,
13
- :timeout => timeout}
14
- end
15
-
16
- def create_metadata_string
17
- ddl_template = File.read(File.join(File.dirname(__FILE__), "templates", "ddl.erb"))
18
- ERB.new(ddl_template, nil, "-").result(binding)
19
- end
20
-
21
- def create_plugin_string
22
- plugin_template = File.read(File.join(File.dirname(__FILE__), "templates", "plugin.erb"))
23
- ERB.new(plugin_template, nil, "-").result(binding)
24
- end
25
-
26
- def write_plugins
27
- Dir.mkdir @plugin_name
28
- dirname = File.join(@plugin_name, @mod_name.downcase)
29
- Dir.mkdir dirname
30
- puts "Created plugin directory : #{@plugin_name}"
31
-
32
- File.open(File.join(dirname, "#{@plugin_name}.ddl"), "w") {|f| f.puts @ddl}
33
- puts "Created DDL file : #{File.join(dirname, "#{@plugin_name}.ddl")}"
34
-
35
- File.open(File.join(dirname, "#{@plugin_name}.rb"), "w") {|f| f.puts @plugin}
36
- puts "Created #{@mod_name} file : #{File.join(dirname, "#{@plugin_name}.rb")}"
37
- rescue Errno::EEXIST
38
- raise "cannot generate '#{@plugin_name}' : plugin directory already exists."
39
- rescue Exception => e # rubocop:disable Lint/RescueException
40
- FileUtils.rm_rf(@plugin_name) if File.directory?(@plugin_name)
41
- raise "cannot generate plugin - #{e}"
42
- end
43
- end
44
- end
45
- end
@@ -1,13 +0,0 @@
1
- # Example Input
2
- input :name,
3
- :prompt => "%PROMPT%",
4
- :description => "%DESCRIPTION%",
5
- :type => %TYPE%,
6
- :validation => '%VALIDATION%',
7
- :optional => %OPTIONAL%,
8
- :maxlength => %MAXLENGTH%
9
-
10
- # Example output
11
- output :name,
12
- :description => "%DESCRIPTION%",
13
- :display_as => "%DISPLAYAS%"
@@ -1,8 +0,0 @@
1
- metadata :name => "<%= meta[:name] || "%FULLNANE%" -%>",
2
- :description => "<%= meta[:description] || "%DESCRIPTION%" -%>",
3
- :author => "<%= meta[:author] || "%AUTHOR%" -%>",
4
- :license => "<%= meta[:license] || "%LICENSE%" -%>",
5
- :version => "<%= meta[:version] || "%VERSION%" -%>",
6
- :url => "<%= meta[:url] || "%URL%" -%>",
7
- :timeout => <%= meta[:timeout] || "%TIMEOUT%" %>
8
-
@@ -1,7 +0,0 @@
1
- module MCollective
2
- module <%= @mod_name%>
3
- class <%= @plugin_name.capitalize -%><<%= @pclass%>
4
- <%= @content%>
5
- end
6
- end
7
- end
@@ -1,6 +0,0 @@
1
- module MCollective
2
- module Generators
3
- require "mcollective/generators/base"
4
- require "mcollective/generators/agent_generator"
5
- end
6
- end