Bug 1379657

Summary: User should get validation error if user tries to create discovery rule with name >255 characters
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: Discovery PluginAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3.0CC: bbuckingham, dlobatog, jcallaha
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:17 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:
Attachments:
Description Flags
Max 255 chars none

Description Sachin Ghai 2016-09-27 10:58:58 UTC
Description of problem:
In automation, a test case is failed where we are creating discovery rule >255 characters. Earlier the validation was set but looks like we can create rule with any name length.


]# hammer -u admin -p changeme discovery_rule  create --name 'yXFdwjBlopAVqRsOCgsCRRcnkQFbSDlTeaXVdNYxuRFqIHWcKfDhrgxlEfHVZGVKyEQMLmtyVonBcNLzCtIWqgvLvKxdEpZpwCTDMNFJuOQKZWcYtlzWGkOqUCfLfIEBtljlKZdkebrLDdfPQijuJsQtvrRbyFMrEdcXAeuOhEdBoJHZNNdQALIdpTzsFQqLOHHSyClnVwdwWpufuFJfJtAHlvrglersGWORgKvIdpfKnJwcTUBrKfbxAkcgpbRm' --hostgroup test --search='cpu_count = 1' --organization-ids 1
Rule created




Version-Release number of selected component (if applicable):
Sat6.3 snap2

How reproducible:


Steps to Reproduce:
1. create discovery rule with >255 chars in name
2.
3.

Actual results:
Validation  error should be raised if user tries to create rule with more that 255 chars

Expected results:


Additional info:

Comment 3 Lukas Zapletal 2017-05-24 08:08:11 UTC
Fixed in 6.3:

hammer-quick discovery-rule create --name longfsdfdsfdssdfddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddxxxxxxxxxxxxxx --hostgroup "CentOS 7.3" --search='cpu_count = 1' --organization-titles MyOrg --location-titles MyLoc

Could not create the rule:
  Name is too long (maximum is 255 characters)

Comment 4 Daniel Lobato Garcia 2017-08-09 13:11:49 UTC
Created attachment 1311204 [details]
Max 255 chars

Comment 5 Daniel Lobato Garcia 2017-08-09 13:12:59 UTC
Verified.

Tested on:

foreman-1.15.2-1.el7sat.noarch 
tfm-rubygem-foreman_discovery-9.1.1-1.fm1_15.el7sat.noarch
satellite-6.3.0-16.0.beta.el7sat.noarch

See the screenshot for proof.

Having said that - this should have never been opened as a bug. The search filter should be arbitrarily large so that one could write complex rules if needed, instead of limiting it.

Comment 6 Satellite Program 2018-02-21 16:54:17 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.
> 
> https://access.redhat.com/errata/RHSA-2018:0336