Skip to content

Commit

Permalink
Adding more
Browse files Browse the repository at this point in the history
  • Loading branch information
rmurray-r7 committed Nov 20, 2024
1 parent e59c01f commit 66b3773
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions plugins/redis/bin/komand_redis
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def main():
monkey.patch_all()

import insightconnect_plugin_runtime
import sys
sys.path.append(os.path.abspath("../"))
from komand_redis import connection, actions, triggers, tasks

class ICONRedis(insightconnect_plugin_runtime.Plugin):
Expand Down
16 changes: 10 additions & 6 deletions plugins/redis/komand_redis/actions/hmget/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@ def run(self, params={}):
try:
if get_all:
result = self.connection.redis.hgetall(key)
if result:
v = {}
for key, val in result.items():
v[key.decode("utf-8")] = val.decode("utf-8")
result = v
else:
result = self.connection.redis.hmget(key, fields)
if result:
v = {}
for item in range(0, len(result)):
v[fields[item]] = result[item].decode("utf-8")
result = v
except Exception as e:
self.logger.error("An error occurred while running HMSET: ", e)
raise

if result:
v = {}
for key, val in result.items():
v[key.decode("utf-8")] = val.decode("utf-8")
result = v

return {"values": result}

def test(self):
Expand Down

0 comments on commit 66b3773

Please sign in to comment.