diff options
author | Valery Piashchynski <[email protected]> | 2021-08-20 13:49:58 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-08-20 13:49:58 +0300 |
commit | d7d753a625764df61adc56f778e6b9fa846851c5 (patch) | |
tree | 304fa88ce4e92a0af0524af522fa7a294203d89b /plugins/jobs/drivers | |
parent | 7c155577ee9f7a4c19bd8aa04d7b44f908f0b5e7 (diff) |
Fix sqs maps parsing
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/jobs/drivers')
-rw-r--r-- | plugins/jobs/drivers/sqs/consumer.go | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/plugins/jobs/drivers/sqs/consumer.go b/plugins/jobs/drivers/sqs/consumer.go index 5d419b51..17af1caa 100644 --- a/plugins/jobs/drivers/sqs/consumer.go +++ b/plugins/jobs/drivers/sqs/consumer.go @@ -160,30 +160,16 @@ func FromPipeline(pipe *pipeline.Pipeline, log logger.Logger, cfg cfgPlugin.Conf globalCfg.InitDefault() - res := make(map[string]interface{}) - pipe.Map(attributes, res) - attr := make(map[string]string) - // accept only string values - for i := range res { - if v, ok := res[i].(string); ok { - attr[i] = v - } - } - - // delete all values with map.clear to reuse for the tags - for k := range res { - delete(res, k) + err = pipe.Map(attributes, attr) + if err != nil { + return nil, errors.E(op, err) } - pipe.Map(tags, res) - tg := make(map[string]string) - // accept only string values - for i := range res { - if v, ok := res[i].(string); ok { - attr[i] = v - } + err = pipe.Map(tags, tg) + if err != nil { + return nil, errors.E(op, err) } // initialize job consumer |