Make 'host list' output match config field naming better
This commit is contained in:
parent
723642e13b
commit
a984ffc724
@ -70,7 +70,7 @@ var subCmdHostList = subCmd{
|
|||||||
|
|
||||||
hosts := currBoostrap.HostsOrdered()
|
hosts := currBoostrap.HostsOrdered()
|
||||||
|
|
||||||
type storageInstanceView struct {
|
type storageAllocationView struct {
|
||||||
ID string `yaml:"id"`
|
ID string `yaml:"id"`
|
||||||
RPCPort int `yaml:"rpc_port"`
|
RPCPort int `yaml:"rpc_port"`
|
||||||
S3APIPort int `yaml:"s3_api_port"`
|
S3APIPort int `yaml:"s3_api_port"`
|
||||||
@ -83,15 +83,15 @@ var subCmdHostList = subCmd{
|
|||||||
PublicAddr string `yaml:"public_addr,omitempty"`
|
PublicAddr string `yaml:"public_addr,omitempty"`
|
||||||
}
|
}
|
||||||
Storage struct {
|
Storage struct {
|
||||||
Instances []storageInstanceView `yaml:"instances"`
|
Allocations []storageAllocationView `yaml:"allocations"`
|
||||||
} `yaml:",omitempty"`
|
} `yaml:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
hostViews := make([]hostView, len(hosts))
|
hostViews := make([]hostView, len(hosts))
|
||||||
for i, host := range hosts {
|
for i, host := range hosts {
|
||||||
storageInstanceViews := make([]storageInstanceView, len(host.Garage.Instances))
|
storageAllocViews := make([]storageAllocationView, len(host.Garage.Instances))
|
||||||
for i := range host.Garage.Instances {
|
for i := range host.Garage.Instances {
|
||||||
storageInstanceViews[i] = storageInstanceView(host.Garage.Instances[i])
|
storageAllocViews[i] = storageAllocationView(host.Garage.Instances[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
hostView := hostView{
|
hostView := hostView{
|
||||||
@ -100,7 +100,7 @@ var subCmdHostList = subCmd{
|
|||||||
|
|
||||||
hostView.VPN.IP = host.IP().String()
|
hostView.VPN.IP = host.IP().String()
|
||||||
hostView.VPN.PublicAddr = host.Nebula.PublicAddr
|
hostView.VPN.PublicAddr = host.Nebula.PublicAddr
|
||||||
hostView.Storage.Instances = storageInstanceViews
|
hostView.Storage.Allocations = storageAllocViews
|
||||||
hostViews[i] = hostView
|
hostViews[i] = hostView
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ func TestHostList(t *testing.T) {
|
|||||||
"public_addr": "1.1.1.1:80",
|
"public_addr": "1.1.1.1:80",
|
||||||
},
|
},
|
||||||
"storage": map[string]any{
|
"storage": map[string]any{
|
||||||
"instances": []any{
|
"allocations": []any{
|
||||||
map[string]any{
|
map[string]any{
|
||||||
"id": "storageInstanceID",
|
"id": "storageInstanceID",
|
||||||
"rpc_port": 9000,
|
"rpc_port": 9000,
|
||||||
|
Loading…
Reference in New Issue
Block a user