allow missing sites in config

This commit is contained in:
David Newhall II 2019-06-23 19:33:57 -07:00
parent 5b92a23b73
commit e650f1f412
2 changed files with 4 additions and 2 deletions

View File

@ -128,6 +128,7 @@ func (u *UnifiPoller) GetUnifi() (err error) {
} }
u.Unifi.ErrorLog = u.LogErrorf // Log all errors. u.Unifi.ErrorLog = u.LogErrorf // Log all errors.
u.Unifi.DebugLog = u.LogDebugf // Log debug messages. u.Unifi.DebugLog = u.LogDebugf // Log debug messages.
// this may fail? but we'll try one more time with u.CheckSites below.
v, err := u.GetServer() v, err := u.GetServer()
if err != nil { if err != nil {
v.ServerVersion = "unknown" v.ServerVersion = "unknown"

View File

@ -32,7 +32,8 @@ FIRST:
continue FIRST continue FIRST
} }
} }
return errors.Errorf("configured site not found on controller: %v", s) // This is fine, it may get added later.
u.LogErrorf("configured site not found on controller: %v", s)
} }
return nil return nil
} }
@ -154,7 +155,7 @@ func (m *Metrics) processPoints(asset Asset) error {
// GetFilteredSites returns a list of sites to fetch data for. // GetFilteredSites returns a list of sites to fetch data for.
// Omits requested but unconfigured sites. Grabs the full list from the // Omits requested but unconfigured sites. Grabs the full list from the
// controller and filters the sites provided in the config file. // controller and returns the sites provided in the config file.
func (u *UnifiPoller) GetFilteredSites() (unifi.Sites, error) { func (u *UnifiPoller) GetFilteredSites() (unifi.Sites, error) {
sites, err := u.GetSites() sites, err := u.GetSites()
if err != nil { if err != nil {