Class: VagrantHiera::Config

Inherits:
Vagrant::Config::Base
  • Object
show all
Defined in:
lib/vagrant-hiera/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#config_fileObject

Returns the value of attribute config_file.



6
7
8
# File 'lib/vagrant-hiera/config.rb', line 6

def config_file
  @config_file
end

#config_pathObject

Returns the value of attribute config_path.



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

def config_path
  @config_path
end

#data_pathObject

Returns the value of attribute data_path.



7
8
9
# File 'lib/vagrant-hiera/config.rb', line 7

def data_path
  @data_path
end

#guest_config_pathObject

Returns the value of attribute guest_config_path.



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

def guest_config_path
  @guest_config_path
end

#guest_data_pathObject

Returns the value of attribute guest_data_path.



8
9
10
# File 'lib/vagrant-hiera/config.rb', line 8

def guest_data_path
  @guest_data_path
end

Instance Method Details

#set?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/vagrant-hiera/config.rb', line 26

def set?
  config_path || config_file || data_path
end

#validate(env, errors) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/vagrant-hiera/config.rb', line 30

def validate(env, errors)
  errors.add("Config path can not be empty.") if config_path.nil?
  errors.add("Config file can not be empty.") if config_file.nil?
  errors.add("Data path can not be empty.") if data_path.nil?
  config = File.join("#{config_path}", "#{config_file}")
  errors.add("Config file not found at '#{config}'.") unless File.exists?(config)
  errors.add("Data directory not found at '#{data_path}'.") unless File.exists?("#{data_path}")
end