Skip to content

Commit bb4582f

Browse files
author
Tony Edgin
committed
DS-829: fixed bugs in cyverse_getDataPath
1 parent 21dedc6 commit bb4582f

5 files changed

Lines changed: 57 additions & 25 deletions

File tree

playbooks/files/irods/etc/irods/cyverse.re

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,12 @@ cyverse_getDataId(*Path) =
268268
# RETURNS:
269269
# It return the absolute path to the object if it exists, otherwise it returns /
270270
#
271-
# XXX: As of iRODS 4.3.1, having `KeyValPair_PI` as a return type causes issues
272-
# for dynamic typing
273-
# cyverse_getDataInfo : forall X in {path string}, X -> `KeyValPair_PI`
274-
# XXX: ^^^
271+
cyverse_getDataPath : int -> path
275272
cyverse_getDataPath(*Id) =
276273
# XXX - As of iRODS 4.3.1, deferred rules don't propagate ticket information
277-
# let *path = '' in
274+
# let *path = / in
278275
# let *_ = foreach (*rec in SELECT COLL_NAME, DATA_NAME WHERE DATA_ID = '*Id') {
279-
# *path = *rec.COLL_NAME ++ '/' ++ *rec.DATA_NAME;
276+
# *path = /(*rec.COLL_NAME ++ '/' ++ *rec.DATA_NAME);
280277
# } in
281278
# *path
282279
let *fmtArg = execCmdArg('%s/%s') in
@@ -287,11 +284,11 @@ cyverse_getDataPath(*Id) =
287284
then
288285
let *_ = msiGetStderrInExecCmdOut(*resp, *msg) in
289286
let *_ = writeLine('serverLog', 'failed to resolve data object *Id: *err (*msg)') in
290-
''
287+
/
291288
else
292289
let *_ = msiGetStdoutInExecCmdOut(*resp, *path) in
293290
let *path = trimr(*path, '\n') in
294-
*path
291+
/*path
295292
# XXX - ^^^
296293
297294
@@ -306,7 +303,10 @@ cyverse_getDataPath(*Id) =
306303
# 'ownerZone' holds the authentication zone for the owner. If the data object
307304
# doesn't exist, all values are left empty.
308305
#
309-
cyverse_getDataInfo : forall X in {path string}, X -> `KeyValPair_PI`
306+
# XXX: As of iRODS 4.3.1, having `KeyValPair_PI` as a return type causes issues
307+
# for dynamic typing
308+
# cyverse_getDataInfo : forall X in {path string}, X -> `KeyValPair_PI`
309+
# XXX: ^^^
310310
cyverse_getDataInfo(*Path) =
311311
let *info.'size' = '' in
312312
let *info.'type' = '' in

playbooks/files/irods/etc/irods/cyverse_core.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ pep_database_close_finally(*Instance, *Context, *OUT) {
12221222
pep_database_mod_data_obj_meta_post(*Instance, *Context, *OUT, *DataObjInfo, *RegParam) {
12231223
*handled = false;
12241224
*logicalPath = if *DataObjInfo.logical_path != ''
1225-
then *DataObjInfo.logical_path
1225+
then /*DataObjInfo.logical_path
12261226
else cyverse_getDataPath(int(*DataObjInfo.data_id));
12271227
# XXX - Because of https://github.com/irods/irods/issues/5540,
12281228
# _cyverse_core_dataObjCreated needs to be called here when not created through file

playbooks/files/irods/etc/irods/cyverse_repl.re

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
_repl_replicate(*Object, *RescName) {
4343
_repl_logMsg('replicating data object *Object to *RescName');
4444

45-
*objPath = cyverse_getDataPath(*Object);
45+
*objPath = str(cyverse_getDataPath(*Object));
4646

47-
if (*objPath == '') {
47+
if (*objPath == '/') {
4848
_repl_logMsg('data object *Object no longer exists');
4949
} else {
5050
temporaryStorage.cyverse_repl_replicate = 'REPL_FORCED_REPL_RESC';
@@ -89,7 +89,7 @@ _repl_mvReplicas(*Object, *IngestName, *ReplName) {
8989
9090
*dataPath = cyverse_getDataPath(*Object);
9191
92-
if (*dataPath != '') {
92+
if (*dataPath != /) {
9393
*replFail = false;
9494
9595
if (_repl_replicate(*Object, *IngestName) < 0) {
@@ -112,7 +112,7 @@ _repl_mvReplicas(*Object, *IngestName, *ReplName) {
112112
*replNum = *rec.DATA_REPL_NUM;
113113

114114
if (!(*rescHier like regex '^(*IngestName|*ReplName)(;.*)?$')) {
115-
if (errorcode(msiDataObjTrim(*dataPath, 'null', *replNum, '1', 'null', *status)) < 0) {
115+
if (errorcode(msiDataObjTrim(str(*dataPath), 'null', *replNum, '1', 'null', *status)) < 0) {
116116
_repl_logMsg('failed to trim replica of *Object on *rescHier (*status)');
117117
*replFail = true;
118118
}
@@ -132,9 +132,9 @@ _repl_mvReplicas(*Object, *IngestName, *ReplName) {
132132
_repl_syncReplicas(*Object) {
133133
_repl_logMsg('syncing replicas of data object *Object');
134134

135-
*dataPath = cyverse_getDataPath(*Object);
135+
*dataPath = str(cyverse_getDataPath(*Object));
136136

137-
if (*dataPath == '') {
137+
if (*dataPath == '/') {
138138
_repl_logMsg('data object *Object no longer exists');
139139
} else {
140140
# XXX - As of iRODS 4.3.1, ticket information doesn't get sent to deferred rules.

playbooks/tests/rules/cyverse.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,45 @@ def test_write_only_append_create(self):
243243
"""Verify cyverse_OPEN_FLAG_A_CREATE"""
244244
self.fn_test('cyverse_OPEN_FLAG_A_CREATE', [], IrodsVal.string('65'))
245245

246-
@unittest.skip("not implemented")
247246
def test_read_write_append_create(self):
248247
"""Verify cyverse_OPEN_FLAG_AP_CREATE"""
248+
self.fn_test('cyverse_OPEN_FLAG_AP_CREATE', [], IrodsVal.string('66'))
249+
250+
@unittest.skip("not implemented")
251+
def test_repltruncated_openflagr(self):
252+
"""Test cyverse_replTruncated handling of cyverse_OPEN_FLAG_R"""
253+
254+
@unittest.skip("not implemented")
255+
def test_repltruncated_openflagrp(self):
256+
"""Test cyverse_replTruncated handling of cyverse_OPEN_FLAG_RP"""
257+
258+
@unittest.skip("not implemented")
259+
def test_repltruncated_openflagw(self):
260+
"""Test cyverse_replTruncated handling of cyverse_OPEN_FLAG_W"""
261+
262+
@unittest.skip("not implemented")
263+
def test_repltruncated_openflagwcreate(self):
264+
"""Test cyverse_replTruncated handling of cyverse_OPEN_FLAG_W_CREATE"""
265+
266+
@unittest.skip("not implemented")
267+
def test_repltruncated_openflagwp(self):
268+
"""Test cyverse_replTruncated handling of cyverse_OPEN_FLAG_WP"""
269+
270+
@unittest.skip("not implemented")
271+
def test_repltruncated_openflagwpcreate(self):
272+
"""Test cyverse_replTruncated handling of cyverse_OPEN_FLAG_WP_CREATE"""
273+
274+
@unittest.skip("not implemented")
275+
def test_repltruncated_openflaga(self):
276+
"""Test cyverse_replTruncated handling of cyverse_OPEN_FLAG_A"""
277+
278+
@unittest.skip("not implemented")
279+
def test_repltruncated_openflagacreate(self):
280+
"""Test cyverse_replTruncated handling of cyverse_OPEN_FLAG_A_CREATE"""
249281

250282
@unittest.skip("not implemented")
251-
def test_repltruncated(self):
252-
"""Test cyverse_replTruncated"""
283+
def test_repltruncated_openflagapcreate(self):
284+
"""Test cyverse_replTruncated handling of cyverse_OPEN_FLAG_AP_CREATE"""
253285

254286

255287
class CyverseIscoll(CyverseTestCase):

playbooks/tests/rules/cyverse_core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def verify_msg_logged(self, msg_frag) -> bool:
7373

7474

7575
class CyverseCoreMkdataobjsessvarTest(CyverseCoreTestCase):
76-
"""Tests of _cyverse_core_mkDataObjSessVar"""
76+
"""Tests of _cyverse_core_mkDataObjSessVar"""
7777

7878
def test(self):
7979
"""Test it"""
@@ -292,9 +292,13 @@ def test_trash_coll(self):
292292
class Acdatadeletepolicy(CyverseCoreTestCase):
293293
"""Tests of acDataDeletePolicy"""
294294

295-
@unittest.skip("not implemented")
296295
def test_cyverselogic_called(self):
297296
"""Verify that the cyverse_logic.re is called"""
297+
objPath = iRODSPath(self.irods.zone, 'home', self.irods.username, 'obj')
298+
obj = self.irods.data_objects.create(objPath)
299+
obj.unlink(force=True)
300+
if not self.verify_msg_logged(f"cyverse_logic_acDataDeletePolicy({objPath})"):
301+
self.fail("cyverse_logic_acDataDeletePolicy not called")
298302

299303

300304
class Acsetrescschemeforcreate(CyverseCoreTestCase):
@@ -650,10 +654,6 @@ class PepApiStructFileExtAndRegPre(CyverseCoreTestCase):
650654
class CyverseCorePublicTest(CyverseCoreTestCase):
651655
"""Test the public entities cyverse_core.re rule-base"""
652656

653-
@unittest.skip("not implemented")
654-
def test_acdeletecollbyadmin(self):
655-
"""Test acDeleteCollByAdmin"""
656-
657657
@unittest.skip("not implemented")
658658
def test_acdeleteobjbyadminifpresent(self):
659659
"""Test acDeleteObjByAdminIfPresent"""

0 commit comments

Comments
 (0)