Skip to content

Commit

Permalink
lxc/remote: Added support for explicit token provision
Browse files Browse the repository at this point in the history
  • Loading branch information
Regis-Caelum committed Aug 12, 2024
1 parent 96043b1 commit 8ccb65a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lxc/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ func (c *cmdRemoteAdd) run(cmd *cobra.Command, args []string) error {
conf.Remotes = map[string]config.Remote{}
}

if c.flagToken != "" {
rawToken, err := shared.CertificateTokenDecode(c.flagToken)
if err != nil {
// Return the error here rather than skipping as we did in the previous case, as the token has been explicitly provided.
return fmt.Errorf("Failed to parse token: %w", err)
}

return c.runToken(server, c.flagToken, rawToken)
}

rawToken, err := shared.CertificateTokenDecode(addr)
if err == nil {
return c.runToken(server, addr, rawToken)
Expand Down

0 comments on commit 8ccb65a

Please sign in to comment.