Class: VagrantPlugins::WindowsDomain::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::WindowsDomain::Config
- Defined in:
- lib/vagrant-windows-domain/config.rb
Overview
The “Configuration” represents a configuration of how the WindowsDomain provisioner should behave: authentication mechanism etc.
Instance Attribute Summary collapse
-
#computer_name ⇒ Object
The new Computer Name to use when joining the domain.
-
#domain ⇒ Object
The Windows Domain to join.
-
#join_options ⇒ Object
The set of Advanced options to pass when joining the Domain.
-
#ou_path ⇒ Object
Organisational Unit path in AD.
-
#password ⇒ Object
The Password to use when authenticating against the Domain.
-
#rename ⇒ Object
The trigger whether plugin should rename the computer or omit the renaming.
-
#unsecure ⇒ Object
Performs an unsecure join to the specified domain.
-
#username ⇒ Object
The Username to use when authenticating against the Domain.
Instance Method Summary collapse
-
#finalize! ⇒ Object
Final step of the Configuration lifecyle prior to validation.
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#validate(machine) ⇒ Hash
Validate configuration and return a hash of errors.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/vagrant-windows-domain/config.rb', line 51 def initialize super @domain = UNSET_VALUE @computer_name = UNSET_VALUE @username = UNSET_VALUE @password = UNSET_VALUE @join_options = {} @ou_path = UNSET_VALUE @unsecure = UNSET_VALUE @rename = UNSET_VALUE @logger = Log4r::Logger.new("vagrant::vagrant_windows_domain") end |
Instance Attribute Details
#computer_name ⇒ Object
The new Computer Name to use when joining the domain. Specifies a new name for the computer in the new domain. Uses the -NameName Option.
17 18 19 |
# File 'lib/vagrant-windows-domain/config.rb', line 17 def computer_name @computer_name end |
#domain ⇒ Object
The Windows Domain to join.
Setting this will result in an additional restart.
13 14 15 |
# File 'lib/vagrant-windows-domain/config.rb', line 13 def domain @domain end |
#join_options ⇒ Object
The set of Advanced options to pass when joining the Domain.
See (technet.microsoft.com/en-us/library/hh849798.aspx) for detail. NOTE: If we user :computer_name from above this needs to be merged!!
34 35 36 |
# File 'lib/vagrant-windows-domain/config.rb', line 34 def @join_options end |
#ou_path ⇒ Object
Organisational Unit path in AD.
Specifies an organizational unit (OU) for the domain account. Enter the full distinguished name of the OU in quotation marks. The default value is the default OU for machine objects in the domain.
41 42 43 |
# File 'lib/vagrant-windows-domain/config.rb', line 41 def ou_path @ou_path end |
#password ⇒ Object
The Password to use when authenticating against the Domain.
Specifies the password of a user account that has permission to join the computers to a new domain.
28 29 30 |
# File 'lib/vagrant-windows-domain/config.rb', line 28 def password @password end |
#rename ⇒ Object
The trigger whether plugin should rename the computer or omit the renaming
49 50 51 |
# File 'lib/vagrant-windows-domain/config.rb', line 49 def rename @rename end |
#unsecure ⇒ Object
Performs an unsecure join to the specified domain.
When this option is used username/password are not required
46 47 48 |
# File 'lib/vagrant-windows-domain/config.rb', line 46 def unsecure @unsecure end |
#username ⇒ Object
The Username to use when authenticating against the Domain.
Specifies a user account that has permission to join the computers to a new domain.
22 23 24 |
# File 'lib/vagrant-windows-domain/config.rb', line 22 def username @username end |
Instance Method Details
#finalize! ⇒ Object
Final step of the Configuration lifecyle prior to validation.
Ensures all attributes are set to defaults if not provided.
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/vagrant-windows-domain/config.rb', line 68 def finalize! super # Null checks @domain = nil if @domain == UNSET_VALUE || @domain == "" @computer_name = nil if @computer_name == UNSET_VALUE || @computer_name == "" @username = nil if @username == UNSET_VALUE || @username == "" @password = nil if @password == UNSET_VALUE || @password == "" @join_options = [] if @join_options == UNSET_VALUE @ou_path = nil if @ou_path == UNSET_VALUE @unsecure = false if @unsecure == UNSET_VALUE @rename = true if @rename == UNSET_VALUE end |
#validate(machine) ⇒ Hash
Validate configuration and return a hash of errors.
Validation happens after finalize!.
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/vagrant-windows-domain/config.rb', line 88 def validate(machine) errors = _detected_errors # Need to supply one of them! if ( (@username != nil && @password != nil) && @unsecure == true) errors << I18n.t("vagrant_windows_domain.errors.both_credentials_provided") end { "windows domain provisioner" => errors } end |