Class: VagrantConverge::Config::Guest
- Inherits:
-
Object
- Object
- VagrantConverge::Config::Guest
- Defined in:
- lib/vagrant-converge/config/guest.rb
Instance Attribute Summary collapse
-
#ca_file ⇒ Object
Returns the value of attribute ca_file.
-
#cert_file ⇒ Object
Returns the value of attribute cert_file.
-
#hcl ⇒ Object
Returns the value of attribute hcl.
-
#install ⇒ Object
Returns the value of attribute install.
-
#key_file ⇒ Object
Returns the value of attribute key_file.
-
#local ⇒ Object
Returns the value of attribute local.
-
#local_addr ⇒ Object
Returns the value of attribute local_addr.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#no_token ⇒ Object
Returns the value of attribute no_token.
-
#params ⇒ Object
Returns the value of attribute params.
-
#rpc_addr ⇒ Object
Returns the value of attribute rpc_addr.
-
#rpc_token ⇒ Object
Returns the value of attribute rpc_token.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Guest
constructor
A new instance of Guest.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Guest
Returns a new instance of Guest.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vagrant-converge/config/guest.rb', line 21 def initialize super @hcl = UNSET_VALUE @ca_file = UNSET_VALUE @cert_file = UNSET_VALUE @install = UNSET_VALUE @key_file = UNSET_VALUE @local = UNSET_VALUE @local_addr = UNSET_VALUE @log_level = UNSET_VALUE @no_token = UNSET_VALUE @params = UNSET_VALUE @rpc_addr = UNSET_VALUE @rpc_token = UNSET_VALUE @use_ssl = UNSET_VALUE @verbose = UNSET_VALUE @version = UNSET_VALUE end |
Instance Attribute Details
#ca_file ⇒ Object
Returns the value of attribute ca_file.
6 7 8 |
# File 'lib/vagrant-converge/config/guest.rb', line 6 def ca_file @ca_file end |
#cert_file ⇒ Object
Returns the value of attribute cert_file.
7 8 9 |
# File 'lib/vagrant-converge/config/guest.rb', line 7 def cert_file @cert_file end |
#hcl ⇒ Object
Returns the value of attribute hcl.
5 6 7 |
# File 'lib/vagrant-converge/config/guest.rb', line 5 def hcl @hcl end |
#install ⇒ Object
Returns the value of attribute install.
8 9 10 |
# File 'lib/vagrant-converge/config/guest.rb', line 8 def install @install end |
#key_file ⇒ Object
Returns the value of attribute key_file.
9 10 11 |
# File 'lib/vagrant-converge/config/guest.rb', line 9 def key_file @key_file end |
#local ⇒ Object
Returns the value of attribute local.
10 11 12 |
# File 'lib/vagrant-converge/config/guest.rb', line 10 def local @local end |
#local_addr ⇒ Object
Returns the value of attribute local_addr.
11 12 13 |
# File 'lib/vagrant-converge/config/guest.rb', line 11 def local_addr @local_addr end |
#log_level ⇒ Object
Returns the value of attribute log_level.
12 13 14 |
# File 'lib/vagrant-converge/config/guest.rb', line 12 def log_level @log_level end |
#no_token ⇒ Object
Returns the value of attribute no_token.
13 14 15 |
# File 'lib/vagrant-converge/config/guest.rb', line 13 def no_token @no_token end |
#params ⇒ Object
Returns the value of attribute params.
14 15 16 |
# File 'lib/vagrant-converge/config/guest.rb', line 14 def params @params end |
#rpc_addr ⇒ Object
Returns the value of attribute rpc_addr.
15 16 17 |
# File 'lib/vagrant-converge/config/guest.rb', line 15 def rpc_addr @rpc_addr end |
#rpc_token ⇒ Object
Returns the value of attribute rpc_token.
16 17 18 |
# File 'lib/vagrant-converge/config/guest.rb', line 16 def rpc_token @rpc_token end |
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
17 18 19 |
# File 'lib/vagrant-converge/config/guest.rb', line 17 def use_ssl @use_ssl end |
#verbose ⇒ Object
Returns the value of attribute verbose.
18 19 20 |
# File 'lib/vagrant-converge/config/guest.rb', line 18 def verbose @verbose end |
#version ⇒ Object
Returns the value of attribute version.
19 20 21 |
# File 'lib/vagrant-converge/config/guest.rb', line 19 def version @version end |
Instance Method Details
#finalize! ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/vagrant-converge/config/guest.rb', line 41 def finalize! @hcl = nil if @hcl == UNSET_VALUE @ca_file = nil if @ca_file == UNSET_VALUE @cert_file = nil if @cert_file == UNSET_VALUE @install = true if @install == UNSET_VALUE @key_file = nil if @key_file == UNSET_VALUE @local = true if @local == UNSET_VALUE @local_addr = nil if @local_addr == UNSET_VALUE @log_level = "INFO" if @log_level == UNSET_VALUE @no_token = nil if @no_token == UNSET_VALUE @params = nil if @params == UNSET_VALUE @rpc_addr = nil if @rpc_addr == UNSET_VALUE @rpc_token = nil if @rpc_token == UNSET_VALUE @use_ssl = false if @use_ssl == UNSET_VALUE @verbose = false if @verbose == UNSET_VALUE @version = :latest if @version == UNSET_VALUE # RPC connection takes precedence over local if @rpc_addr @local = false @local_addr = nil end end |
#validate(machine) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/vagrant-converge/config/guest.rb', line 65 def validate(machine) @errors = _detected_errors # Validate hcl values if !hcl @errors << I18n.t("vagrant.provisioners.converge.no_hcl") end if hcl hcl_is_valid = hcl.kind_of?(Array) || hcl.kind_of?(String) if hcl.kind_of?(String) @hcl = [ hcl ] end if !hcl_is_valid @errors << I18n.t("vagrant.provisioners.converge.invalid_hcl", type: hcl.class.to_s, value: hcl.to_s) end end # Validate params if provided if params if !params.kind_of?(Hash) @errors << I18n.t("vagrant.provisioners.converge.invalid_params", type: params.class.to_s, value: params.to_s) end end { "vagrant-converge" => @errors } end |