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
DumpJSON string
ShowVer bool
Lambda bool
Flag *pflag.FlagSet
errorCount int
influx.Client

View File

@ -22,7 +22,10 @@ import (
func Start() error {
log.SetFlags(log.LstdFlags)
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)
return nil // don't run anything else w/ version request.
}
@ -95,6 +98,7 @@ func (u *UnifiPoller) Run() (err error) {
}
switch {
case u.Lambda:
u.LogDebugf("Lambda Mode Enabled")
return u.CollectAndReport()
default:
return u.PollController()