Class: Vagrant::Provisioners::Puppet::Config
- Inherits:
-
Config::Base
- Object
- Config::Base
- Vagrant::Provisioners::Puppet::Config
- Defined in:
- lib/vagrant/provisioners/puppet.rb
Instance Attribute Summary collapse
-
#manifest_file ⇒ Object
Returns the value of attribute manifest_file.
-
#manifests_path ⇒ Object
Returns the value of attribute manifests_path.
-
#module_path ⇒ Object
Returns the value of attribute module_path.
-
#options ⇒ Object
Returns the value of attribute options.
-
#pp_path ⇒ Object
Returns the value of attribute pp_path.
Attributes inherited from Config::Base
Instance Method Summary collapse
-
#computed_manifest_file ⇒ Object
Returns the manifest file if set otherwise returns the box name pp file which may or may not exist.
-
#expanded_manifests_path ⇒ Object
Returns the manifests path expanded relative to the root path of the environment.
-
#expanded_module_paths ⇒ Object
Returns the module paths as an array of paths expanded relative to the root path.
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(errors) ⇒ Object
Methods inherited from Config::Base
configures, #env, #instance_variables_hash, json_create, #set_options, #to_hash, #to_json
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
17 18 19 20 21 22 23 |
# File 'lib/vagrant/provisioners/puppet.rb', line 17 def initialize @manifest_file = nil @manifests_path = "manifests" @module_path = nil @pp_path = "/tmp/vagrant-puppet" @options = [] end |
Instance Attribute Details
#manifest_file ⇒ Object
Returns the value of attribute manifest_file.
11 12 13 |
# File 'lib/vagrant/provisioners/puppet.rb', line 11 def manifest_file @manifest_file end |
#manifests_path ⇒ Object
Returns the value of attribute manifests_path.
12 13 14 |
# File 'lib/vagrant/provisioners/puppet.rb', line 12 def manifests_path @manifests_path end |
#module_path ⇒ Object
Returns the value of attribute module_path.
13 14 15 |
# File 'lib/vagrant/provisioners/puppet.rb', line 13 def module_path @module_path end |
#options ⇒ Object
Returns the value of attribute options.
15 16 17 |
# File 'lib/vagrant/provisioners/puppet.rb', line 15 def @options end |
#pp_path ⇒ Object
Returns the value of attribute pp_path.
14 15 16 |
# File 'lib/vagrant/provisioners/puppet.rb', line 14 def pp_path @pp_path end |
Instance Method Details
#computed_manifest_file ⇒ Object
Returns the manifest file if set otherwise returns the box name pp file which may or may not exist.
33 34 35 |
# File 'lib/vagrant/provisioners/puppet.rb', line 33 def computed_manifest_file manifest_file || "#{top.vm.box}.pp" end |
#expanded_manifests_path ⇒ Object
Returns the manifests path expanded relative to the root path of the environment.
27 28 29 |
# File 'lib/vagrant/provisioners/puppet.rb', line 27 def Pathname.new(manifests_path).(env.root_path) end |
#expanded_module_paths ⇒ Object
Returns the module paths as an array of paths expanded relative to the root path.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vagrant/provisioners/puppet.rb', line 39 def return [] if !module_path # Get all the paths and expand them relative to the root path, returning # the array of expanded paths paths = module_path paths = [paths] if !paths.is_a?(Array) paths.map do |path| Pathname.new(path).(env.root_path) end end |
#validate(errors) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vagrant/provisioners/puppet.rb', line 51 def validate(errors) super # Manifests path/file validation if !.directory? errors.add(I18n.t("vagrant.provisioners.puppet.manifests_path_missing", :path => )) else if !.join(computed_manifest_file).file? errors.add(I18n.t("vagrant.provisioners.puppet.manifest_missing", :manifest => computed_manifest_file)) end end # Module paths validation .each do |path| if !path.directory? errors.add(I18n.t("vagrant.provisioners.puppet.module_path_missing", :path => path)) end end end |