Bug 973330 - --sample_json fails late if directory does not exist
Summary: --sample_json fails late if directory does not exist
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Subscription Asset Manager
Classification: Retired
Component: Splice
Version: 1.3
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: James Slagle
QA Contact: mkovacik
URL:
Whiteboard:
Depends On:
Blocks: sam13-tracker
TreeView+ depends on / blocked
 
Reported: 2013-06-11 17:10 UTC by Chris Duryee
Modified: 2013-10-01 10:56 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-10-01 10:56:19 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2013:1390 0 normal SHIPPED_LIVE Release 1.3 of Subscription Asset Manager 2013-10-01 14:43:14 UTC

Description Chris Duryee 2013-06-11 17:10:06 UTC
Description of problem: If you do spacewalk-splice-checkin --splice-sync --sample_json=<dir> run without <dir> existing, the run will succeed (good), but it will not create the sample_json dir.

The script should probably check that the dir exists and has the correct permissions before starting. This prevents users from having to run the script a second time (possibly a lengthy operation) after fixing the error.


Version-Release number of selected component (if applicable): 0.19


How reproducible: every time


Steps to Reproduce:
1. run spacewalk-splice-checkin --splice-sync --sample_json=<dir that does not exist>

Actual results:
[root@dhcp129-162 spacewalk-splice-tool]#  spacewalk-splice-checkin --splice-sync --sample_json=foo                                         
2013-06-11 16:52:04,334 INFO spacewalk_splice_tool.checkin checkin:main: run starting
2013-06-11 16:52:04,335 INFO spacewalk_splice_tool.checkin checkin:splice_sync: Started syncing system data to splice
2013-06-11 16:58:51,144 INFO spacewalk_splice_tool.checkin checkin:splice_sync: calculating marketing product usage
2013-06-11 17:00:38,504 INFO spacewalk_splice_tool.checkin checkin:splice_sync: uploading to splice...
2013-06-11 17:00:38,505 INFO spacewalk_splice_tool.checkin checkin:build_server_metadata: building server metadata
2013-06-11 17:00:38,519 INFO spacewalk_splice_tool.checkin checkin:write_file: Directory doesn't exist: foo
2013-06-11 17:00:38,520 INFO spacewalk_splice_tool.checkin checkin:write_file: Directory doesn't exist: foo
2013-06-11 17:00:38,520 INFO spacewalk_splice_tool.checkin checkin:upload_to_rcs: sending metadata to server
2013-06-11 17:00:38,564 INFO splice.common.connect connect:_request: Sending 'POST' to '/splice/api//v1/spliceserver/' 
        with headers '{'Content-type': 'application/json', 'Accept': 'application/json'}'
2013-06-11 17:00:41,834 INFO splice.common.connect connect:_request: Received '204' from 'POST /splice/api//v1/spliceserver/'
2013-06-11 17:00:41,835 DEBUG spacewalk_splice_tool.checkin checkin:upload_to_rcs: POST to /v1/spliceserver/: received 204 
2013-06-11 17:00:42,257 INFO splice.common.connect connect:_request: Sending 'POST' to '/splice/api//v1/marketingproductusage/' 
        with headers '{'Content-type': 'application/json', 'Accept': 'application/json'}'
2013-06-11 17:00:47,506 INFO splice.common.connect connect:_request: Received '204' from 'POST /splice/api//v1/marketingproductusage/'
2013-06-11 17:00:47,519 DEBUG spacewalk_splice_tool.checkin checkin:upload_to_rcs: POST to /v1/marketingproductusage/: received 204 
Upload was successful


Expected results: script fails immediately with an error message, so user can fix directory issue

Additional info: I marked this as "low" because it is a debugging option that users wouldn't be using frequently.

Comment 1 James Slagle 2013-06-19 11:06:59 UTC
commit a170572680431783aa2fef20cb9312e1f7ca9ffd

sst now checks for the directory and if it's writeable

Comment 2 Vitaly Kuznetsov 2013-06-21 13:02:40 UTC
Verified in spacewalk-splice-tool-0.24-1.el6sam.x86_64

# spacewalk-splice-checkin --splice-sync --sample_json=/the/wrong/path
2013-06-21 09:01:58,914 ERROR __main__ spacewalk-splice-checkin:<module>: Directory /the/wrong/path for sample json does not exist.

Comment 5 errata-xmlrpc 2013-10-01 10:56:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1390.html


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