Bug 807630

Summary: csprocessor complains about directory when *file* exists
Product: [Community] PressGang CCMS Reporter: Joshua Wulf <jwulf>
Component: CSProcessorAssignee: Lee Newson <lnewson>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.xCC: jwulf, lcarlon
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 0.22.6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-07 01:31:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Joshua Wulf 2012-03-28 11:34:51 UTC
[jwulf@nitai scratch]$ csprocessor create Test_Book_Template 
CSProcessor client version: 0.22.5
Loading configuration from /home/jwulf/.config/csprocessor.ini
Connecting to Skynet server: http://skynet.usersys.redhat.com:8080/TopicIndex/

ERROR: A directory already exists for the Content Specification. Please check the "/home/jwulf/public_html/scratch/Test_Book_Template" directory first and if it's correct, then use the --force option.


Test_Book_Template exists, but is actually the content spec file that I'm checking in.

[jwulf@nitai scratch]$ ls
Content_Spec_Processor_2  Content_Spec_Processor_2~  Content_Spec_Processor_Guide  Docbook+RDFa  Existing_Content_Spec  Existing_Content_Spec_Tutorial  Test_Book_Template


Not sure if there is a strategy to deal with this situation (other than telling people to name the content spec something else - or perhaps the Name[+1] approach); but maybe csprocessor could check if it's in fact a file or a directory and give an appropriate error.

Suggestion: 
"A file named Test_Book_Template exists here. You could move this file, or execute this command in another directory."

"A directory named Test_Book_Template already exists here. You could move this directory, execute this command in another directory, or overwrite the Test_Book_Template directory using the --force option."

cspclient-0.22.5-1.noarch
OS: Fedora release 16 (Verne)

JAVA: java version "1.7.0_b147-icedtea"
OpenJDK Runtime Environment (fedora-2.1.fc16.1-x86_64)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)

Comment 1 Lee Newson 2012-03-28 23:17:38 UTC
Fixed in 0.22.6

Really you should be using identifying methods (ie filename extensions) but none the less I've done a fix.

Cause:
The check wasn't checking if the output was a file or a directory.

Consequence:
An error message would be displayed on the create command if a file existed that had the same name as the output directory.

Fix:
Make the check see if the output is a file or a directory. If its a directory print the error message, otherwise continue with the normal processing.

Note: there is no need to print an error message if the file exists. it is only relevant for directories.

Comment 2 Lee Newson 2013-06-07 01:31:35 UTC
Closing and setting as current release as no QA was performed by the original reporter. If there is still an issue with this bug still than please re-open it.