Class: VagrantPlugins::Blockwart::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Blockwart::Config
- Defined in:
- lib/vagrant-blockwart/config.rb
Instance Attribute Summary collapse
-
#interactive ⇒ Object
Returns the value of attribute interactive.
-
#node_host ⇒ Object
Returns the value of attribute node_host.
-
#node_name ⇒ Object
Returns the value of attribute node_name.
-
#repo_path ⇒ Object
Returns the value of attribute repo_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.
10 11 12 13 14 15 |
# File 'lib/vagrant-blockwart/config.rb', line 10 def initialize @repo_path = UNSET_VALUE @node_name = UNSET_VALUE @node_host = UNSET_VALUE @interactive = UNSET_VALUE end |
Instance Attribute Details
#interactive ⇒ Object
Returns the value of attribute interactive.
7 8 9 |
# File 'lib/vagrant-blockwart/config.rb', line 7 def interactive @interactive end |
#node_host ⇒ Object
Returns the value of attribute node_host.
6 7 8 |
# File 'lib/vagrant-blockwart/config.rb', line 6 def node_host @node_host end |
#node_name ⇒ Object
Returns the value of attribute node_name.
5 6 7 |
# File 'lib/vagrant-blockwart/config.rb', line 5 def node_name @node_name end |
#repo_path ⇒ Object
Returns the value of attribute repo_path.
4 5 6 |
# File 'lib/vagrant-blockwart/config.rb', line 4 def repo_path @repo_path end |
Instance Method Details
#finalize! ⇒ Object
17 18 19 20 21 22 |
# File 'lib/vagrant-blockwart/config.rb', line 17 def finalize! @repo_path = "blockwart/" if @repo_path == UNSET_VALUE @node_name = nil if @node_name == UNSET_VALUE @node_host = nil if @node_host == UNSET_VALUE @interactive = false if @interactive == UNSET_VALUE end |
#validate(machine) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vagrant-blockwart/config.rb', line 24 def validate(machine) errors = _detected_errors unless File.directory?(repo_path) and File.exist?("#{repo_path}/nodes.py") and File.exist?("#{repo_path}/groups.py") errors << "Blockwart repository is missing in repo_path='#{repo_path}'.\n" + " Create a new one with 'bw repo create'." end unless @node_name errors << "Blockwart config 'node_name' is not set. Use the node name from your blockwart nodes.py." end unless @node_host errors << "Blockwart config 'node_host' is not set. Use the node host from your blockwart nodes.py.\n" + " This does not have to be a valid host name (e.g. 'node1.vm'), but it should be a unique one,\n" + " because it will be written in your ssh config file." end { "vagrant-blockwart" => errors } end |