Skip to content

Commit 8d3ba22

Browse files
committed
Add validation on name to exit early
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]>
1 parent a03b98f commit 8d3ba22

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

provision/linode.go

+4
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ func NewLinodeProvisioner(apiKey string) (*LinodeProvisioner, error) {
6666
// Provision provisions a new Linode instance as an exit node
6767
func (p *LinodeProvisioner) Provision(host BasicHost) (*ProvisionedHost, error) {
6868

69+
if len(host.Name) > 32 {
70+
return nil, fmt.Errorf("name cannot be longer than 32 characters for Linode due to label limitations")
71+
}
72+
6973
// Stack script is how linode does the cloud-init when provisioning a VM.
7074
// Stack script is the inlets user data containing inlets auth token.
7175
// Making stack script public will allow everyone to read the stack script

0 commit comments

Comments
 (0)