Bug 1217394

Summary: "uninitialized constant EmsMicrosoft::GSSAPI" on scvmm provider validate
Product: Red Hat CloudForms Management Engine Reporter: Aziza Karol <akarol>
Component: UI - OPSAssignee: Daniel Berger <dberger>
Status: CLOSED ERRATA QA Contact: Milan Falešník <mfalesni>
Severity: high Docs Contact:
Priority: high    
Version: 5.4.0CC: akarol, cpelland, dberger, gblomqui, hkataria, jhardy, jprause, jrafanie, mfalesni, mpovolny, obarenbo
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-16 13:01:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
err none

Description Aziza Karol 2015-04-30 09:45:38 UTC
Created attachment 1020500 [details]
err

Description of problem:


Version-Release number of selected component (if applicable):
5.4.0.0.24.20150427192818_1fd9e49

How reproducible:
100%

Steps to Reproduce:
1.Add scvmm provider
2.Enter credentials and click on validate
3.

Actual results:
"uninitialized constant EmsMicrosoft::GSSAPI" displayed in UI.see attached screenshot.

Expected results:
Valid flash message should be displayed


Additional info:

Comment 6 Joe Rafaniello 2015-04-30 21:22:19 UTC
I confirm that the exception classes in the rescues aren't actually going to raise a NameError until any Exception is raised:

irb(main):001:0> begin
irb(main):002:1*   puts "ok"
irb(main):003:1> rescue MyMissingConstant
irb(main):004:1>   puts "i made it here"
irb(main):005:1> end
ok
=> nil
irb(main):006:0>
irb(main):007:0* begin
irb(main):008:1*   puts "ok"
irb(main):009:1>   raise
irb(main):010:1> rescue MyMissingConstant
irb(main):011:1>   puts "i made it here"
irb(main):012:1> end
ok
NameError: uninitialized constant MyMissingConstant

Note, I don't have to raise anything special, any exception will cause it to walk the rescue conditions and will cause the NameError.

Bronagh, it looks like we use winrm in raw_connect[1] which depends on and probably requires the gssapi gem.  Note, that verify_credentials is running run_dos_command  which calls with_provider_connection[2], which calls connect on the base ems class [3], which calls raw_connect eventually in ems_microsoft [4], which finally does the require 'winrm' from [1].  If anything raises before we require 'winrm' in raw_connect, it will fail with the reported error.  If I were to guess, I think we're missing credentials [5].

If verify_credentials is calling down into winrm eventually and we need to rescue GSSAPI exceptions, we should require 'winrm' in verify_credentials.  Maybe we can put the whole comment and silence_warnings block[1] into a method we can call from both raw_connect and verify_credentials.


[1] https://github.com/ManageIQ/manageiq/blob/df33200d4256c6ff9112920dea4dea0a083bc2ee/vmdb/app/models/ems_microsoft.rb#L16-L24

[2] https://github.com/ManageIQ/manageiq/blob/df33200d4256c6ff9112920dea4dea0a083bc2ee/vmdb/app/models/ems_microsoft/powershell.rb#L55

[3] https://github.com/ManageIQ/manageiq/blob/df33200d4256c6ff9112920dea4dea0a083bc2ee/vmdb/app/models/ext_management_system.rb#L193

[4] https://github.com/ManageIQ/manageiq/blob/df33200d4256c6ff9112920dea4dea0a083bc2ee/vmdb/app/models/ems_microsoft.rb#L42

[5] https://github.com/ManageIQ/manageiq/blob/df33200d4256c6ff9112920dea4dea0a083bc2ee/vmdb/app/models/ems_microsoft.rb#L36

Comment 7 Joe Rafaniello 2015-04-30 21:23:59 UTC
Note, if we're missing credentials or something... adding the require won't fix it... but now it wont' be hidden by the NameError.

Comment 8 Daniel Berger 2015-04-30 21:29:07 UTC
I was just going to explicitly require 'gssapi' at the top of ems_microsoft.rb. That solved it, and you'll instead see a connection error (the real error) when you try to validate.

Or would you rather the require happened somewhere else?

Comment 9 Oleg Barenboim 2015-05-01 19:58:11 UTC
https://github.com/ManageIQ/manageiq/pull/2827

Comment 10 CFME Bot 2015-05-04 18:21:01 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/488b348ce3723bd8db610e7212b924c8a4ba55b0

commit 488b348ce3723bd8db610e7212b924c8a4ba55b0
Author:     Daniel Berger <dberger>
AuthorDate: Fri May 1 13:48:34 2015 -0600
Commit:     Daniel Berger <dberger>
CommitDate: Fri May 1 13:48:34 2015 -0600

    This addresses a possible error where GSSAPI is referenced before it is defined. It also deals with the possibility of other types of exceptions not previously handled explicitly.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1217394

 vmdb/app/models/ems_microsoft.rb | 5 +++++
 1 file changed, 5 insertions(+)

Comment 12 Milan Falešník 2015-05-13 12:45:56 UTC
Checked in 5.4.0.0.26. I tried to invoke the two error messages ("Unable to reach any KDC in realm ...", "Unable to connect: ...") and I was successful. No such error like uninitialized constant appeared.

Comment 14 errata-xmlrpc 2015-06-16 13:01:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1100.html