Class: VagrantPlugins::SecuredCloud::Configuration::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/secured-cloud-vagrant/configs/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



16
17
18
19
20
21
# File 'lib/secured-cloud-vagrant/configs/config.rb', line 16

def initialize
  
  @vm = VirtualMachine.new
  @auth = AuthenticationInfo.new
  
end

Instance Attribute Details

#authObject

Returns the value of attribute auth.



13
14
15
# File 'lib/secured-cloud-vagrant/configs/config.rb', line 13

def auth
  @auth
end

#vmObject

Returns the value of attribute vm.



12
13
14
# File 'lib/secured-cloud-vagrant/configs/config.rb', line 12

def vm
  @vm
end

Instance Method Details

#finalize!Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/secured-cloud-vagrant/configs/config.rb', line 67

def finalize!
  
  if (@vm == UNSET_VALUE || @vm == nil)
    @vm = VirtualMachine.new
  else
    @vm.finalize!
  end
  
  if (@auth == UNSET_VALUE || @auth == nil)
    @auth = VirtualMachine.new
  else
    @auth.finalize!
  end
  
end

#merge(other) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/secured-cloud-vagrant/configs/config.rb', line 44

def merge(other)
  
  super.tap do |result|
  
    if(other.vm == UNSET_VALUE || other.vm.nil?)
      result.vm = @vm
    elsif @vm == UNSET_VALUE || @vm.nil?
      result.vm = other.vm
    else
      result.vm = @vm.merge(other.vm)
    end
  
    if(other.auth == UNSET_VALUE || other.auth.nil?)
      result.auth = @auth
    elsif @auth == UNSET_VALUE || @auth.nil?
      result.auth = other.auth
    else
      result.auth = @auth.merge(other.auth)
    end
  
  end
end

#validate(machine) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/secured-cloud-vagrant/configs/config.rb', line 23

def validate(machine)
  
  errors = _detected_errors
  
  # Validate the VM only if we don't specifically specify otherwise
  if @vm.nil?
     errors << "The VM properties must be properly defined "
  else
     @vm.validate(machine)
  end
  
  if @auth.nil?
    errors << "The authentication properties must be properly defined "
  else
    @auth.validate(machine)
  end
  
  { "Secured Cloud Provider" => errors}
  
end