This file is indexed.

/usr/lib/ruby/vendor_ruby/berkshelf/api/srv_ctl.rb is in berkshelf-api 2.2.0-1.

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

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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
require 'optparse'
require 'buff/extensions'

module Berkshelf
  module API
    class SrvCtl
      class << self
        # @param [Array] args
        #
        # @return [Hash]
        def parse_options(args, filename)
          options = Hash.new

          OptionParser.new("Usage: #{filename} [options]") do |opts|
            opts.on("-h", "--host HOST", String, "set the listening address") do |h|
              options[:host] = h
            end

            opts.on("-p", "--port PORT", Integer, "set the listening port") do |v|
              options[:port] = v
            end

            opts.on("-V", "--verbose", "run with verbose output") do
              options[:log_level] = "INFO"
            end

            opts.on("-d", "--debug", "run with debug output") do
              options[:log_level] = "DEBUG"
            end

            opts.on("-q", "--quiet", "silence output") do
              options[:log_location] = '/dev/null'
            end

            opts.on("-c", "--config FILE", String, "path to a configuration file to use") do |v|
              options[:config_file] = v
            end

            opts.on("-v", "--version", "show version") do |v|
              require 'berkshelf/api/version'
              puts Berkshelf::API::VERSION
              exit
            end

            opts.on_tail("-h", "--help", "show this message") do
              puts opts
              exit
            end
          end.parse!(args)

          options.symbolize_keys
        end

        # @param [Array] args
        # @param [String] filename
        def run(args, filename)
          options = parse_options(args, filename)
          new(options).start
        end
      end

      attr_reader :options

      # @param [Hash] options
      #   @see {Berkshelf::API::Application.run} for the list of valid options
      def initialize(options = {})
        @options               = options
        @options[:eager_build] = true
      end

      def start
        require 'berkshelf/api'
        Berkshelf::API::Application.run(options)
      end
    end
  end
end