Class: VagrantPlugins::DelphixEngine::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::DelphixEngine::Config
- Defined in:
- lib/vagrant-delphix/config.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#engine_password ⇒ Object
Returns the value of attribute engine_password.
-
#engine_url ⇒ Object
engine access.
-
#engine_user ⇒ Object
Returns the value of attribute engine_user.
-
#env_ip ⇒ Object
Returns the value of attribute env_ip.
-
#env_name ⇒ Object
env definition.
-
#env_port ⇒ Object
Returns the value of attribute env_port.
-
#password ⇒ Object
Returns the value of attribute password.
-
#staging ⇒ Object
Returns the value of attribute staging.
-
#toolkit_path ⇒ Object
Returns the value of attribute toolkit_path.
-
#trace ⇒ Object
Returns the value of attribute trace.
-
#user ⇒ Object
Returns the value of attribute user.
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.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vagrant-delphix/config.rb', line 25 def initialize @enabled = UNSET_VALUE @engine_url = UNSET_VALUE @engine_user = UNSET_VALUE @engine_password = UNSET_VALUE @env_name = UNSET_VALUE @env_ip = UNSET_VALUE @env_port = UNSET_VALUE @user = UNSET_VALUE @password = UNSET_VALUE @toolkit_path = UNSET_VALUE @staging = UNSET_VALUE @trace = UNSET_VALUE end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
8 9 10 |
# File 'lib/vagrant-delphix/config.rb', line 8 def enabled @enabled end |
#engine_password ⇒ Object
Returns the value of attribute engine_password.
14 15 16 |
# File 'lib/vagrant-delphix/config.rb', line 14 def engine_password @engine_password end |
#engine_url ⇒ Object
engine access
12 13 14 |
# File 'lib/vagrant-delphix/config.rb', line 12 def engine_url @engine_url end |
#engine_user ⇒ Object
Returns the value of attribute engine_user.
13 14 15 |
# File 'lib/vagrant-delphix/config.rb', line 13 def engine_user @engine_user end |
#env_ip ⇒ Object
Returns the value of attribute env_ip.
18 19 20 |
# File 'lib/vagrant-delphix/config.rb', line 18 def env_ip @env_ip end |
#env_name ⇒ Object
env definition
17 18 19 |
# File 'lib/vagrant-delphix/config.rb', line 17 def env_name @env_name end |
#env_port ⇒ Object
Returns the value of attribute env_port.
19 20 21 |
# File 'lib/vagrant-delphix/config.rb', line 19 def env_port @env_port end |
#password ⇒ Object
Returns the value of attribute password.
21 22 23 |
# File 'lib/vagrant-delphix/config.rb', line 21 def password @password end |
#staging ⇒ Object
Returns the value of attribute staging.
23 24 25 |
# File 'lib/vagrant-delphix/config.rb', line 23 def staging @staging end |
#toolkit_path ⇒ Object
Returns the value of attribute toolkit_path.
22 23 24 |
# File 'lib/vagrant-delphix/config.rb', line 22 def toolkit_path @toolkit_path end |
#trace ⇒ Object
Returns the value of attribute trace.
9 10 11 |
# File 'lib/vagrant-delphix/config.rb', line 9 def trace @trace end |
#user ⇒ Object
Returns the value of attribute user.
20 21 22 |
# File 'lib/vagrant-delphix/config.rb', line 20 def user @user end |
Instance Method Details
#finalize! ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vagrant-delphix/config.rb', line 40 def finalize! @enabled = false if @enabled == UNSET_VALUE @engine_url = nil if @engine_url == UNSET_VALUE @engine_user = nil if @engine_user == UNSET_VALUE @engine_password = nil if @engine_password == UNSET_VALUE @env_name = nil if @env_name == UNSET_VALUE @env_ip = nil if @env_ip == UNSET_VALUE @env_port = 22 if @env_port == UNSET_VALUE @user = nil if @user == UNSET_VALUE @password = nil if @password == UNSET_VALUE @toolkit_path = nil if @toolkit_path == UNSET_VALUE @staging = false if @staging == UNSET_VALUE @trace = false if @trace == UNSET_VALUE end |
#validate(machine) ⇒ Object
55 56 57 58 59 60 61 62 63 64 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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/vagrant-delphix/config.rb', line 55 def validate(machine) errors = [] errors << validate_bool('delphix.enabled', @enabled) if @enabled # check if all values are present and of the correct type if machine.config.delphix.staging.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.staging', }) else v = validate_bool('delphix.staging', machine.config.delphix.staging) errors << v if v != nil end if machine.config.delphix.user.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.user', }) else if !machine.config.delphix.user.nil? && !machine.config.delphix.user.kind_of?(String) errors << I18n.t('vagrant_delphix.config.not_a_string', { :config_key => 'delphix.user', :is_class => user.class.to_s, }) end end if machine.config.delphix.password.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.password', }) else if !machine.config.delphix.password.nil? && !machine.config.delphix.password.kind_of?(String) errors << I18n.t('vagrant_delphix.config.not_a_string', { :config_key => 'delphix.password', :is_class => password.class.to_s, }) end end if machine.config.delphix.toolkit_path.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.toolkit_path', }) else if !machine.config.delphix.toolkit_path.nil? && !machine.config.delphix.toolkit_path.kind_of?(String) errors << I18n.t('vagrant_delphix.config.not_a_string', { :config_key => 'delphix.toolkit_path', :is_class => toolkit_path.class.to_s, }) end end if machine.config.delphix.env_name.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.env_name', }) else if !machine.config.delphix.env_name.nil? && !machine.config.delphix.env_name.kind_of?(String) errors << I18n.t('vagrant_delphix.config.not_a_string', { :config_key => 'delphix.env_name', :is_class => env_name.class.to_s, }) end end if machine.config.delphix.env_ip.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.env_ip', }) else if !machine.config.delphix.env_ip.nil? && !machine.config.delphix.env_ip.kind_of?(String) errors << I18n.t('vagrant_delphix.config.not_a_string', { :config_key => 'delphix.env_ip', :is_class => env_ip.class.to_s, }) end end if machine.config.delphix.env_port.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.env_port', }) else if !machine.config.delphix.env_port.nil? && !machine.config.delphix.env_port.kind_of?(Fixnum) errors << I18n.t('vagrant_delphix.config.not_a_number', { :config_key => 'delphix.env_port', :is_class => env_ip.class.to_s, }) end end if machine.config.delphix.engine_url.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.engine_url', }) else if !machine.config.delphix.engine_url.nil? && !machine.config.delphix.engine_url.kind_of?(String) errors << I18n.t('vagrant_delphix.config.not_a_string', { :config_key => 'delphix.engine_url', :is_class => engine_url.class.to_s, }) end end if machine.config.delphix.engine_user.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.engine_user', }) else if !machine.config.delphix.engine_user.nil? && !machine.config.delphix.engine_user.kind_of?(String) errors << I18n.t('vagrant_delphix.config.not_a_string', { :config_key => 'delphix.engine_user', :is_class => engine_user.class.to_s, }) end end if machine.config.delphix.engine_password.nil? errors << I18n.t('vagrant_delphix.config.not_defined', { :config_key => 'delphix.engine_password', }) else if !machine.config.delphix.engine_password.kind_of?(String) errors << I18n.t('vagrant_delphix.config.not_a_string', { :config_key => 'delphix.engine_password', :is_class => engine_password.class.to_s, }) end end end errors.compact! { "Delphix configuration" => errors } end |