Using the Resize NSX Edge Node script fails with the error "Failed to get Bearer Token!"
search cancel

Using the Resize NSX Edge Node script fails with the error "Failed to get Bearer Token!"

book

Article ID: 408538

calendar_today

Updated On:

Products

VMware SDDC Manager

Issue/Introduction

The KB for NSX Edge node resize tool (VCF deployed NSX environments) - https://knowledge.broadcom.com/external/article/312196/ , is being applied. 

During the script implementation we encounter the error "Failed to get Bearer Token!". The error stack looks something like the below -

root@sddc-M [/home/vcf]# ./resize.sh --edge-cluster <Edge cluster name> --user <ssoUser> --password <ssoUserPassword> --form-factor LARGE

Resizing Edge nodes in Edge cluster <edge_cluster> to form factor LARGE

The Edge Node Resizer tool takes Edge nodes offline one at a time in order
to recreate them with a specified form factor. This means that

* Each Edge node's Tier-0 interfaces temporarily go offline during resizing
* Tier-1 router services relocate from one Edge node to another

This may lead to temporary network traffic interruptions during the resize.
The full resize operation may take as long as it did to originally create
and (if requested) expand the Edge cluster.

Do you wish to proceed (y/n)? y
Run confirmation accepted by user.
Getting credentials from SDDC Manager...
Getting Bearer token
Failed to get bearer token!

Exception: local variable 'tokenReply' referenced before assignment
 bt: File "/home/vcf/resizer/resizer/./resize.py", line 1980, in __init__
 bt: self._doInit()
 bt: File "/home/vcf/resizer/resizer/./resize.py", 
 line 2041, in _doInit
 bt: self._getServercredentials(ssoPassword)
 bt: File "/home/vcf/resizer/resizer/./resize.py", line 2138, in _getServerCredentials
 bt: self.creds = VcfCreds(workload=self.workloadName,
 bt: File "/home/vcf/resizer/vcf_utils/vcf_creds.py", line 558, in __init__
 bt: self.createAuthToken(username, password)
 bt: File "/home/vcf/resizer/vcf_utils/vcf_creds.py", line 104, in _createAuthToken

 bt: logger.error("Response:\n%s" % pp.pformat(tokenReply))
Did not complete requested operation
Resizing utility is stopping now.

Environment

VMware Cloud Foundation 4.x
VMware Cloud Foundation 5.x

Cause

This issue occurs if the tool is unable to accept the specified SSO password that contains special characters. (Most case scenarios '$'.)

Resolution

Use quotes to specify the password -

./resize.sh --edge-cluster <Edge cluster name> --user <ssoUser> --password '<ssoUserPassword>' --form-factor <SMALL,MEDIUM,LARGE,XLARGE>

root@sddc-M [/home/vcf]# ./resize.sh --edge-cluster vcf_edge01 --user [email protected] --password 'VMware123$' --form-factor LARGE

OR

Run the command without the password attribute, which will then request the user to enter the password manually during the script execution -

./resize.sh --edge-cluster <Edge cluster name> --user <ssoUser> --form-factor <SMALL,MEDIUM,LARGE,XLARGE>

root@sddc-M [/home/vcf]# ./resize.sh --edge-cluster vcf_edge01 --user [email protected] --form-factor LARGE