Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iadmin returns exit code of zero on some types of failures #7734

Open
stsnel opened this issue May 6, 2024 · 1 comment
Open

iadmin returns exit code of zero on some types of failures #7734

stsnel opened this issue May 6, 2024 · 1 comment

Comments

@stsnel
Copy link
Collaborator

stsnel commented May 6, 2024

Bug Report

iRODS Version, OS and Version

Reproduced with iRODS 4.2.12 and 4.3.2, both CentOS 7 and Ubuntu 20.04 LTS.

What did you try to do?

Run iadmin commands that resulted in a failure (see observed behaviour below for examples)

Expected behavior

If an iadmin command fails, it should return a non-zero exit code, so that any scripts that invoked the command can tell that it failed.

Observed behavior (including steps to reproduce, if applicable)

iadmin returns a zero exit code in at least the following situations:

Invalid iadmin command:

irods@provider:~$ iadmin commanddoesnotexist
unrecognized command, try 'help'
irods@provider:~$ echo $?
0

ModRepl with invalid parameters:

irods@provider:~$ iadmin modrepl foo bar baz
An error occurred:
Input arguments do not match expected values.
irods@provider:~$ echo $?
0

ModRepl with non-existent data object:

irods@provider:~$ iadmin modrepl logical_path /tempZone/object/does/not/exist replica_number 0 DATA_COMMENTS something
rcModDataObjMeta failed when modifying replica: [CAT_UNKNOWN_COLLECTION (-814000)]
Level 0: collection '/tempZone/object/does/not' is unknown
Level 0: collection '/tempZone/object/does/not' is unknown
irods@provider:~$ echo $?
0

ModRepl with non-existent replica number:

irods@provider:~$ iadmin modrepl logical_path /tempZone/home/rods/test.txt replica_number 123 DATA_COMMENTS something
rcModDataObjMeta failed when modifying replica: [CAT_SUCCESS_BUT_WITH_NO_INFO (-819000)]
irods@provider:~$ echo $?
0

ModRepl with invalid replica number:

irods@provider:~$ iadmin modrepl logical_path /tempZone/home/rods/test.txt replica_number abc DATA_COMMENTS something
An error occurred:
Invalid input [abc] for replica_number.
irods@provider:~$ echo $?
0

ModRepl with invalid data object ID:

irods@provider:~$ iadmin modrepl data_id abc replica_number 123456789 DATA_COMMENTS something
An error occurred:
Invalid input [abc] for data_id.
irods@provider:~$ echo $?
0

ModRepl with non-existent data object ID:

irods@provider:~$ iadmin modrepl data_id 1234567 replica_number 123456789 DATA_COMMENTS something
rcModDataObjMeta failed when modifying replica: [CAT_SUCCESS_BUT_WITH_NO_INFO (-819000)]
irods@provider:~$ echo $?
0
@trel
Copy link
Member

trel commented May 6, 2024

Agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants