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

Bug 1063808

Summary: Custom info with empty value can be added to system
Product: Red Hat Satellite 5 Reporter: Lukáš Hellebrandt <lhellebr>
Component: APIAssignee: Tomas Lestach <tlestach>
Status: CLOSED CURRENTRELEASE QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 560CC: cperry, dyordano
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhn-custom-info-5.4.22-1 spacewalk-java-2.3.8-9 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-13 09:55:02 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: 1127641    
Attachments:
Description Flags
Patch for the rhn-custom-info python part
none
Patch - java part none

Description Lukáš Hellebrandt 2014-02-11 13:21:52 UTC
Description of problem:
Custom info with empty value can be added to system using the rhn-custom-info tool or API. This is not possible in webUI

How reproducible:

Always. Have a system registered to satellite with the provisioning entitlement and an existing custom info key.
Set the key's value to empty via API or the rhn-custom-info tool.

./test-rhn-custom-info.py <hostname> <user> <password> setCustomValue keyLabel ''
OR
rhn-custom-info -u <user> -p <password> -s http://<hostname>/rpc/api keyLabel ''

Actual results:
The empty value is set to system

Expected results:
This shouldn't be possible

Additional info:
Test RHN-Tools/rhn-custom-info (currently workaround)

Comment 1 Lukáš Hellebrandt 2014-02-11 13:55:34 UTC
Ad test-rhn-custom-info:

client.system.setCustomValues(session, sysID, {keyLabel: ''})

Comment 2 Dimitar Yordanov 2014-02-13 20:10:19 UTC
Created attachment 862957 [details]
Patch for the rhn-custom-info python part

Comment 3 Tomas Lestach 2014-02-14 10:34:09 UTC
Dimitar, thank you for the patch, I committed it as ...

spacewalk.git: 1d893694cebf56245ac0034fb41c6addff1e888f


Leaving the BZ in NEW state, as only part of the fix is available.

Comment 4 Dimitar Yordanov 2014-02-14 12:12:37 UTC
Created attachment 863243 [details]
Patch - java part

Comment 5 Tomas Lestach 2014-08-14 14:31:06 UTC
Dimitar, could you make a pull request, please?
The patch looks good, there's just no need to call "toString()" method since the StringUtils.trim() already return a string.

Comment 6 Dimitar Yordanov 2014-08-15 11:02:50 UTC
Hi Tomas,
  Thanks for taking a look.
  I have created the following PR:
  https://github.com/spacewalkproject/spacewalk/pull/138

Dimi

Comment 7 Tomas Lestach 2014-08-25 15:01:00 UTC
PR request applied, then you!

spacewalk.git: 3517961217bafb51cd55ca7a6cf7ff266e16f731

Comment 9 Lukáš Hellebrandt 2014-12-19 11:06:18 UTC
Verified.

An attempt to set an empty value now fails with "Not valid value is provided for key/value pairs" error.

Comment 10 Clifford Perry 2015-01-13 09:55:02 UTC
With the release of Red Hat Satellite 5.7 on January 12th 2015 this bug is
being moved to a Closed Current Release state. 

The Satellite 5.7 GA Errata:
 - https://rhn.redhat.com/errata/RHSA-2015-0033.html 

Satellite 5.7 Release Notes:
 -
https://access.redhat.com/documentation/en-US/Red_Hat_Satellite/5.7/html-single/Release_Notes/index.html

Satellite Customer Portal Blog announcement for release:
 - https://access.redhat.com/blogs/1169563/posts/1315743 

Cliff