lib/config_builder/model/root.rb in vagrant-config_builder-0.10.1 vs lib/config_builder/model/root.rb in vagrant-config_builder-0.11.0
- old
+ new
@@ -4,14 +4,32 @@
class ConfigBuilder::Model::Root < ConfigBuilder::Model::Base
include ConfigBuilder::ModelDelegator
def_model_delegator :vagrant
- def_model_delegator :ssh
def_model_delegator :vms
+ # @!attribute [rw] ssh
+ # @return [Hash<Symbol, Object>] The ssh configuration for all VMs
+ # @example
+ # >> config.ssh
+ # => {
+ # :username => 'administrator',
+ # :password => 'vagrant',
+ # }
+ def_model_delegator :ssh
+ # @!attribute [rw] winrm
+ # @return [Hash<Symbol, Object>] The winrm configuration for all VMs
+ # @example
+ # >> config.winrm
+ # => {
+ # :username => 'administrator',
+ # :password => 'vagrant',
+ # }
+ def_model_delegator :winrm
+
def initialize
@defaults = {:vms => [], :vagrant => {}}
end
def to_proc
@@ -34,8 +52,18 @@
root_config.vagrant.host = attr(:vagrant)[:host]
end
end
def eval_ssh(root_config)
+ with_attr(:ssh) do |ssh_config|
+ f = ConfigBuilder::Model::SSH.new_from_hash(ssh_config)
+ f.call(root_config)
+ end
+ end
+ def eval_winrm(root_config)
+ if attr(:winrm)
+ f = ConfigBuilder::Model::WinRM.new_from_hash(attr(:winrm))
+ f.call(root_config)
+ end
end
end