run_file and single_run mode in CFEngine
This commit is contained in:
parent
ae8e8830c4
commit
c25ce9f732
|
@ -10,6 +10,8 @@ module VagrantPlugins
|
|||
attr_accessor :mode
|
||||
attr_accessor :policy_server_address
|
||||
attr_accessor :repo_gpg_key_url
|
||||
attr_accessor :run_file
|
||||
attr_accessor :upload_path
|
||||
attr_accessor :yum_repo_file
|
||||
attr_accessor :yum_repo_url
|
||||
|
||||
|
@ -21,6 +23,8 @@ module VagrantPlugins
|
|||
@mode = UNSET_VALUE
|
||||
@policy_server_address = UNSET_VALUE
|
||||
@repo_gpg_key_url = UNSET_VALUE
|
||||
@run_file = UNSET_VALUE
|
||||
@upload_path = UNSET_VALUE
|
||||
@yum_repo_file = UNSET_VALUE
|
||||
@yum_repo_url = UNSET_VALUE
|
||||
end
|
||||
|
@ -42,12 +46,16 @@ module VagrantPlugins
|
|||
@mode = :bootstrap if @mode == UNSET_VALUE
|
||||
@mode = @mode.to_sym
|
||||
|
||||
@run_file = nil if @run_file == UNSET_VALUE
|
||||
|
||||
@policy_server_address = nil if @policy_server_address == UNSET_VALUE
|
||||
|
||||
if @repo_gpg_key_url == UNSET_VALUE
|
||||
@repo_gpg_key_url = "http://cfengine.com/pub/gpg.key"
|
||||
end
|
||||
|
||||
@upload_path = "/tmp/vagrant-cfengine-file" if @upload_path == UNSET_VALUE
|
||||
|
||||
if @yum_repo_file == UNSET_VALUE
|
||||
@yum_repo_file = "/etc/yum.repos.d/cfengine-community.repo"
|
||||
end
|
||||
|
@ -60,7 +68,7 @@ module VagrantPlugins
|
|||
def validate(machine)
|
||||
errors = []
|
||||
|
||||
valid_modes = [:bootstrap, :singlerun]
|
||||
valid_modes = [:bootstrap, :single_run]
|
||||
errors << I18n.t("vagrant.cfengine_config.invalid_mode") if !valid_modes.include?(@mode)
|
||||
|
||||
if @mode == :bootstrap
|
||||
|
|
|
@ -11,6 +11,18 @@ module VagrantPlugins
|
|||
handle_cfengine_installation
|
||||
|
||||
handle_cfengine_bootstrap if @config.mode == :bootstrap
|
||||
|
||||
if @config.mode == :single_run
|
||||
# Just let people know
|
||||
@machine.ui.info(I18n.t("vagrant.cfengine_single_run"))
|
||||
end
|
||||
|
||||
if @config.run_file
|
||||
@machine.ui.info(I18n.t("vagrant.cfengine_single_run_execute"))
|
||||
path = Pathname.new(@config.run_file).expand_path(@machine.env.root_path)
|
||||
machine.communicate.upload(path.to_s, @config.upload_path)
|
||||
cfagent("-KI -f #{@config.upload_path}")
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -10,10 +10,14 @@ en:
|
|||
Installing CFEngine onto machine...
|
||||
cfengine_no_bootstrap: |-
|
||||
CFEngine doesn't require bootstrap. Not bootstrapping.
|
||||
cfengine_single_run: |-
|
||||
CFEngine running in "single run" mode. Will execute one file.
|
||||
cfengine_single_run_execute: |-
|
||||
Executing run file for CFEngine...
|
||||
|
||||
cfengine_config:
|
||||
invalid_mode: |-
|
||||
The mode must be 'bootstrap' or 'singlerun'
|
||||
The mode must be 'bootstrap' or 'single_run'
|
||||
policy_server_address: |-
|
||||
The policy server address must be set for bootstrapping.
|
||||
|
||||
|
|
Loading…
Reference in New Issue