Connecting to WinRM fails. 'Bad SOAP Packet'
Issue
- The WinRM library [winrm (1.1.3)] that came with
CloudForms (cfme-5.3.5.4-1.el6cf.x86_64)fails sometimes with the error: "Bad SOAP Packet returned. Sometimes
a retry will solve this error."
Retrying the operation 7 times with a 10 second pause still results in the same error.
code snippet
require 'winrm'
...
connect_params = {
:realm => krb5_realm,
:user => "#{user_name}@#{krb5_realm}", # Example: user@realm
:pass => password,
:basic_auth_only => false,
:disable_sspi => false
}
endpoint = "http://#{windows_host_name}:#{windows_host_port}/wsman"
log(:info, "Connecting to WinRM on URL: #{endpoint} with user #{connect_params[:user]}")
log(:info, "Using Realm: #{krb5_realm}")
max_retries = 3
retries=1
begin
if retries <= max_retries
winrm = WinRM::WinRMWebService.new(endpoint, :kerberos, connect_params)
else
send_status_update "Unable to make WinRM connection. Exceeded max retries."
end
rescue Timeout::Error => e
log(:info, "Times out: #{e}")
retry
rescue => e
log(:info, "ERROR: #{e}")
retries += 1
retry
end
Environment
- Red Hat CloudForms 3.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
