Some CFEngine config validation

This commit is contained in:
Mitchell Hashimoto 2013-04-08 13:51:40 -07:00
parent c457285fb6
commit ae8e8830c4
2 changed files with 19 additions and 0 deletions

View File

@ -56,6 +56,19 @@ module VagrantPlugins
@yum_repo_url = "http://cfengine.com/pub/yum/"
end
end
def validate(machine)
errors = []
valid_modes = [:bootstrap, :singlerun]
errors << I18n.t("vagrant.cfengine_config.invalid_mode") if !valid_modes.include?(@mode)
if @mode == :bootstrap
errors << I18n.t("vagrant.cfengine_config.policy_server_address") if !@policy_server_address
end
{ "CFEngine" => errors }
end
end
end
end

View File

@ -11,6 +11,12 @@ en:
cfengine_no_bootstrap: |-
CFEngine doesn't require bootstrap. Not bootstrapping.
cfengine_config:
invalid_mode: |-
The mode must be 'bootstrap' or 'singlerun'
policy_server_address: |-
The policy server address must be set for bootstrapping.
general:
batch_unexpected_error: |-
An unexpected error ocurred when executing the action on the