Skip to content

Commit

Permalink
Moved and changed the copy of error when fetching server by IP.
Browse files Browse the repository at this point in the history
Added some comments to why a label is used on provisioned vps.
Added comments about where to find information about the Plan, OS and Regions for Hetzner.

Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
  • Loading branch information
Johannestegner authored and alexellis committed Jul 23, 2020
1 parent f6e8d39 commit cc92655
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ func createHost(provider, name, region, zone, projectID, userData, inletsPort st
},
}, nil
} else if provider == "hetzner" {
// Easiest way to get the information of available images and server types is through
// the Hetzner API, but it requires auth for any type of call.
// Images can be fetched from https://api.hetzner.cloud/v1/images
// Server types can be fetched from https://api.hetzner.cloud/v1/server_types
// The regions available are hel1 (Helsinki), nur1 (Nuremberg), fsn1 (Falkenstein)
return &provision.BasicHost{
Name: name,
Region: region,
Expand Down
9 changes: 5 additions & 4 deletions pkg/provision/hetzner.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ func (p *HetznerProvisioner) Provision(host BasicHost) (*ProvisionedHost, error)
func (p *HetznerProvisioner) List(filter ListFilter) ([]*ProvisionedHost, error) {
var hosts []*ProvisionedHost
hostList, err := p.client.Server.AllWithOpts(context.Background(), hcloud.ServerListOpts{
// Adding a label to the VPS so that it is easier to select inlets managed servers and also
// to tell the user that the server in question is managed by inlets.
ListOpts: hcloud.ListOpts{
LabelSelector: "managed-by=inlets",
},
Expand Down Expand Up @@ -122,10 +124,9 @@ func (p *HetznerProvisioner) Delete(request HostDeleteRequest) error {
id = instance.ID
}
}
}

if len(id) <= 0 {
return fmt.Errorf("failed to find server with id %s", id)
if len(id) <= 0 {
return fmt.Errorf("failed to find server with id with IP %s", request.IP)
}
}

idAsInt, err := strconv.Atoi(id)
Expand Down

0 comments on commit cc92655

Please sign in to comment.