Class: Vagrant::ChefConfig::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-chefconfig/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



7
8
9
10
11
# File 'lib/vagrant-chefconfig/config.rb', line 7

def initialize
  super
  @enabled = UNSET_VALUE
  @knife_config_path = UNSET_VALUE
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



4
5
6
# File 'lib/vagrant-chefconfig/config.rb', line 4

def enabled
  @enabled
end

#knife_config_pathObject

Returns the value of attribute knife_config_path.



5
6
7
# File 'lib/vagrant-chefconfig/config.rb', line 5

def knife_config_path
  @knife_config_path
end

Instance Method Details

#finalize!Object



13
14
15
16
# File 'lib/vagrant-chefconfig/config.rb', line 13

def finalize!
  @enabled = true if @enabled == UNSET_VALUE
  @knife_config_path = nil if @knife_config_path == UNSET_VALUE
end

#validate(machine) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vagrant-chefconfig/config.rb', line 18

def validate(machine)
  errors =[]

  if @enabled
    if @knife_config_path && !File.exists?(@knife_config_path)
      errors << "chefconfig.knife_config_path file '#{@knife_config_path}' not found" 
    end
  end

  { "chefconfig" => errors }
end