mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
Some checks failed
/ sync-acceptance (push) Has been cancelled
Vagrant Ruby Tests / Vagrant unit tests on Ruby 3.1 (push) Has been cancelled
Vagrant Ruby Tests / Vagrant unit tests on Ruby 3.2 (push) Has been cancelled
Vagrant Ruby Tests / Vagrant unit tests on Ruby 3.3 (push) Has been cancelled
Vagrant Ruby Tests / Vagrant unit tests on Ruby 3.4 (push) Has been cancelled
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
37 lines
1.3 KiB
Ruby
37 lines
1.3 KiB
Ruby
# Copyright IBM Corp. 2010, 2025
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
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
|