Bug 766411 - Skynet client exit values are not consistent
Summary: Skynet client exit values are not consistent
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: PressGang CCMS
Classification: Community
Component: CSProcessor
Version: 1.x
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Lee Newson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 766413
TreeView+ depends on / blocked
 
Reported: 2011-12-12 01:28 UTC by Joshua Wulf
Modified: 2014-10-19 22:59 UTC (History)
2 users (show)

Fixed In Version: 0.16.3
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-20 07:53:09 UTC


Attachments (Terms of Use)

Description Joshua Wulf 2011-12-12 01:28:00 UTC
File not found gives me an exit value of 6:

java -jar /home/jwulf/Skynet/skynet.jar push -cn post-14.spec
Skynet client version: 0.15.0
Loading configuration from /home/jwulf/.config/skynet.ini
Web Service at http://localhost:8080/ version: 0.19.0


Error: Cannot find the specified file!

java -jar skynet.jar push [OPTIONS] [FILENAME]
  OPTIONS:
    --contentspec, -c
    --edit, -e
    --exec-time
    --new, -n
    --permissive, -p
    --tagsmap, -T

  FILENAME - The name/location of the file to be uploaded.
Exit value: 6
--------------------------------------------------------------------------

Mode doesn't match gives me an exit value of 0:


java -jar /home/jwulf/Skynet/skynet.jar push -cn post-Writing_with_Topics.spec
Skynet client version: 0.15.0
Loading configuration from /home/jwulf/.config/skynet.ini
Web Service at http://localhost:8080/ version: 0.19.0

ERROR: Mode does not match the contents of the Content Specification.
Exit value: 0

-------------------------------------------------------------------------------
Successful push gives me an exit value of 0:


java -jar /home/jwulf/Skynet/skynet.jar push -cn post-Writing_with_Topics.spec
Skynet client version: 0.15.0
Loading configuration from /home/jwulf/.config/skynet.ini
Web Service at http://localhost:8080/ version: 0.19.0

INFO:  The Content Specification is valid.
WARN:  Note: All descriptions, tags, source urls and writers will be ignored for existing Topics.
INFO:  The Content Specification saved successfully.
Content Specification ID: 14
Revision: 62
Exit value: 0
------------------------------------------------------------------------------



So I cannot reliably tell if the push succeeded or failed based on the exit value.

Comment 1 Lee Newson 2012-02-07 23:34:35 UTC
Fixed in 0.16.3.

This was caused by only giving exit values other then 0 when the client failed. This was because from a client perspective if it sends and receives data then it's request was a success. However this doesn't allow you to adequately use the exit values for scripting. So I've updated the client and server to send back a failure status if the server doesn't complete successfully. Below is a list of available exit values:

EXIT_SUCCESS = 0;
EXIT_FAILURE = 255; (Generic failure. Server failures are included in this)
EXIT_NO_SERVER = 1; (Can't find the server)
EXIT_UNAUTHORISED = 2; (The request to the server is unauthorised)
EXIT_INTERNAL_SERVER_ERROR = 3; (An Internal Server Error occurred on the server)
EXIT_CONFIG_ERROR = 4; (There was an error reading from the Configuration file)
EXIT_ARGUMENT_ERROR = 5; (There is an argument error in the command used)
EXIT_FILE_NOT_FOUND = 6; (Unable to find a file for push or validate commands)
EXIT_INVALID = 8; (A Topic or Content Spec is invalid)
EXIT_SERVER_ERROR = 9; (HTTP 400 & 405 status code errors)

Note: The below status exists in versions below 0.16.3. After 0.16.3 it has been changed to the generic EXIT_SUCCESS status.
EXIT_VALID = 7; (A topic is valid when the "validate -t" command is used.)


Note You need to log in before you can comment on or make changes to this bug.