Feature #2275
closed
ndnsec-delete: report success or failure
Added by Alex Afanasyev almost 10 years ago.
Updated almost 10 years ago.
Description
In some cases ndnsec-delete
doesn't really delete anything (either something doesn't exist or identity is "default").
The status of the action needs to be reported on terminal:
- "Identity XXX, all its keys and certificates has been deleted"
- "Identity XXX does not exist"
- "Cannot delete default identity XXX"
- Tracker changed from Task to Feature
- Subject changed from ndnsec-delete doesn't report success or failure to ndnsec-delete: report success or failure
I agree with this feature in general, but:
- stdout shall have a consistent, machine readable format, such as the list of identities/certificates that have been deleted, which is empty if nothing is deleted; this allows the output to be analyzed by a script easily
- stderr could have human readable messages, which can be suppressed by
-q
option
- return value shall reflect success or reason for failure
- Status changed from New to Code review
- % Done changed from 0 to 100
The solution in commit 0359e88fee08f21c61d03a2982b3584bc4aafbc0 causes ndnsec-delete
to return 1 for the following conditions:
- incorrect command line syntax
- entity to be deleted does not exist
- other exceptions
The second condition is worth a distinct return value.
In some cases the caller only wants to ensure the entity does not exist after the call, regardless of whether it exists before the call.
Giving this condition a distinct return value allows the caller to achieve this goal.
I suggest returning 1 on the non-existent condition, and returning 2 for other conditions.
This is better than returning 2 on the non-existent condition, and returning 1 for other conditions, because it allows the caller to simply write [[ $? -le 1 ]]
in bash without first assigning $?
to a named variable.
- Status changed from Code review to Closed
Also available in: Atom
PDF