diff --git a/plugins/provisioners/cfengine/config.rb b/plugins/provisioners/cfengine/config.rb index 3dcbce906..ccfbdd671 100644 --- a/plugins/provisioners/cfengine/config.rb +++ b/plugins/provisioners/cfengine/config.rb @@ -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 diff --git a/templates/locales/en.yml b/templates/locales/en.yml index a4ea3d8da..ac2151974 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -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