Commit ef7a808c authored by charankumar's avatar charankumar

Modified

parent d33b9882
...@@ -7,7 +7,8 @@ log: ...@@ -7,7 +7,8 @@ log:
back_up_count: 10 back_up_count: 10
mongo_db: mongo_db:
URI: mongodb://192.168.0.220:2717/ URI: mongodb://ilens:iLens%231234@192.168.0.207:2117/ilens_configuration?authSource=admin
URI_: mongodb://192.168.0.220:2717
REDIS: REDIS:
REDIS_HOST: 192.168.0.220 REDIS_HOST: 192.168.0.220
......
...@@ -5,16 +5,32 @@ from scripts.handler.rule_engine_update import RuleUpdate ...@@ -5,16 +5,32 @@ from scripts.handler.rule_engine_update import RuleUpdate
if __name__ == '__main__': if __name__ == '__main__':
try: try:
logger.debug("main block started") logger.debug("main block started")
status = RuleUpdate().rule_update() # status = RuleUpdate().rule_update(request_payload)
if status: # status = RuleUpdate().fetch_hireares('MODBUS_DELTA_UPDATED')
print("Created successfully") lst = [["rule_errorcode_1", "tag_194", "tag_352", "rule_engine_131"],
else: ["rule_errorcode_2", "tag_197", "tag_353", "rule_engine_132"],
print("Some records are not created successfully, Please check the log file") ["rule_errorcode_3", "tag_200", "tag_354", "rule_engine_133"],
["rule_errorcode_4", "tag_202", "tag_355", "rule_engine_134"],
["rule_errorcode_5", "tag_205", "tag_356", "rule_engine_135"],
["rule_errorcode_6", "tag_207", "tag_357", "rule_engine_136"],
["rule_errorcode_7", "tag_208", "tag_358", "rule_engine_137"],
["rule_errorcode_8", "tag_209", "tag_359", "rule_engine_139"],
["rule_errorcode_9", "tag_210", "tag_360", "rule_engine_140"]]
for each in lst:
status = RuleUpdate().fetch_hireares('MODBUS_DELTA_UPDATED',
each[0].split('rule_')[0],
input_tag=each[1],
output_tag=each[2],
rule_id=each[-1],
lookup_name=each[0])
# status = RuleUpdate().rule_update(request_payload, 'error_code_1')
if status.get('status') == 'success':
print(f"Created successfully: {each}")
else:
print("Some records are not created successfully, Please check the log file")
except RequiredFieldsMissing: except RequiredFieldsMissing:
logger.exception("Required Fields are missing in the static JSON") logger.exception("Required Fields are missing in the static JSON")
print("Required Fields are missing in the static JSON") print("Required Fields are missing in the static JSON")
except Exception as e: except Exception as e:
logger.exception("Exception in the main block" + str(e)) logger.exception("Exception in the main block" + str(e))
print("Exception in the main block" + str(e)) print("Exception in the main block" + str(e))
...@@ -359,7 +359,7 @@ class RuleConfigurationHandler(object): ...@@ -359,7 +359,7 @@ class RuleConfigurationHandler(object):
this will check whether that rule already exists while creations this will check whether that rule already exists while creations
""" """
exists = self.rules_mongo.find_one_rule(query={"ruleName": input_data["ruleName"]}) exists = self.rules_mongo.find_one_rule(query={"ruleName": input_data["ruleName"]})
if exists is not None: if exists:
return True return True
else: else:
return False return False
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment