Class: VagrantPlugins::BundleWrap::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



10
11
12
13
14
15
16
# File 'lib/vagrant-bundlewrap/config.rb', line 10

def initialize
  @repo_path = UNSET_VALUE
  @node_name = UNSET_VALUE
  @node_host = UNSET_VALUE
  @interactive = UNSET_VALUE
  @debug = UNSET_VALUE
end

Instance Attribute Details

#debugObject

Returns the value of attribute debug.



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

def debug
  @debug
end

#interactiveObject

Returns the value of attribute interactive.



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

def interactive
  @interactive
end

#node_hostObject

Returns the value of attribute node_host.



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

def node_host
  @node_host
end

#node_nameObject

Returns the value of attribute node_name.



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

def node_name
  @node_name
end

#repo_pathObject

Returns the value of attribute repo_path.



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

def repo_path
  @repo_path
end

Instance Method Details

#finalize!Object



18
19
20
21
22
23
24
# File 'lib/vagrant-bundlewrap/config.rb', line 18

def finalize!
  @repo_path = "bundlewrap/" if @repo_path == UNSET_VALUE
  @node_name = nil if @node_name == UNSET_VALUE
  @node_host = nil if @node_host == UNSET_VALUE
  @debug = false if @debug == UNSET_VALUE
  @interactive = false if @interactive == UNSET_VALUE
end

#validate(machine) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/vagrant-bundlewrap/config.rb', line 26

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 << "BundleWrap repository is missing in repo_path='#{repo_path}'.\n" +
          "  Create a new one with 'bw repo create'."
  end

  unless @node_name
      errors << "BundleWrap config 'node_name' is not set. Use the node name from your BundleWrap nodes.py."
  end

  unless @node_host
      errors << "BundleWrap config 'node_host' is not set. Use the node host from your BundleWrap 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-bundlewrap" => errors }
end