Bug 857203 - Invalid Related-To Relationship format error does not report line #
Invalid Related-To Relationship format error does not report line #
Status: CLOSED CURRENTRELEASE
Product: PressGang CCMS
Classification: Community
Component: CSProcessor (Show other bugs)
2.0
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: pressgang-ccms-dev
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-13 15:03 EDT by Stephen Gordon
Modified: 2013-06-06 21:30 EDT (History)
1 user (show)

See Also:
Fixed In Version: 0.26.7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-06-06 21:30:45 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 Stephen Gordon 2012-09-13 15:03:53 EDT
Description of problem:

Was sprinkling some additional relations throughout my content specification today, making mistakes as I went ;). Most of the time when pushing if an error is encountered with relations an error is reported, making it pretty easy to fix the spec and push again. I did however encounter this error which does not:

ERROR: Invalid Related-To Relationship format
ERROR: The Content Specification is not valid.

I eventually tracked down the relation that was invalid, but it would have been easier if the line number had been reported. The issue was a missing comma in the relation. Usually I think the CSP manages to print the line number for these but not this time. The relation in error (and the content it referred to) was as follows:

    [Related-to:
      T-Sect-Adding_NFS_Storage,
      T-Sect-Adding_iSCSI_Storage,
      Adding FCP Storage [7635]
      T-Sect-Adding_Local_Storage,
      T-SectAdding_POSIX_Compliant_File_System_Storage
      T-Sect-Populating_the_ISO_Domain
    ]     
    Section: Adding Storage to the Environment
      Section: Adding NFS Storage [T-Sect-Adding_NFS_Storage]
        Preparing NFS Storage [7539]
        Attaching NFS Storage [7540]
      Section: Adding iSCSI Storage [T-Sect-Adding_iSCSI_Storage]
        Adding iSCSI Storage [7633]
      Adding FCP Storage [7635]
      Section: Adding Local Storage [T-Sect-Adding_Local_Storage]
        Preparing Local Storage [7636]
        Adding Local Storage [7341]
      Section: Adding POSIX Compliant File System Storage [T-Sect-Adding_POSIX_Compliant_File_System_Storage]
        POSIX Compliant File System Storage in Red Hat Enterprise Virtualization [10032]
        Attaching POSIX Compliant File System Storage [10031]

I think the fact that there were two missing commas in the relation may have thrown it off, but ideally in this situation we should still be able to print the line number the relation in error started on out?

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

I have been naughty and am still running cspclient-0.26.5-1, updating now, but reporting anyway for tracking.
Comment 1 Stephen Gordon 2012-09-13 15:06:31 EDT
Reproduced on cspclient-0.26.6-1, same behaviour.
Comment 2 Stephen Gordon 2012-09-13 15:09:23 EDT
If you need to re-produce use this content specification and revision:

Content Specification ID: 8983
Revision: 262367

Obviously because it has been pushed this version has been fixed but you can easily reproduce by removing the commas from the relation.

For what it's worth my comment about it being because there are two missing commas in this one appears to be a furphy, when I fix one and leave the other one I still get the same behaviour (same error, no line # reported).
Comment 3 Lee Newson 2012-09-13 17:47:52 EDT
Verified and Fixed for 0.26.7.

I had a TODO note in the code that this needed fixing, and the reason it was there was because I had to convert that error into a proper error message.
Comment 4 Lee Newson 2012-09-13 17:54:48 EDT
I should also mention that you are getting that error message because the syntax is being declared as invalid, due to mixing long and short relationships (see below) and not because of the comma. This however should be valid and I've fixed it now as well.

Just as extra information for my above statement:

The long relationship syntax is:

<TITLE> [<ID> or <TARGET>]


The short relationship syntax is:

<ID> or <TARGET>
Comment 5 Lee Newson 2012-09-13 18:26:49 EDT
Moving this back to assigned for now.

Upon testing this more thoroughly I found that the comma did play a role in the error. What i mentioned previously was partly correct as the parser was only allowing long/short relationships in a mutually exclusive role and that is now fixed. However I'll need to look more into determining missing commas in short/long mixed relationships or continue to make them mutually exclusive. In saying that this would be an issue if you were only using short relationships anyways. ie

Title [67454] [R: T-Topic T-Another-Topic]

One possible solution is to assume anything on a new line is meant to be a different relationship. Also if anything on the same line contains spaces but the line doesn't contain the set of square brackets then it should be a short relationship. Anyways I'll look into this when I have more time.
Comment 6 Stephen Gordon 2012-09-14 09:24:36 EDT
(In reply to comment #4)
> I should also mention that you are getting that error message because the
> syntax is being declared as invalid, due to mixing long and short
> relationships (see below) and not because of the comma. This however should
> be valid and I've fixed it now as well.
> 
> Just as extra information for my above statement:
> 
> The long relationship syntax is:
> 
> <TITLE> [<ID> or <TARGET>]
> 
> 
> The short relationship syntax is:
> 
> <ID> or <TARGET>

Hmm that's interesting, because using cspclient-0.26.5-1 once I corrected the commas I was actually able to successfully push the content spec without errors even though I am still mixing long/short relationships. The relationship as I have it in the spec right now is as follows:

    Introduction to Storage in Red Hat Enterprise Virtualization [8671]
    [Related-to:
      T-Sect-Adding_NFS_Storage,
      T-Sect-Adding_iSCSI_Storage,
      Adding FCP Storage [7635],
      T-Sect-Adding_Local_Storage,
      T-Sect-Adding_POSIX_Compliant_File_System_Storage,
      T-Sect-Populating_the_ISO_Domain
    ]
Comment 7 Lee Newson 2012-09-20 03:21:43 EDT
Verified. It was a change I had done but not tested since that version was released. The unintended addition was actually a bug in itself.

Anyways, I made the changes I mentioned in Comment 5, so that any new line in a relationship block is classed as one or more new relationships (again separated by commas). I've also added a check to test if two or more short relationships exist on one line, that aren't separated by a comma. The one Exception I've not been able to cover yet is the following:

Introduction to Storage in Red Hat Enterprise Virtualization [8671]
    [Related-to:
    <SHORT> <LONG>]

Since the short relationship is read as part of the Title in the Long relationship. However I'm fine with this, as it will be picked up when Bug #846552 is implemented. the other reason being the only way I can see at the moment to fix this is to either:

- Disallow short and long relationships to be mixed
- Enable restrictions on Topic Titles so that they can't have the same syntax as a target or start with a number (0-9).

Neither of these however are feasible so I'm going to mark this bug as complete.
Comment 8 Lee Newson 2013-06-06 21:30:45 EDT
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.

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