diff options
author | Vivek Singh <vivek.singh@msystechnologies.com> | 2019-05-13 14:13:56 +0530 |
---|---|---|
committer | Vivek Singh <vivek.singh@msystechnologies.com> | 2019-05-13 14:26:44 +0530 |
commit | dc856ecd05033ad6504861602a2c3547940db5cd (patch) | |
tree | ab68480d4499cade40c485144d9f6e42cb02ffb8 /lib/chef/knife | |
parent | 4e485c6944764bedb5e2b9b7b4ab9c5347df43d1 (diff) | |
download | chef-dc856ecd05033ad6504861602a2c3547940db5cd.tar.gz |
Add --session-timeout bootstrap option for both ssh & winrm
- Add bootstrap option --session-timeout.
- Add wirnrm-session to deprecations.
- Default --session-timeout value is 60 secs(same was added for --winrm-session-timeout).
- Modify existing specs related to old winrm session timeout key and add specs for session timeout.
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
Diffstat (limited to 'lib/chef/knife')
-rw-r--r-- | lib/chef/knife/bootstrap.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 59d7e7007c..ec6f33e82e 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -66,6 +66,11 @@ class Chef long: "--max-wait SECONDS", description: "The maximum time to wait for the initial connection to be established." + option :session_timeout, + long: "--session-timeout SECONDS", + description: "The number of seconds to wait for each connection operation to be acknowledged while running bootstrap.", + proc: Proc.new { |protocol| Chef::Config[:knife][:session_timeout] = protocol } + # WinRM Authentication option :winrm_ssl_peer_fingerprint, long: "--winrm-ssl-peer-fingerprint FINGERPRINT", @@ -117,11 +122,6 @@ class Chef description: "The Kerberos service used for authentication.", proc: Proc.new { |protocol| Chef::Config[:knife][:kerberos_service] = protocol } - option :winrm_session_timeout, - long: "--winrm-session-timeout SECONDS", - description: "The number of seconds to wait for each WinRM operation to be acknowledged while running bootstrap.", - proc: Proc.new { |protocol| Chef::Config[:knife][:winrm_session_timeout] = protocol } - ## SSH Authentication option :ssh_gateway, short: "-G GATEWAY", @@ -381,6 +381,8 @@ class Chef [:connection_port, "--winrm-port"], winrm_authentication_protocol: [:winrm_auth_method, "--winrm-authentication-protocol PROTOCOL"], + winrm_session_timeout: + [:session_timeout, "--winrm-session-timeout SECONDS"], }.freeze DEPRECATED_FLAGS.each do |deprecated_key, deprecation_entry| @@ -836,6 +838,7 @@ class Chef return opts if connection_protocol == "winrm" opts[:non_interactive] = true # Prevent password prompts from underlying net/ssh opts[:forward_agent] = (config_value(:ssh_forward_agent) === true) + opts[:connection_timeout] = config_value(:session_timeout)&.to_i || 60 opts end @@ -934,7 +937,7 @@ class Chef opts[:ca_trust_file] = config_value(:ca_trust_file) end - opts[:operation_timeout] = config_value(:winrm_session_timeout) || 60 + opts[:operation_timeout] = config_value(:session_timeout)&.to_i || 60 opts end |