Make output of hosts list more useful
This commit is contained in:
parent
0d7d69679f
commit
97d4aacc15
@ -11,10 +11,6 @@ func (b Bootstrap) GaragePeers() []garage.RemotePeer {
|
||||
|
||||
for _, host := range b.Hosts {
|
||||
|
||||
if host.Garage == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, instance := range host.Garage.Instances {
|
||||
|
||||
peer := garage.RemotePeer{
|
||||
@ -49,7 +45,7 @@ func (b Bootstrap) ChooseGaragePeer() garage.RemotePeer {
|
||||
|
||||
thisHost := b.ThisHost()
|
||||
|
||||
if thisHost.Garage != nil && len(thisHost.Garage.Instances) > 0 {
|
||||
if len(thisHost.Garage.Instances) > 0 {
|
||||
|
||||
inst := thisHost.Garage.Instances[0]
|
||||
return garage.RemotePeer{
|
||||
|
@ -60,7 +60,7 @@ type GarageHost struct {
|
||||
type Host struct {
|
||||
Name string `yaml:"name"`
|
||||
Nebula NebulaHost `yaml:"nebula"`
|
||||
Garage *GarageHost `yaml:"garage,omitempty"`
|
||||
Garage GarageHost `yaml:"garage,omitempty"`
|
||||
}
|
||||
|
||||
// IP returns the IP address encoded in the Host's nebula certificate, or panics
|
||||
|
@ -26,8 +26,6 @@ func mergeDaemonConfigIntoBootstrap(
|
||||
|
||||
if allocs := daemonConfig.Storage.Allocations; len(allocs) > 0 {
|
||||
|
||||
host.Garage = new(bootstrap.GarageHost)
|
||||
|
||||
for _, alloc := range allocs {
|
||||
|
||||
id, err := garage.InitAlloc(alloc.MetaPath)
|
||||
|
@ -38,8 +38,24 @@ var subCmdHostsList = subCmd{
|
||||
return fmt.Errorf("retrieving hosts from garage: %w", err)
|
||||
}
|
||||
|
||||
hosts := make([]bootstrap.Host, 0, len(hostsMap))
|
||||
for _, host := range hostsMap {
|
||||
type host struct {
|
||||
Name string `yaml:"name"`
|
||||
Nebula struct {
|
||||
IP string `yaml:"ip"`
|
||||
} `yaml:"nebula"`
|
||||
Garage bootstrap.GarageHost `yaml:"garage,omitempty"`
|
||||
}
|
||||
|
||||
hosts := make([]host, 0, len(hostsMap))
|
||||
for _, h := range hostsMap {
|
||||
|
||||
host := host{
|
||||
Name: h.Name,
|
||||
Garage: h.Garage,
|
||||
}
|
||||
|
||||
host.Nebula.IP = h.IP().String()
|
||||
|
||||
hosts = append(hosts, host)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user