Method: Puppetfactory::Plugins::R10k#initialize

Defined in:
lib/puppetfactory/plugins/r10k.rb

#initialize(options) ⇒ R10k

Returns a new instance of R10k.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/puppetfactory/plugins/r10k.rb', line 5

def initialize(options)
  super(options)

  @gitserver    = options[:gitserver]
  @repomodel    = options[:repomodel]
  @controlrepo  = options[:controlrepo]
  @environments = options[:environments]
  @r10k_config  = '/etc/puppetlabs/r10k/r10k.yaml'
  @pattern      = "#{@gitserver}/%s/#{@controlrepo}"

  # the rest of this method is for the big boys only
  return unless Process.euid == 0

  # in case this is the first run and it doesn't exist yet
  unless File.exist? @r10k_config
    File.open(@r10k_config, 'w') { |f| f.write({'sources' => {}}.to_yaml) }
  end
end