choria-mcorpc-support 2.23.2 → 2.23.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mcollective.rb +1 -1
- data/lib/mcollective/application/facts.rb +2 -67
- data/lib/mcollective/util/tasks_support.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73c63dbc1dacba7b90acdba3141cfedd3731da11
|
4
|
+
data.tar.gz: 42cfc48d721f69b6ec805e71624a8b8cff0fc141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f5370f390815f5881473b6c0e482db4f821f88ecb2616e33af9aa29a91e1561f1306b24945b1df2fe9d7ad05f8f770908298cb9279ae6dedb90658906654454
|
7
|
+
data.tar.gz: 250ca8bb59baccda7324a4f21f7db4f938c6fc06cdfe968f46263e0fe11ba55214d237dda44a5db0243500007a8ffec856e336880334d5e0df3d2e53903499a9
|
data/lib/mcollective.rb
CHANGED
@@ -1,71 +1,6 @@
|
|
1
1
|
class MCollective::Application::Facts < MCollective::Application # rubocop:disable Style/ClassAndModuleChildren
|
2
2
|
description "Reports on usage for a specific fact"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
def validate_configuration(configuration)
|
9
|
-
raise "Please specify a fact to report for" unless configuration.include?(:fact)
|
10
|
-
end
|
11
|
-
|
12
|
-
def show_single_fact_report(fact, facts, verbose=false)
|
13
|
-
puts("Report for fact: #{fact}\n\n")
|
14
|
-
|
15
|
-
facts = stringify_facts_hash(facts)
|
16
|
-
|
17
|
-
field_size = MCollective::Util.field_size(facts.keys)
|
18
|
-
facts.keys.sort.each do |k|
|
19
|
-
printf(" %-#{field_size}s found %d times\n", k, facts[k].size)
|
20
|
-
|
21
|
-
next unless verbose
|
22
|
-
|
23
|
-
puts
|
24
|
-
|
25
|
-
facts[k].sort.each do |f|
|
26
|
-
puts(" #{f}")
|
27
|
-
end
|
28
|
-
|
29
|
-
puts
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def stringify_facts_hash(facts)
|
34
|
-
res = Hash.new([])
|
35
|
-
facts.each { |k, v| res[k.to_s] += v }
|
36
|
-
res
|
37
|
-
end
|
38
|
-
|
39
|
-
def main
|
40
|
-
rpcutil = rpcclient("rpcutil")
|
41
|
-
rpcutil.progress = false
|
42
|
-
|
43
|
-
facts = {}
|
44
|
-
|
45
|
-
rpcutil.get_fact(:fact => configuration[:fact]) do |resp|
|
46
|
-
begin
|
47
|
-
value = resp[:body][:data][:value].to_s
|
48
|
-
|
49
|
-
if resp[:body][:data].include?(:value)
|
50
|
-
if facts.include?(value)
|
51
|
-
facts[value] << resp[:senderid]
|
52
|
-
else
|
53
|
-
facts[value] = [resp[:senderid]]
|
54
|
-
end
|
55
|
-
end
|
56
|
-
rescue Exception => e # rubocop:disable Lint/RescueException
|
57
|
-
warn "Could not parse facts for #{resp[:senderid]}: #{e.class}: #{e}"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
if facts.empty?
|
62
|
-
puts "No values found for fact #{configuration[:fact]}\n"
|
63
|
-
else
|
64
|
-
show_single_fact_report(configuration[:fact], facts, options[:verbose])
|
65
|
-
end
|
66
|
-
|
67
|
-
printrpcstats
|
68
|
-
|
69
|
-
halt rpcutil.stats
|
70
|
-
end
|
4
|
+
external(:command => "choria", :args => ["facts"])
|
5
|
+
external_help(:command => "choria", :args => ["facts", "--help"])
|
71
6
|
end
|
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.23.
|
4
|
+
version: 2.23.3
|
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-01-
|
11
|
+
date: 2021-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|