Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 973330

Summary: --sample_json fails late if directory does not exist
Product: [Retired] Subscription Asset Manager Reporter: Chris Duryee <cduryee>
Component: SpliceAssignee: James Slagle <jslagle>
Status: CLOSED ERRATA QA Contact: mkovacik
Severity: low Docs Contact:
Priority: unspecified    
Version: 1.3CC: jmatthew, jslagle, vkuznets
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-01 10:56:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 833466    

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