Project

General

Profile

Actions

Feature #2275

closed

ndnsec-delete: report success or failure

Added by Alex Afanasyev about 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Utils
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

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"
Actions #1

Updated by Junxiao Shi about 10 years ago

  • 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
Actions #2

Updated by Yingdi Yu about 10 years ago

  • Status changed from New to Code review
  • % Done changed from 0 to 100
Actions #3

Updated by Junxiao Shi almost 10 years ago

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.

Actions #4

Updated by Alex Afanasyev almost 10 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF