Skip to content

Commit

Permalink
[PLAT-14700] Make node-agent error message on installation to be more…
Browse files Browse the repository at this point in the history
… precise

Summary: This error happens on verification with existing certs after the existence of node-agent on YBA is verified with the api token first.

Test Plan:
Verified by manually running it.

```
* Select your Zone.
1. Zone ID: f5d02b20-aed4-469d-823a-4c8e5f9fe2c8, Zone Code: us-west-2a
2. Zone ID: b7ff22b9-2278-475d-971d-607587a589ed, Zone Code: us-west-2b
3. Zone ID: 02267e7e-59f5-4bbb-8308-3d4b53c8cc7e, Zone Code: us-west-2c
* The current value is Zone ID: 02267e7e-59f5-4bbb-8308-3d4b53c8cc7e, Zone Code: us-west-2c.
	 Enter new option number or enter to skip:
   • Completed Node Agent Configuration
   • Checking for existing Node Agent with IP 10.9.101.164
   ⨯ Node agent already exists on YBA but local credentials may be invalid. It may need to be unregistered first - open /home/ec2-user/node-agent/cert/node_agent.key: no such file or directory
```

Reviewers: cwang, sanketh, nbhatia

Reviewed By: cwang

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D36664
  • Loading branch information
nkhogen committed Jul 19, 2024
1 parent 550458d commit 225ddfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion managed/node-agent/cli/node/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,9 @@ func configureEnabledEgress(ctx context.Context, cmd *cobra.Command) {
util.ConsoleLogger().Fatalf(ctx, "Unable to register node agent - %s", err.Error())
}
} else {
util.ConsoleLogger().Fatalf(ctx, "Unable to check for existing node agent - %s", err.Error())
// Node agent already exists on YBA. But, it cannot be verified with the local key.
util.ConsoleLogger().Fatalf(ctx, "Node agent already exists on YBA but local "+
"credentials may be invalid. It may need to be unregistered first - %s", err.Error())
}
util.ConsoleLogger().Info(ctx, "Node Agent Configuration Successful")
}
Expand Down
2 changes: 1 addition & 1 deletion managed/node-agent/util/certs_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func ServerKeyPath(config *Config) string {
// The JWT is signed using the key in the certs directory.
func GenerateJWT(ctx context.Context, config *Config) (string, error) {
keyFilepath := ServerKeyPath(config)
privateKey, err := ioutil.ReadFile(keyFilepath)
privateKey, err := os.ReadFile(keyFilepath)
if err != nil {
FileLogger().Errorf(ctx, "Error while reading the private key: %s", err.Error())
return "", err
Expand Down

0 comments on commit 225ddfe

Please sign in to comment.