This file is indexed.

/usr/sbin/mc-call-agent is in mcollective-client 1.2.1+dfsg-2ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env ruby

require 'mcollective'
require 'pp'

oparser = MCollective::Optionparser.new({:verbose => true}, "filter")

options = oparser.parse{|parser, options|
    parser.define_head "Call an agent parsing an argument to it"
    parser.banner = "Usage: mc-call-agent [options] --agent agent --argument arg"

    parser.on('-a', '--agent AGENT', 'Agent to call') do |v|
        options[:agent] = v
    end

    parser.on('--arg', '--argument ARGUMENT', 'Argument to pass to agent') do |v|
        options[:argument] = v
    end
}

if options[:agent] == nil || options[:argument] == nil
    puts("Please use either --agent or --argument")
    exit 1
end

begin
    options[:filter]["agent"] << options[:agent]

    client = MCollective::Client.new(options[:config])
    client.options = options

    c = 0

    stats = client.discovered_req(options[:argument], options[:agent]) do |resp|
        next if resp == nil

        c += 1

        if options[:verbose]
            puts("#{resp[:senderid]}>")
            pp resp[:body]
        else
            puts if c % 4 == 1
            printf("%-30s", resp[:senderid])
        end
    end

    client.disconnect
rescue Exception => e
    STDERR.puts "Could not call remote agent: #{e}"
    exit 1
end

client.display_stats(stats)

# vi:tabstop=4:expandtab:ai