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:
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
Note, if we're missing credentials or something... adding the require won't fix it... but now it wont' be hidden by the NameError.
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?
https://github.com/ManageIQ/manageiq/pull/2827
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(+)
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.
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