mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-07 21:59:15 +00:00
refactor: api.Container to use the detailed ContainerJSON struct instead of Container (Summary)
This commit is contained in:
1 parent
43f28284f1
commit
5e2b2ac836
18 files changed
+229
-133
No files matched your search
@@ -70,13 +70,20 @@ func inspect(ctx context.Context, uncli *cli.CLI, opts inspectOptions) error {
|
||||
}
|
||||
|
||||
for _, ctr := range svc.Containers {
|
||||
createdAt := time.Unix(ctr.Container.Created, 0)
|
||||
createdAt, err := time.Parse(time.RFC3339Nano, ctr.Container.Created)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parse created time: %w", err)
|
||||
}
|
||||
created := units.HumanDuration(time.Now().UTC().Sub(createdAt)) + " ago"
|
||||
|
||||
machine := machinesNamesByID[ctr.MachineID]
|
||||
if machine == "" {
|
||||
machine = ctr.MachineID
|
||||
}
|
||||
state, err := ctr.Container.HumanState()
|
||||
if err != nil {
|
||||
return fmt.Errorf("get human state: %w", err)
|
||||
}
|
||||
|
||||
_, err = fmt.Fprintf(
|
||||
tw,
|
||||
@@ -84,7 +91,7 @@ func inspect(ctx context.Context, uncli *cli.CLI, opts inspectOptions) error {
|
||||
stringid.TruncateID(ctr.Container.ID),
|
||||
ctr.Container.Image,
|
||||
created,
|
||||
ctr.Container.Status,
|
||||
state,
|
||||
machine,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user