Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
Signed-off-by: SudhanshuBawane <sudhanshu.bawane.ctr@sumologic.com>
  • Loading branch information
SudhanshuBawane committed Mar 8, 2024
1 parent cc0df4b commit 2175543
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions backend/agentd/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,70 +70,6 @@ func GetEntityConfigWatcher(ctx context.Context, client *clientv3.Client) <-chan
return ch
}

// GetUserConfigWatcher watches changes to the UserConfig in etcd and publish them -- git#2806
// over the bus as store.WatchEventUserConfig
//func GetUserConfigWatcher(ctx context.Context, client *clientv3.Client) <-chan store.WatchEventUserConfig {
// //ctx, cancel := context.WithCancel(context.Background())
// //defer cancel()
//
// key := etcdstorev2.StoreKey(storev2.ResourceRequest{
// Context: ctx,
// StoreName: new(corev2.User).StoreName(),
// })
// w := etcdstore.Watch(ctx, client, key, true)
// fmt.Sprintf("======= user metadata ========= w : %v, ctx : %v, client: %v, key: %v", w, ctx, client, key)
// ch := make(chan store.WatchEventUserConfig, 1)
//
// go func() {
// defer close(ch)
// for response := range w.Result() {
// fmt.Println("======= user config response ========", response)
// if response.Type == store.WatchError {
// logger.
// WithError(errors.New(string(response.Object))).
// Error("Unexpected error while watching for the user config updates")
// ch <- store.WatchEventUserConfig{
// Action: response.Type,
// }
// continue
// }
// //var (
// // configWrapper wrap.Wrapper
// // userConfig corev2.User
// //)
//
// // Decode and unwrap the user config
//
// //if err := proto.Unmarshal(response.Object, &configWrapper); err != nil {
// // fmt.Println("====== unmarshaled user =======", configWrapper)
// // logger.WithField("key", response.Key).WithError(err).
// // Error("unable to unmarshal user config from key")
// // continue
// //}
//
// //if err := configWrapper.UnwrapInto(&userConfig); err != nil {
// // fmt.Println("====== unmarshaled user =======", userConfig)
// // logger.WithField("key", response.Key).WithError(err).
// // Error("unable to unwrap entity config from key")
// // continue
// //}
//
// // Remove the managed_by label if the value is sensu-agent, in case the user is disabled
// //if userConfig.GetMetadata().Labels[corev2.ManagedByLabel] == "sensu-agent" {
// // delete(userConfig.GetMetadata().Labels, corev2.ManagedByLabel)
// //}
//
// ch <- store.WatchEventUserConfig{
// User: &corev2.User{},
// Action: response.Type,
// }
// }
// }()
//
// logger.Println("========= watch metadata ========", w)
// return ch
//}

// GetUserConfigWatcher watches changes to the UserConfig in etcd and publish them -- git#2806
// over the bus as store.WatchEventUserConfig
func GetUserConfigWatcher(ctx context.Context, client *clientv3.Client) <-chan *store.WatchEventUserConfig {
Expand Down

0 comments on commit 2175543

Please sign in to comment.