Class: VagrantPlugins::ChefApply::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::ChefApply::Config
- Defined in:
- lib/vagrant-chef-apply/config.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#upload_path ⇒ Object
Returns the value of attribute upload_path.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
7 8 9 10 |
# File 'lib/vagrant-chef-apply/config.rb', line 7 def initialize @path = UNSET_VALUE @upload_path = UNSET_VALUE end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/vagrant-chef-apply/config.rb', line 4 def path @path end |
#upload_path ⇒ Object
Returns the value of attribute upload_path.
5 6 7 |
# File 'lib/vagrant-chef-apply/config.rb', line 5 def upload_path @upload_path end |
Instance Method Details
#finalize! ⇒ Object
12 13 14 15 |
# File 'lib/vagrant-chef-apply/config.rb', line 12 def finalize! @path = nil if @path == UNSET_VALUE @upload_path = "/tmp/vagrant-chef-apply.rb" if @upload_path == UNSET_VALUE end |
#validate(machine) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vagrant-chef-apply/config.rb', line 17 def validate(machine) errors = _detected_errors # Validate that the parameters are properly set unless path errors << I18n.t("vagrant.provisioners.chef_apply.no_path_set") end # Validate the existence of a script to upload if path = Pathname.new(path).(machine.env.root_path) if !.file? errors << I18n.t("vagrant.provisioners.chef_apply.path_invalid", :path => ) end end # There needs to be a path to upload the script to if !upload_path errors << I18n.t("vagrant.provisioners.chef_apply.upload_path_not_set") end { "chef_apply provisioner" => errors } end |