From b279f222a2b5f2925705383bf7461e64cbf11367 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 8 Apr 2013 15:02:33 -0700 Subject: [PATCH] run_file path validation for CFEngine --- plugins/provisioners/cfengine/config.rb | 7 +++++++ templates/locales/en.yml | 2 ++ 2 files changed, 9 insertions(+) diff --git a/plugins/provisioners/cfengine/config.rb b/plugins/provisioners/cfengine/config.rb index a0a67f37f..83f1c473b 100644 --- a/plugins/provisioners/cfengine/config.rb +++ b/plugins/provisioners/cfengine/config.rb @@ -91,6 +91,13 @@ module VagrantPlugins errors << I18n.t("vagrant.cfengine_config.classes_array") end + if @run_file + expanded = Pathname.new(@run_file).expand_path(machine.env.root_path) + if !expanded.file? + errors << I18n.t("vagrant.cfengine_config.run_file_not_found") + end + end + { "CFEngine" => errors } end end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index fde268dc2..820d41bcb 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -24,6 +24,8 @@ en: The mode must be 'bootstrap' or 'single_run' policy_server_address: |- The policy server address must be set for bootstrapping. + run_file_not_found: |- + The 'run_file' specified could not be found. general: batch_unexpected_error: |-