From c2277ce10c0bad4289c63e345b254a17a86d7f50 Mon Sep 17 00:00:00 2001 From: yo Date: Sun, 6 Aug 2023 14:50:32 +0200 Subject: [PATCH] Display currently running version when listing jails --- cmd/list.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/cmd/list.go b/cmd/list.go index 59155a8..c8ca331 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -52,7 +52,7 @@ func ListJails(args []string, display bool) { for _, ds := range gDatastores { listJailsFromDatastore(ds, args, display) } - + // Only when displaying jails, we accept to process multiple same name jails if false == display { for _, j := range gJails { @@ -68,11 +68,11 @@ func ListJails(args []string, display bool) { break } } - + if true == skip { continue } - + // Initialize if not found in nameChecked if false == found { curCheck = &uniqueJailName{jail: j.Name, @@ -81,11 +81,11 @@ func ListJails(args []string, display bool) { } else { found = false } - + if countOfJailsWithThisName(j.Name) > 1 { //fmt.Printf("DEBUG: Jail %s exist multiple times, now checking if specified with full name\n", j.Name) curCheck.unique = false - + for _, a := range args { //fmt.Printf("DEBUG: comparing %s/%s with %s\n", j.Datastore, j.Name, a) if strings.EqualFold(a, fmt.Sprintf("%s/%s", j.Datastore, j.Name)) { @@ -96,7 +96,7 @@ func ListJails(args []string, display bool) { } nameChecked = append(nameChecked, curCheck) } - + // Now check for _, a := range args { for _, n := range nameChecked { @@ -107,9 +107,9 @@ func ListJails(args []string, display bool) { } } } - + fields := strings.Split(gDisplayJColumns, ",") - + // This is the structure we will filter, then display var jails []Jail @@ -275,6 +275,13 @@ func listJailsFromDirectory(dir string, dsname string) ([]Jail, error) { // FIXME ??? Shouldn't be ioc-$Name ? j.InternalName = rj.Name j.Devfs_ruleset = rj.Devfs_ruleset + // Update release + r, err := getVersion(&j) + if err != nil { + fmt.Printf("ERROR getting jail %s version: %s\n", j.Name, err.Error()) + } else { + j.Config.Release = r + } break } }