Module: Puppet::X::Jenkins::Type::Cli

Defined in:
lib/puppet/x/jenkins/type/cli.rb

Class Method Summary collapse

Class Method Details

.newtype(*args, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/puppet/x/jenkins/type/cli.rb', line 7

def self.newtype(*args, &block)
  type = Puppet::Type.newtype(*args, &block)

  # The jenkins master needs to be avaiable in order to interact with it via
  # the cli jar.
  type.autorequire(:service) do
    ['jenkins']
  end

  # If a file resource is declared for file path params, make sure that it's
  # converged so we can read it off disk.
  type.autorequire(:file) do
    config = Puppet::X::Jenkins::Config.new(catalog)

    autos = []
    %w[ssh_private_key puppet_helper cli_jar].each do |param|
      value = config[param.to_sym]
      autos << value unless value.nil?
    end

    autos
  end
end