Skip to content

Commit

Permalink
Add validation on name to exit early
Browse files Browse the repository at this point in the history
Linode has a hard limit on labels of 32 characters, this
should help bubble up errors early without making an API
call.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Aug 26, 2021
1 parent a03b98f commit 8d3ba22
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions provision/linode.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func NewLinodeProvisioner(apiKey string) (*LinodeProvisioner, error) {
// Provision provisions a new Linode instance as an exit node
func (p *LinodeProvisioner) Provision(host BasicHost) (*ProvisionedHost, error) {

if len(host.Name) > 32 {
return nil, fmt.Errorf("name cannot be longer than 32 characters for Linode due to label limitations")
}

// Stack script is how linode does the cloud-init when provisioning a VM.
// Stack script is the inlets user data containing inlets auth token.
// Making stack script public will allow everyone to read the stack script
Expand Down

0 comments on commit 8d3ba22

Please sign in to comment.