Bug 973330 - --sample_json fails late if directory does not exist
--sample_json fails late if directory does not exist
Status: CLOSED ERRATA
Product: Subscription Asset Manager
Classification: Red Hat
Component: Splice (Show other bugs)
1.3
Unspecified Unspecified
unspecified Severity low
: rc
: ---
Assigned To: James Slagle
mkovacik
:
Depends On:
Blocks: sam13-tracker
  Show dependency treegraph
 
Reported: 2013-06-11 13:10 EDT by Chris Duryee
Modified: 2013-10-01 06:56 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-01 06:56:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Chris Duryee 2013-06-11 13:10:06 EDT
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 07:06:59 EDT
commit a170572680431783aa2fef20cb9312e1f7ca9ffd

sst now checks for the directory and if it's writeable
Comment 2 Vitaly Kuznetsov 2013-06-21 09:02:40 EDT
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 06:56:19 EDT
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.