Add support for policy hub bootstrapping
This commit is contained in:
parent
5fb5a60bfa
commit
67917353b7
|
@ -3,6 +3,7 @@ require "vagrant"
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CFEngine
|
module CFEngine
|
||||||
class Config < Vagrant.plugin("2", :config)
|
class Config < Vagrant.plugin("2", :config)
|
||||||
|
attr_accessor :am_policy_hub
|
||||||
attr_accessor :extra_agent_args
|
attr_accessor :extra_agent_args
|
||||||
attr_accessor :classes
|
attr_accessor :classes
|
||||||
attr_accessor :deb_repo_file
|
attr_accessor :deb_repo_file
|
||||||
|
@ -18,6 +19,7 @@ module VagrantPlugins
|
||||||
attr_accessor :yum_repo_url
|
attr_accessor :yum_repo_url
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
|
@am_policy_hub = UNSET_VALUE
|
||||||
@classes = UNSET_VALUE
|
@classes = UNSET_VALUE
|
||||||
@deb_repo_file = UNSET_VALUE
|
@deb_repo_file = UNSET_VALUE
|
||||||
@deb_repo_line = UNSET_VALUE
|
@deb_repo_line = UNSET_VALUE
|
||||||
|
@ -34,6 +36,8 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def finalize!
|
def finalize!
|
||||||
|
@am_policy_hub = false if @am_policy_hub == UNSET_VALUE
|
||||||
|
|
||||||
@classes = nil if @classes == UNSET_VALUE
|
@classes = nil if @classes == UNSET_VALUE
|
||||||
|
|
||||||
if @deb_repo_file == UNSET_VALUE
|
if @deb_repo_file == UNSET_VALUE
|
||||||
|
|
|
@ -79,6 +79,14 @@ module VagrantPlugins
|
||||||
policy_server: policy_server_address))
|
policy_server: policy_server_address))
|
||||||
result = cfagent("--bootstrap --policy-server #{policy_server_address}", error_check: false)
|
result = cfagent("--bootstrap --policy-server #{policy_server_address}", error_check: false)
|
||||||
raise Vagrant::Errors::CFEngineBootstrapFailed if result != 0
|
raise Vagrant::Errors::CFEngineBootstrapFailed if result != 0
|
||||||
|
|
||||||
|
# Policy hubs need to do additional things before they're ready
|
||||||
|
# to accept agents. Force that run now...
|
||||||
|
if @config.am_policy_hub
|
||||||
|
@machine.ui.info(I18n.t("vagrant.cfengine_bootstrapping_policy_hub"))
|
||||||
|
cfagent("-KI -f /var/cfengine/masterfiles/failsafe.cf#{cfagent_classes_args}")
|
||||||
|
cfagent("-KI #{cfagent_classes_args}#{cfagent_extra_args}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# This handles verifying the CFEngine installation, installing it
|
# This handles verifying the CFEngine installation, installing it
|
||||||
|
|
|
@ -2,6 +2,8 @@ en:
|
||||||
vagrant:
|
vagrant:
|
||||||
cfengine_bootstrapping: |-
|
cfengine_bootstrapping: |-
|
||||||
Bootstrapping CFEngine with policy server: %{policy_server}...
|
Bootstrapping CFEngine with policy server: %{policy_server}...
|
||||||
|
cfengine_bootstrapping_policy_hub: |-
|
||||||
|
Performing additional bootstrap for policy hubs...
|
||||||
cfengine_cant_detect: |-
|
cfengine_cant_detect: |-
|
||||||
Vagrant doesn't support detecting whether CFEngine is installed
|
Vagrant doesn't support detecting whether CFEngine is installed
|
||||||
for the guest OS running in the machine. Vagrant will assume it is
|
for the guest OS running in the machine. Vagrant will assume it is
|
||||||
|
|
Loading…
Reference in New Issue