Class: Knife::Clc::Bootstrap::Methods::SyncWindowsWinrm
- Inherits:
-
Object
- Object
- Knife::Clc::Bootstrap::Methods::SyncWindowsWinrm
- Defined in:
- lib/knife-clc/bootstrap/methods/sync_windows_winrm.rb
Instance Attribute Summary collapse
-
#cloud_adapter ⇒ Object
readonly
Returns the value of attribute cloud_adapter.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#connectivity_helper ⇒ Object
readonly
Returns the value of attribute connectivity_helper.
-
#subcommand_loader ⇒ Object
readonly
Returns the value of attribute subcommand_loader.
Instance Method Summary collapse
- #execute(server) ⇒ Object
-
#initialize(params) ⇒ SyncWindowsWinrm
constructor
A new instance of SyncWindowsWinrm.
Constructor Details
#initialize(params) ⇒ SyncWindowsWinrm
Returns a new instance of SyncWindowsWinrm.
8 9 10 11 12 13 |
# File 'lib/knife-clc/bootstrap/methods/sync_windows_winrm.rb', line 8 def initialize(params) @cloud_adapter = params.fetch(:cloud_adapter) @config = params.fetch(:config) @connectivity_helper = params.fetch(:connectivity_helper) @subcommand_loader = params.fetch(:subcommand_loader) end |
Instance Attribute Details
#cloud_adapter ⇒ Object (readonly)
Returns the value of attribute cloud_adapter.
6 7 8 |
# File 'lib/knife-clc/bootstrap/methods/sync_windows_winrm.rb', line 6 def cloud_adapter @cloud_adapter end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/knife-clc/bootstrap/methods/sync_windows_winrm.rb', line 6 def config @config end |
#connectivity_helper ⇒ Object (readonly)
Returns the value of attribute connectivity_helper.
6 7 8 |
# File 'lib/knife-clc/bootstrap/methods/sync_windows_winrm.rb', line 6 def connectivity_helper @connectivity_helper end |
#subcommand_loader ⇒ Object (readonly)
Returns the value of attribute subcommand_loader.
6 7 8 |
# File 'lib/knife-clc/bootstrap/methods/sync_windows_winrm.rb', line 6 def subcommand_loader @subcommand_loader end |
Instance Method Details
#execute(server) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/knife-clc/bootstrap/methods/sync_windows_winrm.rb', line 15 def execute(server) cloud_adapter.ensure_server_powered_on(server) fqdn = get_server_fqdn(server) wait_for_winrm(fqdn) command = subcommand_loader.load(:class => Chef::Knife::BootstrapWindowsWinrm, :config => config) username, password = config.values_at(:winrm_user, :winrm_password) unless username && password creds = cloud_adapter.get_server_credentials(server) command.config.merge!(:winrm_user => creds['userName'], :winrm_password => creds['password']) end command.name_args = [fqdn] command.config[:chef_node_name] ||= server['name'] command.run end |