@ -5,6 +5,7 @@ import (
"regexp"
"regexp"
"strings"
"strings"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/spf13/viper"
@ -33,6 +34,26 @@ func BoxIdValidator(cmd *cobra.Command, args []string) error {
return nil
return nil
}
}
func checkAndNotifyAll ( ) error {
log . Info ( "getting list of boxes..." )
// fetch all boxes first & extract their IDs
osem := core . NewOsemClient ( viper . GetString ( "api" ) )
boxes , err := osem . GetAllBoxes ( )
if err != nil {
return err
}
boxIDs := make ( [ ] string , len ( * boxes ) )
for i , box := range * boxes {
boxIDs [ i ] = box . Id
}
// then check each box individually. we only pass the ID
// and fetch again, because box metadata is different in
// GetAllBoxes and GetBox..
return checkAndNotify ( boxIDs )
}
func checkAndNotify ( boxIds [ ] string ) error {
func checkAndNotify ( boxIds [ ] string ) error {
boxLocalConfig := map [ string ] * core . NotifyConfig { }
boxLocalConfig := map [ string ] * core . NotifyConfig { }
for _ , boxID := range boxIds {
for _ , boxID := range boxIds {