Specify extra args for the cf-agent call

This commit is contained in:
Mitchell Hashimoto 2013-04-08 14:27:27 -07:00
parent 292bada134
commit 28432fc813
2 changed files with 15 additions and 1 deletions

View File

@ -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 :extra_agent_args
attr_accessor :classes attr_accessor :classes
attr_accessor :deb_repo_file attr_accessor :deb_repo_file
attr_accessor :deb_repo_line attr_accessor :deb_repo_line
@ -20,6 +21,7 @@ module VagrantPlugins
@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
@extra_agent_args = UNSET_VALUE
@force_bootstrap = UNSET_VALUE @force_bootstrap = UNSET_VALUE
@install = UNSET_VALUE @install = UNSET_VALUE
@mode = UNSET_VALUE @mode = UNSET_VALUE
@ -42,6 +44,8 @@ module VagrantPlugins
@deb_repo_line = "deb http://cfengine.com/pub/apt $(lsb_release -cs) main" @deb_repo_line = "deb http://cfengine.com/pub/apt $(lsb_release -cs) main"
end end
@extra_agent_args = nil if @extra_agent_args == UNSET_VALUE
@force_bootstrap = false if @force_bootstrap == UNSET_VALUE @force_bootstrap = false if @force_bootstrap == UNSET_VALUE
@install = true if @install == UNSET_VALUE @install = true if @install == UNSET_VALUE

View File

@ -21,7 +21,7 @@ module VagrantPlugins
@machine.ui.info(I18n.t("vagrant.cfengine_single_run_execute")) @machine.ui.info(I18n.t("vagrant.cfengine_single_run_execute"))
path = Pathname.new(@config.run_file).expand_path(@machine.env.root_path) path = Pathname.new(@config.run_file).expand_path(@machine.env.root_path)
machine.communicate.upload(path.to_s, @config.upload_path) machine.communicate.upload(path.to_s, @config.upload_path)
cfagent("-KI -f #{@config.upload_path}#{cfagent_classes_args}") cfagent("-KI -f #{@config.upload_path}#{cfagent_classes_args}#{cfagent_extra_args}")
end end
end end
@ -46,6 +46,8 @@ module VagrantPlugins
# Returns the arguments for the classes configuration if they are # Returns the arguments for the classes configuration if they are
# set. # set.
#
# @return [String]
def cfagent_classes_args def cfagent_classes_args
return "" if !@config.classes return "" if !@config.classes
@ -53,6 +55,14 @@ module VagrantPlugins
return " #{args}" return " #{args}"
end end
# Extra arguments for calles to cf-agent.
#
# @return [String]
def cfagent_extra_args
return "" if !@config.extra_agent_args
return " #{@config.extra_agent_args}"
end
# This handles checking if the CFEngine installation needs to # This handles checking if the CFEngine installation needs to
# be bootstrapped, and bootstraps if it does. # be bootstrapped, and bootstraps if it does.
def handle_cfengine_bootstrap def handle_cfengine_bootstrap