Display currently running version when listing jails

This commit is contained in:
yo 2023-08-06 14:50:32 +02:00
parent 549d517cf9
commit c2277ce10c

View File

@ -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
}
}