diff --git a/cmd/host.go b/cmd/host.go index 38fb897fb..44c633f50 100644 --- a/cmd/host.go +++ b/cmd/host.go @@ -87,42 +87,11 @@ func hostLs(ctx *cli.Context) error { return err } - opts := defaultListOpts(ctx) - delete(opts.Filters, "state_ne") - collection, err := c.Host.List(opts) + collection, err := c.Host.List(defaultListOpts(ctx)) if err != nil { return err } - knownMachines := map[string]bool{} - for _, host := range collection.Data { - knownMachines[host.PhysicalHostId] = true - } - - machineCollection, err := c.Machine.List(nil) - if err != nil { - return err - } - - for _, machine := range machineCollection.Data { - if knownMachines[machine.Id] { - continue - } - host := client.Host{ - Resource: client.Resource{ - Id: machine.Id, - }, - Hostname: machine.Name, - State: machine.State, - TransitioningMessage: machine.TransitioningMessage, - } - if machine.State == "active" { - host.State = "waiting" - host.TransitioningMessage = "Almost there... Waiting for agent connection" - } - collection.Data = append(collection.Data, host) - } - writer := NewTableWriter([][]string{ {"ID", "Host.Id"}, {"HOSTNAME", "Host.Hostname"}, diff --git a/cmd/host_create.go b/cmd/host_create.go index 6ded57a4a..fb7be9921 100644 --- a/cmd/host_create.go +++ b/cmd/host_create.go @@ -117,11 +117,11 @@ func hostCreate(ctx *cli.Context) error { return err } - machineSchema := c.GetSchemas().Schema("machine") - flags := buildFlags("", machineSchema, c.GetSchemas()) + hostSchema := c.GetSchemas().Schema("host") + flags := buildFlags("", hostSchema, c.GetSchemas()) drivers := []string{} - for name := range machineSchema.ResourceFields { + for name := range hostSchema.ResourceFields { if strings.HasSuffix(name, "Config") { drivers = append(drivers, strings.TrimSuffix(name, "Config")) } @@ -137,7 +137,7 @@ func hostCreate(ctx *cli.Context) error { EnvVar: "MACHINE_DRIVER", }) hostCommand.Subcommands[i].Action = func(ctx *cli.Context) error { - return hostCreateRun(ctx, c, machineSchema, c.GetSchemas()) + return hostCreateRun(ctx, c, hostSchema, c.GetSchemas()) } hostCommand.Subcommands[i].SkipFlagParsing = false }