a few fixes

This commit is contained in:
David Newhall II 2019-06-23 18:53:46 -07:00
parent f2c267ea02
commit b49d85272c
2 changed files with 5 additions and 2 deletions

View File

@ -33,7 +33,6 @@ type UnifiPoller struct {
ConfigFile string ConfigFile string
DumpJSON string DumpJSON string
ShowVer bool ShowVer bool
Lambda bool
Flag *pflag.FlagSet Flag *pflag.FlagSet
errorCount int errorCount int
influx.Client influx.Client

View File

@ -22,7 +22,10 @@ import (
func Start() error { func Start() error {
log.SetFlags(log.LstdFlags) log.SetFlags(log.LstdFlags)
up := &UnifiPoller{} up := &UnifiPoller{}
if up.ParseFlags(os.Args[1:]); up.ShowVer { if os.Args != nil && len(os.Args) > 1 {
up.ParseFlags(os.Args[1:])
}
if up.ShowVer {
fmt.Printf("unifi-poller v%s\n", Version) fmt.Printf("unifi-poller v%s\n", Version)
return nil // don't run anything else w/ version request. return nil // don't run anything else w/ version request.
} }
@ -95,6 +98,7 @@ func (u *UnifiPoller) Run() (err error) {
} }
switch { switch {
case u.Lambda: case u.Lambda:
u.LogDebugf("Lambda Mode Enabled")
return u.CollectAndReport() return u.CollectAndReport()
default: default:
return u.PollController() return u.PollController()