Error: NoMethodError undefined method 'encoded_token_string' for nil when updating LDAP in rescue mode - Ops Manager
search cancel

Error: NoMethodError undefined method 'encoded_token_string' for nil when updating LDAP in rescue mode - Ops Manager

book

Article ID: 449599

calendar_today

Updated On:

Products

VMware Tanzu Platform Core

Issue/Introduction

Ops Manager returns a 500 error page when updating LDAP settings while in rescue mode. This typically occurs when an operator attempts to update LDAP credentials.

The error being shown is:

500 An error occurred.
Contact VMware Technical Support to report the problem.
Back to dashboard

NoMethodError 

undefined method 'encoded_token_string' for nil

/home/tempest-web/tempest/web/app/controllers/ldap_identity_providers_controller.rb:23:in 'LdapIdentityProvidersController#create'
... 

When the switch to Internal Authentication is attempted, a similar error is shown:

500 An error occurred. 
Contact VMware Technical Support to report the problem.
Back to dashboard 

NoMethodError 

undefined method 'encoded_token_string' for nil 

/home/tempest-web/tempest/web/app/controllers/internal_identity_providers_controller.rb:21:in 'InternalIdentityProvidersController#create'
...  

 

Environment

VMware Tanzu Platform Core

Operations Manager 

Cause

There seems to be a bug in the LdapIdentityProvidersController as it attempts to access a token object that is null when updating settings in rescue mode.  There seems to be a change in UAA in Ops Manager v3.1.13 that likely introduced this issue.

Resolution

This issue is resolved in Ops Manager versions 3.1.14 and later, as well as 3.3.5 and later. 

If an immediate upgrade is not possible, apply the following temporary workaround:

  1. SSH into the Ops Manager VM.
  2. Make a backup copy and open the following file for editing: /home/tempest-web/tempest/web/app/controllers/ldap_identity_providers_controller.rb
  3. Locate the line (approximately line 23) calling encoded_token_string.
  4. Modify the call to use the Ruby safe navigation operator &. to handle potential nil values.  Change the line:
    from:
         uaa_client: UaaClient.new(current_oauth_token.encoded_token_string)
    to:
         uaa_client: UaaClient.new(current_oauth_token&.encoded_token_string)
  5. Save the file.
  6. While still in Rescue Mode, restart the web services: sudo service tempest-web restart
  7. Update the LDAP Settings and save.  It should update successfully this time.

  8. Revert the changes made on /home/tempest-web/tempest/web/app/controllers/ldap_identity_providers_controller.rb

  9. Disable Rescue Mode and restart the tempest-web service.
To disable rescue mode:

1) Simply delete the rescue_mode file with sudo rm /var/tempest/workspaces/default/rescue_mode
2) Restart Ops Manager with sudo service tempest-web restart

 

Please ensure that you have exited Rescue Mode before running apply changes, otherwise you will receive an error.

Additional Information

How to put Ops Manager into Rescue Mode

https://knowledge.broadcom.com/external/article/293468/how-to-put-ops-manager-into-rescue-mode.html