Class: Vagrant::Puppet::Scp::Config
- Inherits:
-
Object
- Object
- Vagrant::Puppet::Scp::Config
- Defined in:
- lib/vagrant/puppet/scp/config.rb
Instance Attribute Summary collapse
-
#facter ⇒ Object
Returns the value of attribute facter.
-
#guest_path ⇒ Object
Returns the value of attribute guest_path.
-
#manifest_file ⇒ Object
Returns the value of attribute manifest_file.
-
#manifests_path ⇒ Object
Returns the value of attribute manifests_path.
-
#modules_path ⇒ Object
Returns the value of attribute modules_path.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #expanded_manifests_path(root_path) ⇒ Object
- #expanded_modules_path(root_path) ⇒ Object
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #manifests_guest_path ⇒ Object
- #modules_guest_path ⇒ Object
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vagrant/puppet/scp/config.rb', line 12 def initialize super @manifest_file = UNSET_VALUE @manifests_path = UNSET_VALUE @modules_path = UNSET_VALUE @guest_path = UNSET_VALUE @options = [] @facter = {} end |
Instance Attribute Details
#facter ⇒ Object
Returns the value of attribute facter.
10 11 12 |
# File 'lib/vagrant/puppet/scp/config.rb', line 10 def facter @facter end |
#guest_path ⇒ Object
Returns the value of attribute guest_path.
8 9 10 |
# File 'lib/vagrant/puppet/scp/config.rb', line 8 def guest_path @guest_path end |
#manifest_file ⇒ Object
Returns the value of attribute manifest_file.
5 6 7 |
# File 'lib/vagrant/puppet/scp/config.rb', line 5 def manifest_file @manifest_file end |
#manifests_path ⇒ Object
Returns the value of attribute manifests_path.
6 7 8 |
# File 'lib/vagrant/puppet/scp/config.rb', line 6 def manifests_path @manifests_path end |
#modules_path ⇒ Object
Returns the value of attribute modules_path.
7 8 9 |
# File 'lib/vagrant/puppet/scp/config.rb', line 7 def modules_path @modules_path end |
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/vagrant/puppet/scp/config.rb', line 9 def @options end |
Instance Method Details
#expanded_manifests_path(root_path) ⇒ Object
32 33 34 |
# File 'lib/vagrant/puppet/scp/config.rb', line 32 def (root_path) Pathname.new(manifests_path).(root_path) end |
#expanded_modules_path(root_path) ⇒ Object
36 37 38 |
# File 'lib/vagrant/puppet/scp/config.rb', line 36 def (root_path) Pathname.new(modules_path).(root_path) end |
#finalize! ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/vagrant/puppet/scp/config.rb', line 23 def finalize! super @manifest_file = 'default.pp' if @manifest_file == UNSET_VALUE @manifests_path = 'manifests' if @manifests_path == UNSET_VALUE @modules_path = 'modules' if @modules_path == UNSET_VALUE @guest_path = '/etc/puppet' if @guest_path == UNSET_VALUE end |
#manifests_guest_path ⇒ Object
40 41 42 |
# File 'lib/vagrant/puppet/scp/config.rb', line 40 def manifests_guest_path File.join(guest_path, 'manifests') end |
#modules_guest_path ⇒ Object
44 45 46 |
# File 'lib/vagrant/puppet/scp/config.rb', line 44 def modules_guest_path File.join(guest_path, 'modules') end |
#validate(machine) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/vagrant/puppet/scp/config.rb', line 48 def validate(machine) errors = [] # Calculate the manifests and module paths based on env = (machine.env.root_path) = (machine.env.root_path) # Manifests path/file validation # TODO: Provide vagrant.provisioners.puppet_scp translations. if !.directory? errors << I18n.t("vagrant.provisioners.puppet.manifests_path_missing", :path => ) else = .join(manifest_file) if !.file? errors << I18n.t("vagrant.provisioners.puppet.manifest_missing", :manifest => .to_s) end end # Module paths validation if !.directory? errors << I18n.t("vagrant.provisioners.puppet.module_path_missing", :path => path) end { "puppet_scp provisioner" => errors } end |