зеркало из https://github.com/mozilla/mig.git
[minor] show loader enabled status in search
This commit is contained in:
Родитель
6cb30162c9
Коммит
27526eea8e
|
@ -129,7 +129,7 @@ No spaces are permitted within parameters. Spaces are used to separate search pa
|
|||
case "manifest":
|
||||
fmt.Println("- ID - + ---- Name ---- + -- Status -- + -------------- Target -------- + ---- Timestamp ---")
|
||||
case "loader":
|
||||
fmt.Println("- ID - + ---- Name ---- + ---- Agent Name ---- + -- Last Used ---")
|
||||
fmt.Println("- ID - + ---- Name ---- + ---- Agent Name ---- + -- Enabled - + -- Last Used ---")
|
||||
}
|
||||
for _, item := range resources.Collection.Items {
|
||||
for _, data := range item.Data {
|
||||
|
@ -258,8 +258,12 @@ No spaces are permitted within parameters. Spaces are used to separate search pa
|
|||
if len(agtname) > 24 {
|
||||
agtname = agtname[0:21] + "..."
|
||||
}
|
||||
fmt.Printf("%6.0f %s %s %s\n", le.ID, loadername,
|
||||
agtname,
|
||||
loaderstatus := fmt.Sprintf("%v", le.Enabled)
|
||||
for i := len(loaderstatus); i < 12; i++ {
|
||||
loaderstatus += " "
|
||||
}
|
||||
fmt.Printf("%6.0f %s %s %s %s\n", le.ID, loadername,
|
||||
agtname, loaderstatus,
|
||||
le.LastSeen.UTC().Format(time.RFC3339))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -930,7 +930,7 @@ func (db *DB) SearchManifests(p search.Parameters) (mrecords []mig.ManifestRecor
|
|||
func (db *DB) SearchLoaders(p search.Parameters) (lrecords []mig.LoaderEntry, err error) {
|
||||
var rows *sql.Rows
|
||||
ids, err := makeIDsFromParams(p)
|
||||
columns := `loaders.id, loaders.loadername, loaders.name, loaders.lastseen`
|
||||
columns := `loaders.id, loaders.loadername, loaders.name, loaders.lastseen, loaders.enabled`
|
||||
where := ""
|
||||
vals := []interface{}{}
|
||||
valctr := 0
|
||||
|
@ -991,7 +991,7 @@ func (db *DB) SearchLoaders(p search.Parameters) (lrecords []mig.LoaderEntry, er
|
|||
for rows.Next() {
|
||||
var le mig.LoaderEntry
|
||||
var agtnameNull sql.NullString
|
||||
err = rows.Scan(&le.ID, &le.Name, &agtnameNull, &le.LastSeen)
|
||||
err = rows.Scan(&le.ID, &le.Name, &agtnameNull, &le.LastSeen, &le.Enabled)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Failed to retrieve loader data: '%v'", err)
|
||||
return
|
||||
|
|
Загрузка…
Ссылка в новой задаче