Sha256: df4390ab48453f843abf21a1e1355586bcf1188965108e3a4369a8277e61ba20

Contents?: true

Size: 893 Bytes

Versions: 3

Compression:

Stored size: 893 Bytes

Contents

module SystemBuilder

  class ProcConfigurator

    def initialize(proc = nil, &block)
      @proc = (proc or block)
    end

    def configure(chroot)
      @proc.call chroot
    end

  end

  class PuppetConfigurator

    attr_reader :manifest

    def initialize(manifest = ".")
      @manifest = manifest
    end

    def configure(chroot)
      puts "* run puppet configuration"

      chroot.apt_install :puppet
      chroot.image.open("/etc/default/puppet") do |f|
        f.puts "START=no"
      end

      unless File.directory?(manifest)
        chroot.image.install "/tmp/puppet.pp", manifest
        chroot.sudo "puppet tmp/puppet.pp"
      else
        chroot.image.mkdir "/tmp/puppet"

        chroot.image.rsync "/tmp/puppet", "#{manifest}/manifests", "#{manifest}/files", :exclude => "*~"
        chroot.sudo "puppet tmp/puppet/manifests/site.pp"
      end
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
system-builder-0.0.6 lib/system_builder/configurator.rb
system-builder-0.0.5 lib/system_builder/configurator.rb
system-builder-0.0.4 lib/system_builder/configurator.rb