Module: Buratino::Hg

Defined in:
lib/buratino/hg.rb

Class Method Summary collapse

Class Method Details

.process(config) ⇒ Object



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

def self.process(config)
  puts "DEBUG BURATINO::HG::PROCESS"
  @cmd_options = {}

  case config['mode']
    when 'clone'
      Mercurial::Repository.clone( config['puppet'] , config['destination'], @cmd_options)
    when 'update'
      puppet_repos = Mercurial::Repository.open( config['destination'] ) 
      puppet_repos.pull( 'default', '--update')

    else
      puts "Wrong mode!!!"

  end

  # In future:
  # puppet = Pupapi.new <- Puppet Api
  # puppet.apply( :module_path => '#{@destination}/modules', :debug => true, :verbose => true, :manifest => '#{@destination}/manifests/site.pp')

  # Ugly(((
  puts "DEBUG BURATINO::HG::PUPPET_APPLY"
  puppet = `export FACTER_fqdn=#{config['fqdn']}; #{Gem.bindir}/puppet apply --modulepath=#{config['destination']}/modules #{config['destination']}/manifests/site.pp`
end