feat: add trigger for fetching logs properties

This commit is contained in:
Jose Diaz-Gonzalez committed 2021-01-23 13:39:29 -05:00
1 parent ccbe2c719a
commit 815b839eeb
5 files changed
+38 -2

No files matched your search

+16
View File
@@ -1,6 +1,7 @@
package logs
import (
"errors"
"fmt"
"io/ioutil"
"os"
@@ -56,6 +57,21 @@ func TriggerInstall() error {
return nil
}
// TriggerLogsGetProperty writes the logs key to stdout for a given app container
func TriggerLogsGetProperty(appName string, key string) error {
if key != "max-size" {
return errors.New("Invalid logs property specified")
}
value := common.PropertyGet("logs", appName, "max-size")
if value == "" {
value = common.PropertyGetDefault("logs", "--global", "max-size", MaxSize)
}
fmt.Println(value)
return nil
}
// TriggerPostDelete destroys the network property for a given app container
func TriggerPostDelete(appName string) error {
return common.PropertyDestroy("logs", appName)