irods / irods_rule_engine_plugin_logical_quotas

BSD 3-Clause "New" or "Revised" License
1 stars 9 forks source link

Native rule engine instance fails with `logical_quotas_get_collection_status` operation #81

Closed mstfdkmn closed 3 weeks ago

mstfdkmn commented 1 year ago

We are running iRODS 4.2.11 on Centos7

iRODS native rule language instance cannot succeed calling the operation of logical_quotas_get_collection_status. But the rule language of logical quota itself - irods_rule_engine_plugin-logical_quotas-instance - can execute without generating any error.

result on the client side with irods_rule_engine_plugin-irods_rule_language-instance:

(base) u0137480@CRD-L-07856:~/projects/irods-acl-management$ irule -r irods_rule_engine_plugin-irods_rule_language-instance 'logical_quotas_get_collection_status("/icts_icts/home/u0137480")' null ruleExec
remote addresses: 10.114.56.34 ERROR: rcExecMyRule error.  status = -1214000 RE_UNABLE_TO_WRITE_VAR
Level 0: DEBUG:

logs:

[2022-11-28T20:12:10.307Z][icts-t-cloud-hev-3] rsyslogd stdout | 2022-11-28T21:12:10.306763+01:00 icts rodsServer[539673]: icts_icts - NOTICE: execMyRule @external rule { logical_quotas_get_collection_status("/icts_icts/home/u0137480") } Failed with status -1214000
[2022-11-28T20:12:10.307Z][icts-t-cloud-hev-3] rsyslogd stdout | 2022-11-28T21:12:10.306709+01:00 icts rodsServer[539673]: icts_icts - NOTICE: execRuleNodeRes: applyRule Failed: rule with status -1214000
[2022-11-28T20:12:10.307Z][icts-t-cloud-hev-3] rsyslogd stdout | 2022-11-28T21:12:10.306678+01:00 icts rodsServer[539673]: icts_icts - NOTICE: executeRuleBody: Microservice or Action logical_quotas_get_collection_status Failed with status -1214000
[2022-11-28T20:12:10.307Z][icts-t-cloud-hev-3] rsyslogd stdout | 2022-11-28T21:12:10.306661+01:00 icts rodsServer[539673]: icts_icts - remote addresses: 127.0.0.1, 2a02:2c40:0:221::3306:10 ERROR: executeRuleAction Failed for logical_quotas_get_collection_status status = -1214000 RE_UNABLE_TO_WRITE_VAR
[2022-11-28T20:12:10.308Z][icts-t-cloud-hev-3] rsyslogd stdout | 2022-11-28T21:12:10.306897+01:00 icts rodsServer[539673]: icts_icts - remote addresses: 127.0.0.1, 2a02:2c40:0:221::3306:10 ERROR: rsExecMyRule : -1214000, [-]#011/work/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/libirods_rule_engine_plugin-irods_rule_language.cpp:391:irods::error exec_rule_text(irods::default_re_ctx &, const std::string &, msParamArray_t *, const std::string &, irods::callback) :  status [RE_UNABLE_TO_WRITE_VAR]  errno [] -- message [execMyRule failed for rule @external rule { logical_quotas_get_collection_status("/icts_icts/home/u0137480") }]#012

result on the client side with irods_rule_engine_plugin-logical_quotas-instance:

(base) u0137480@CRD-L-07856:~/projects/irods-acl-management$ irule -r irods_rule_engine_plugin-logical_quotas-instance '{"operation": "logical_quotas_get_collection_status", "collection": "/icts_icts/home/u0137480"}' null ruleExecOut
{"irods::logical_quotas::total_number_of_data_objects":"18","irods::logical_quotas::total_size_in_bytes":"192710031"}
korydraughn commented 1 year ago

I noticed in your NREP invocation you passed ruleExec instead of ruleExecOut as the final command line argument.

Please try changing ruleExec to ruleExecOut and see what you get.

mstfdkmn commented 1 year ago

Hi Kory, I guess wrongly pasted here but tried one more time and the result is same. Also, I first encountered this via PRC

(base) u0137480@CRD-L-07856:~/projects/irods-acl-management$ irule -r irods_rule_engine_plugin-irods_rule_language-instance 'logical_quotas_get_collection_status("/icts_icts/home/u0137480")' null ruleExecOut
remote addresses: 10.114.56.34 ERROR: rcExecMyRule error.  status = -1214000 RE_UNABLE_TO_WRITE_VAR
Level 0: DEBUG:
korydraughn commented 1 year ago

Thanks. We'll investigate.

korydraughn commented 3 weeks ago

When fetching the status via the NREP, the rule expects a second variable to be passed for storing the output. See the following code snippet.

https://github.com/irods/irods_rule_engine_plugin_logical_quotas/blob/7703b7e8ec3a802715d1742b7fca1f8ff1fc52b4/src/handler.cpp#L508-L512

I've verified this against 4.2.11 and tip of main (b285ba0).

Below is the invocation you want.

irule -r irods_rule_engine_plugin-irods_rule_language-instance 'logical_quotas_get_collection_status("/tempZone/home/rods", *r)' '*r=' '*r'

If you don't want to define *r via the INPUT component, you can use the following.

irule -r irods_rule_engine_plugin-irods_rule_language-instance '*r = ""; logical_quotas_get_collection_status("/tempZone/home/rods", *r)' null '*r'