Sha256: beacd8a078cd382a6c65a1ba2caffa4680047227e4b31ca5b1f887973a859e9a

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

Contents

require "log4r"

module VagrantPlugins
  module CFEngine
    module Cap
      module Linux
        module CFEngineNeedsBootstrap
          def self.cfengine_needs_bootstrap(machine, config)
            logger = Log4r::Logger.new("vagrant::plugins::cfengine::cap_linux_cfengine_bootstrap")

            machine.communicate.tap do |comm|
              # We hardcode fixing the permissions on /var/cfengine/ppkeys/, if it exists,
              # because otherwise CFEngine will fail to bootstrap.
              if comm.test("test -d /var/cfengine/ppkeys", :sudo => true)
                logger.debug("Fixing permissions on /var/cfengine/ppkeys")
                comm.sudo("chmod -R 600 /var/cfengine/ppkeys")
              end

              logger.debug("Checking if CFEngine is bootstrapped...")
              bootstrapped = comm.test("test -f /var/cfengine/policy_server.dat", :sudo => true)
              if bootstrapped && !config.force_bootstrap
                logger.info("CFEngine already bootstrapped, no need to do it again")
                return false
              end

              logger.info("CFEngine needs bootstrap.")
              return true
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
tnargav-1.3.6 plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
tnargav-1.3.3 plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
tnargav-1.2.3 plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb
tnargav-1.2.2 plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb