Physical location: building / room / rack / unit / asset tag
CI / go (push) Successful in 35s
CI / agent (push) Successful in 4s
CI / site (push) Successful in 3s

- machines.building/room/rack/rack_unit/asset_tag, racks table (height, comment)
- API: POST /machines/{id}/location, POST /locations/import (CSV or JSON, matched by
  id/serial/mac/node_name, ?dry=1), GET/POST/DELETE /racks, ?building/?room/?rack filters
- CLI: rollcall location ..., location import, location racks/rack, list -rack/-room/-building
- UI: location column and building > room > rack chips, bulk Set location…, Racks page with
  elevation views and CSV import dialog, location in machine detail
- .Node.Building/Room/Rack/Unit/AssetTag in overlay templates and tag match rules

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Fable 5.1 committed 2026-10-27 15:32:26 +01:00
1 parent 0333c1e486
commit cb7b6fd19e
11 files changed
+678 -16

No files matched your search

+37 -3
View File
@@ -97,14 +97,20 @@ func runClient(cmd string, args []string) error {
case "list":
fs := newFlags("list")
tag := fs.String("tag", "", "only machines with this tag")
rack := fs.String("rack", "", "only machines in this rack")
room := fs.String("room", "", "only machines in this room")
bld := fs.String("building", "", "only machines in this building")
_ = fs.Parse(args)
ms, err := c.machines(*tag)
if err != nil {
return err
}
f := "%-16s %-14s %-10s %-16s %-14s %-24s %4s %7s %3s %7s %3s %2s %3s %-18s %s\n"
fmt.Printf(f, "ID", "STATE", "NODE", "PROFILE/OS", "MGMT-IP", "MODEL", "CPU", "RAM", "DSK", "STORAGE", "NIC", "IB", "GPU", "BMC", "TAGS")
f := "%-16s %-14s %-10s %-16s %-14s %-22s %-18s %4s %7s %3s %7s %3s %2s %3s %-18s %s\n"
fmt.Printf(f, "ID", "STATE", "NODE", "PROFILE/OS", "MGMT-IP", "LOCATION", "MODEL", "CPU", "RAM", "DSK", "STORAGE", "NIC", "IB", "GPU", "BMC", "TAGS")
for _, m := range ms {
if (*rack != "" && !strings.EqualFold(m.Location.Rack, *rack)) || (*room != "" && !strings.EqualFold(m.Location.Room, *room)) || (*bld != "" && !strings.EqualFold(m.Location.Building, *bld)) {
continue
}
state := m.State
if m.Job != nil {
var p obj
@@ -125,7 +131,7 @@ func runClient(cmd string, args []string) error {
bmc = fmt.Sprintf("%s (%s,%s)", str(b["address"]), str(b["source"]), ok)
}
model := strings.TrimSpace(deref(m.Manufacturer) + " " + deref(m.Product))
fmt.Printf(f, m.ID, state, deref(m.NodeName), trunc(what, 16), deref(m.MgmtIP), trunc(model, 24), m.CPUs, human(m.MemoryBytes),
fmt.Printf(f, m.ID, state, deref(m.NodeName), trunc(what, 16), deref(m.MgmtIP), trunc(m.Location.String(), 22), trunc(model, 18), m.CPUs, human(m.MemoryBytes),
fmt.Sprint(int(m.Disks)), human(m.StorageBytes), fmt.Sprint(m.NICs), fmt.Sprint(m.IBHCAs), fmt.Sprint(m.GPUs), trunc(bmc, 18), strings.Join(m.Tags, ","))
}
case "show":
@@ -207,6 +213,8 @@ func runClient(cmd string, args []string) error {
return c.deployCmd(cmd, args)
case "tag", "tags":
return c.tagCmd(cmd, args)
case "location":
return c.locationCmd(args)
default:
return c.statelessCmd(cmd, args)
}
@@ -629,6 +637,32 @@ func (c *client) statelessCmd(cmd string, args []string) error {
return nil
}
func readFileArg(p string) ([]byte, error) {
if p == "-" {
return io.ReadAll(os.Stdin)
}
return os.ReadFile(p)
}
func (c *client) rawBody(method, path, ctype string, body []byte) ([]byte, error) {
req, err := http.NewRequest(method, c.base+path, bytes.NewReader(body))
if err != nil {
return nil, err
}
req.Header.Set("Authorization", "Bearer "+c.token)
req.Header.Set("Content-Type", ctype)
resp, err := c.http.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
data, _ := io.ReadAll(resp.Body)
if resp.StatusCode >= 400 {
return nil, fmt.Errorf("%s: %s", resp.Status, strings.TrimSpace(string(data)))
}
return data, nil
}
func (c *client) raw(method, path string) ([]byte, error) {
req, err := http.NewRequest(method, c.base+path, nil)
if err != nil {