choria-mcorpc-support 2.26.3 → 2.26.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3afcdee832e60d663bb3b6191631a315dfa017297620227c73fec431acaec163
4
- data.tar.gz: a643991b5feb3f8f19ab71c3ff66a4cef89dd1f0c1208882ef12fcddeec037d5
3
+ metadata.gz: 618794d9d7f198e7f4cc53e8367aaeddaa938fb6a6c7b2180c55fe14b767c68d
4
+ data.tar.gz: dbfc72f95e4ec3af2e8a7292bd7ec19ed5dd9d00d5d8b2d97f2ecafdd93e46a5
5
5
  SHA512:
6
- metadata.gz: d85ba1e2515ef6282ac3c2d62c0612987d187f1539a30533c6c5da5389c60fd61aec7be8741934ecb3fcf717f681817e1cf606c9e8d38ec7a8699ea6a2a81dbc
7
- data.tar.gz: cba939b5c47ead81430299df123f4e779cda4c1116e36ebef2e25bb420e21c761818a6045f8d97447b5b3fc82201edbf45ef72a2ef471b2b6f6344084f751421
6
+ metadata.gz: dcc0cc84a7f5c6a6a0a48ca454db2b68b658d353d0485dbfa71faa48c47d3a575d4505716bb8d53b4f735622910ae313c0caf14e2d770533bebcbc8dfc5638d8
7
+ data.tar.gz: 463adc38db69e4b905d8cdb46719eca031f1a4fe82c0c35ccc8098edc88725dd8aa7fe1e0d3c409d0b40c3467332ee8ed6c04c02831cd2c2a78cce686e74fc8e
@@ -1,12 +1,8 @@
1
- -- Copyright (c) 2024, R.I. Pienaar and the Choria Project contributors
2
- --
3
- -- SPDX-License-Identifier: Apache-2.0
4
-
5
1
  metadata :name => "aaa_signer",
6
2
  :description => "Request Signer for Choria AAA Service",
7
3
  :author => "R.I.Pienaar <rip@devco.net>",
8
4
  :license => "Apache-2.0",
9
- :version => "0.28.0",
5
+ :version => "0.29.4",
10
6
  :url => "https://github.com/choria-io/aaasvc",
11
7
  :provider => "golang",
12
8
  :service => true,
@@ -5,7 +5,7 @@
5
5
  "author": "R.I.Pienaar \u003crip@devco.net\u003e",
6
6
  "timeout": 10,
7
7
  "name": "aaa_signer",
8
- "version": "0.28.0",
8
+ "version": "0.29.4",
9
9
  "url": "https://github.com/choria-io/aaasvc",
10
10
  "description": "Request Signer for Choria AAA Service",
11
11
  "provider": "golang",
@@ -1,16 +1,8 @@
1
- -- Copyright (c) 2024, R.I. Pienaar and the Choria Project contributors
2
- --
3
- -- SPDX-License-Identifier: Apache-2.0
4
-
5
- -- Copyright (c) 2024, R.I. Pienaar and the Choria Project contributors
6
- --
7
- -- SPDX-License-Identifier: Apache-2.0
8
-
9
1
  metadata :name => "choria_provision",
10
2
  :description => "Choria Provisioner",
11
3
  :author => "R.I.Pienaar <rip@devco.net>",
12
4
  :license => "Apache-2.0",
13
- :version => "0.28.0",
5
+ :version => "0.29.4",
14
6
  :url => "https://choria.io",
15
7
  :timeout => 20
16
8
 
@@ -5,7 +5,7 @@
5
5
  "description": "Choria Provisioner",
6
6
  "author": "R.I.Pienaar <rip@devco.net>",
7
7
  "license": "Apache-2.0",
8
- "version": "0.28.0",
8
+ "version": "0.29.4",
9
9
  "url": "https://choria.io",
10
10
  "timeout": 20
11
11
  },
@@ -1,12 +1,8 @@
1
- -- Copyright (c) 2024, R.I. Pienaar and the Choria Project contributors
2
- --
3
- -- SPDX-License-Identifier: Apache-2.0
4
-
5
1
  metadata :name => "choria_registry",
6
2
  :description => "Choria Registry Service",
7
3
  :author => "rip@devco.net <rip@devco.net>",
8
4
  :license => "Apache-2.0",
9
- :version => "0.28.0",
5
+ :version => "0.29.4",
10
6
  :url => "https://choria.io",
11
7
  :provider => "golang",
12
8
  :service => true,
@@ -5,7 +5,7 @@
5
5
  "author": "rip@devco.net \u003crip@devco.net\u003e",
6
6
  "timeout": 2,
7
7
  "name": "choria_registry",
8
- "version": "0.28.0",
8
+ "version": "0.29.4",
9
9
  "url": "https://choria.io",
10
10
  "description": "Choria Registry Service",
11
11
  "provider": "golang",
@@ -1,12 +1,8 @@
1
- -- Copyright (c) 2024, R.I. Pienaar and the Choria Project contributors
2
- --
3
- -- SPDX-License-Identifier: Apache-2.0
4
-
5
1
  metadata :name => "choria_util",
6
2
  :description => "Choria Utilities",
7
3
  :author => "R.I.Pienaar <rip@devco.net>",
8
4
  :license => "Apache-2.0",
9
- :version => "0.28.0",
5
+ :version => "0.29.4",
10
6
  :url => "https://choria.io",
11
7
  :timeout => 2
12
8
 
@@ -5,7 +5,7 @@
5
5
  "description": "Choria Utilities",
6
6
  "author": "R.I.Pienaar <rip@devco.net>",
7
7
  "license": "Apache-2.0",
8
- "version": "0.28.0",
8
+ "version": "0.29.4",
9
9
  "url": "https://choria.io",
10
10
  "timeout": 2
11
11
  },
@@ -1,12 +1,8 @@
1
- -- Copyright (c) 2024, R.I. Pienaar and the Choria Project contributors
2
- --
3
- -- SPDX-License-Identifier: Apache-2.0
4
-
5
1
  metadata :name => "rpcutil",
6
2
  :description => "Utility actions that expose information about the state of the running Server",
7
3
  :author => "R.I.Pienaar <rip@devco.net>",
8
4
  :license => "Apache-2.0",
9
- :version => "0.28.0",
5
+ :version => "0.29.4",
10
6
  :url => "https://choria.io/",
11
7
  :timeout => 2
12
8
 
@@ -5,7 +5,7 @@
5
5
  "description": "Utility actions that expose information about the state of the running Server",
6
6
  "author": "R.I.Pienaar <rip@devco.net>",
7
7
  "license": "Apache-2.0",
8
- "version": "0.28.0",
8
+ "version": "0.29.4",
9
9
  "url": "https://choria.io/",
10
10
  "timeout": 2
11
11
  },
@@ -1,12 +1,8 @@
1
- -- Copyright (c) 2024, R.I. Pienaar and the Choria Project contributors
2
- --
3
- -- SPDX-License-Identifier: Apache-2.0
4
-
5
1
  metadata :name => "scout",
6
2
  :description => "Choria Scout Agent Management API",
7
3
  :author => "R.I.Pienaar <rip@devco.net>",
8
4
  :license => "Apache-2.0",
9
- :version => "0.28.0",
5
+ :version => "0.29.4",
10
6
  :url => "https://choria.io",
11
7
  :provider => "golang",
12
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.28.0",
8
+ "version": "0.29.4",
9
9
  "url": "https://choria.io",
10
10
  "description": "Choria Scout Agent Management API",
11
11
  "provider": "golang"
@@ -15,6 +15,7 @@ module MCollective
15
15
  @config.loadconfig(options[:config]) unless @config.configured
16
16
  @options = options
17
17
  @connection_timeout = options[:connection_timeout]
18
+ @config.federations = options[:federations] if options[:federations]
18
19
  else
19
20
  raise "Invalid parameter passed to Client constructor. Valid types are Hash or String"
20
21
  end
@@ -3,7 +3,7 @@ module MCollective
3
3
  class Config
4
4
  include Singleton
5
5
 
6
- attr_accessor :mode
6
+ attr_accessor :mode, :federations
7
7
 
8
8
  attr_reader :daemonize, :pluginconf, :configured, :logfile, :keeplogs, :max_log_size, :loglevel, :logfacility,
9
9
  :identity, :connector, :securityprovider, :factsource, :registration, :registerinterval, :classesfile,
@@ -112,7 +112,7 @@ module MCollective
112
112
  when "default_batch_sleep_time"
113
113
  @default_batch_sleep_time = Float(val)
114
114
  else
115
- # server config might now be choria config which will divirge from mcollective
115
+ # server config might now be choria config which will diverge from mcollective
116
116
  # in time, so we only raise this error when it looks like we aren't loading
117
117
  # a server config else we try our best to load as much as we can
118
118
  raise("Unknown config parameter '#{key}'") unless configfile =~ /server/
@@ -231,6 +231,7 @@ module MCollective
231
231
  @connection_timeout = nil
232
232
  @default_batch_size = 0
233
233
  @default_batch_sleep_time = 1
234
+ @federations = []
234
235
  end
235
236
 
236
237
  def libdir
@@ -52,11 +52,11 @@ module MCollective
52
52
  unless template == "metadata-help.erb"
53
53
  metadata_template = Util.templatepath("metadata-help.erb")
54
54
  metadata_template = File.read(metadata_template)
55
- metastring = ERB.new(metadata_template, 0, "%")
55
+ metastring = ERB.new(metadata_template, trim_mode: "%") # rubocop:disable Style/HashSyntax
56
56
  metastring = metastring.result(binding)
57
57
  end
58
58
 
59
- erb = ERB.new(template, 0, "%")
59
+ erb = ERB.new(template, trim_mode: "%") # rubocop:disable Style/HashSyntax
60
60
  erb.result(binding)
61
61
  end
62
62
 
@@ -11,7 +11,7 @@ module MCollective
11
11
  # :timeout => 2
12
12
  #
13
13
  # discovery do
14
- # capabilities [:classes, :facts, :identity, :agents, :compound]
14
+ # capabilities [:classes, :facts, :identity, :agents, :compound, :federations]
15
15
  # end
16
16
  class DiscoveryDDL < Base
17
17
  def discovery_interface
@@ -25,10 +25,10 @@ module MCollective
25
25
  raise "Discovery plugin capabilities can't be empty" if caps.empty?
26
26
 
27
27
  caps.each do |cap|
28
- if [:classes, :facts, :identity, :agents, :compound].include?(cap)
28
+ if [:classes, :facts, :identity, :agents, :compound, :federations].include?(cap)
29
29
  @entities[:discovery][:capabilities] << cap
30
30
  else
31
- raise "%s is not a valid capability, valid capabilities are :classes, :facts, :identity, :agents and :compound" % cap
31
+ raise "%s is not a valid capability, valid capabilities are :classes, :facts, :identity, :agents, :compound, and :federations" % cap
32
32
  end
33
33
  end
34
34
  end
@@ -6,6 +6,8 @@ module MCollective
6
6
  end
7
7
 
8
8
  def self.discover(filter, timeout, limit, client)
9
+ @config = Config.instance
10
+
9
11
  raise("Cannot find the choria binary in your path") unless Util.command_in_path?("choria")
10
12
 
11
13
  cmd = [binary_name, "discover", "-j", "--silent"]
@@ -37,6 +39,8 @@ module MCollective
37
39
  cmd << "-S" << c.first["expr"]
38
40
  end
39
41
 
42
+ cmd << "--federations" << @config.federations.join(",") unless @config.federations.empty?
43
+
40
44
  client.options.fetch(:discovery_options, []).each do |opt|
41
45
  cmd << "--do" << opt
42
46
  end
@@ -7,7 +7,7 @@ metadata :name => "external",
7
7
  :timeout => 2
8
8
 
9
9
  discovery do
10
- capabilities [:classes, :facts, :identity, :agents, :compound]
10
+ capabilities [:classes, :facts, :identity, :agents, :compound, :federations]
11
11
  end
12
12
 
13
13
 
@@ -186,6 +186,10 @@ module MCollective
186
186
  @parser.on("--connection-timeout TIMEOUT", Integer, "Set the timeout for establishing a connection to the middleware") do |v|
187
187
  @options[:connection_timeout] = Integer(v)
188
188
  end
189
+
190
+ @parser.on("--federations FEDERATIONS", String, "Target federations") do |v|
191
+ @options[:federations] = String(v).split(",")
192
+ end
189
193
  end
190
194
 
191
195
  private
@@ -171,7 +171,7 @@ module MCollective
171
171
  def self.const_missing(const_name)
172
172
  super unless const_name == :DDL
173
173
 
174
- Log.warn("MCollective::RPC::DDL is deprecatd, please use MCollective::DDL instead")
174
+ Log.warn("MCollective::RPC::DDL is deprecated, please use MCollective::DDL instead")
175
175
  MCollective::DDL
176
176
  end
177
177
  end
@@ -176,6 +176,8 @@ module MCollective
176
176
  signature = base64_decode(signature) if base64
177
177
 
178
178
  @public_key.verify(OpenSSL::Digest.new("SHA1"), signature, string)
179
+ rescue
180
+ false
179
181
  end
180
182
 
181
183
  # base 64 encode a string
@@ -97,7 +97,9 @@ module MCollective
97
97
  #
98
98
  # @return [Array<String>]
99
99
  def federation_collectives
100
- if override_networks = env_fetch("CHORIA_FED_COLLECTIVE", nil)
100
+ if !@config.federations.empty?
101
+ @config.federations
102
+ elsif (override_networks = env_fetch("CHORIA_FED_COLLECTIVE", nil))
101
103
  override_networks.split(",").map(&:strip).reject(&:empty?)
102
104
  else
103
105
  get_option("choria.federation.collectives", "").split(",").map(&:strip).reject(&:empty?)
@@ -9,6 +9,7 @@ module MCollective
9
9
  @facts = []
10
10
  @classes = []
11
11
  @identity = []
12
+ @federations = []
12
13
  @compound = nil
13
14
  end
14
15
 
@@ -64,6 +65,17 @@ module MCollective
64
65
  # @param data [Hash] input data matching nodes.json schema
65
66
  # @return [McollectiveNodes]
66
67
  def from_hash(data)
68
+ @config = Config.instance
69
+
70
+ # Allow specifying federations at playbook execution time
71
+ if data["federations"]
72
+ if data["federations"].instance_of?(String)
73
+ @config.federations = [data["federations"]]
74
+ else
75
+ @config.federations = data["federations"]
76
+ end
77
+ end
78
+
67
79
  @discovery_method = data.fetch("discovery_method", "mc")
68
80
  @agents = data.fetch("agents", ["rpcutil"])
69
81
  @facts = data.fetch("facts", [])
@@ -73,15 +73,21 @@ module MCollective
73
73
 
74
74
  def run
75
75
  https = choria.https(:target => "slack.com", :port => 443)
76
- path = "/api/chat.postMessage?token=%s&username=%s&channel=%s&icon_url=%s&attachments=%s" % [
77
- CGI.escape(@token),
78
- CGI.escape(@username),
79
- CGI.escape(@channel),
80
- CGI.escape(@icon),
81
- CGI.escape(attachments.to_json)
82
- ]
76
+ path = "/api/chat.postMessage"
77
+ headers = {
78
+ "Content-type" => "application/json; charset=utf-8",
79
+ "Authorization" => "Bearer %s" % @token
80
+ }
81
+ params = {
82
+ "username" => @username,
83
+ "channel" => @channel,
84
+ "icon_url" => @icon,
85
+ "attachments" => attachments
86
+ }
87
+ post = choria.http_post(path, headers)
88
+ post.body = params.to_json
83
89
 
84
- resp, data = https.request(choria.http_get(path))
90
+ resp, data = https.request(post)
85
91
  data = JSON.parse(data || resp.body)
86
92
 
87
93
  if resp.code == "200" && data["ok"]
@@ -218,7 +218,7 @@ module MCollective
218
218
  def create_request_spooldir(requestid, task)
219
219
  dir = request_spooldir(requestid)
220
220
 
221
- FileUtils.mkdir_p(dir, :mode => 0o0750)
221
+ FileUtils.mkdir_p(dir, mode: 0o0750) # rubocop:disable Style/HashSyntax
222
222
 
223
223
  populate_spooldir(dir, task)
224
224
 
@@ -235,7 +235,7 @@ module MCollective
235
235
 
236
236
  spool_filename = File.join(spooldir, "files", filename)
237
237
 
238
- FileUtils.mkdir_p(File.dirname(spool_filename), :mode => 0o0750)
238
+ FileUtils.mkdir_p(File.dirname(spool_filename), mode: 0o0750) # rubocop:disable Style/HashSyntax
239
239
  FileUtils.cp(task_file_name(file), spool_filename)
240
240
  end
241
241
  end
@@ -718,7 +718,7 @@ module MCollective
718
718
  http_get(path, "Accept" => "application/octet-stream") do |resp|
719
719
  raise("Failed to request task content %s: %s: %s" % [path, resp.code, resp.body]) unless resp.code == "200"
720
720
 
721
- FileUtils.mkdir_p(cache_dir, :mode => 0o0750)
721
+ FileUtils.mkdir_p(cache_dir, mode: 0o0750) # rubocop:disable Style/HashSyntax
722
722
  FileUtils.rm_rf(file_name) if File.directory?(file_name)
723
723
 
724
724
  task_file = Tempfile.new("tasks_%s" % file["filename"])
@@ -216,7 +216,8 @@ module MCollective
216
216
  :collective => nil,
217
217
  :discovery_method => nil,
218
218
  :discovery_options => Config.instance.default_discovery_options,
219
- :filter => empty_filter
219
+ :filter => empty_filter,
220
+ :federations => Config.instance.federations
220
221
  }
221
222
  end
222
223
 
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.26.3
4
+ version: 2.26.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - R.I.Pienaar
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-03 00:00:00.000000000 Z
11
+ date: 2024-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu
@@ -231,7 +231,7 @@ homepage: https://choria.io/
231
231
  licenses:
232
232
  - Apache-2.0
233
233
  metadata: {}
234
- post_install_message:
234
+ post_install_message:
235
235
  rdoc_options: []
236
236
  require_paths:
237
237
  - lib
@@ -246,9 +246,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  requirements: []
249
- rubyforge_project:
250
- rubygems_version: 2.7.6.2
251
- signing_key:
249
+ rubygems_version: 3.2.33
250
+ signing_key:
252
251
  specification_version: 4
253
252
  summary: Support libraries the Choria Server
254
253
  test_files: []