Bug 1002308 - Cloning a channel via API fails if channel label starts with a digit.
Cloning a channel via API fails if channel label starts with a digit.
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API (Show other bugs)
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: Tomas Lestach
Red Hat Satellite QA List
Depends On:
Blocks: 462714
  Show dependency treegraph
Reported: 2013-08-28 17:08 EDT by Dimitar Yordanov
Modified: 2018-04-09 11:58 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2018-04-09 11:58:32 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dimitar Yordanov 2013-08-28 17:08:42 EDT
Description of problem:
Cloning a channel via API fails if channel label starts with a digit.

The problem is that the regular expression that verifies the channel label when the channel is cloned via API is not correct: 
 Pattern.compile("^[a-z][a-z\\d\\-\\.\\_]*$", Pattern.CASE_INSENSITIVE); 

The correct one is the one used when the channel is cloned on WebUI:
$channel_label =~ /^[a-z\d][a-z\d\-\.\_]*$/

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

How reproducible:

Steps to Reproduce:
1. Execute the following script.

import sys, xmlrpclib
client = xmlrpclib.Server(RHN_SERVER, verbose=0)
key = client.auth.login(RHN_USER, RHN_PASS)

client.channel.software.clone(key,'test_label',{'name':'clone-test_name','label':'222clone-test_label','summary':'test summary',},True)

Actual results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1578, in __request
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1473, in parse_response
    return u.close()
  File "/usr/lib64/python2.7/xmlrpclib.py", line 793, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault -1: "redstone.xmlrpc.XmlRpcFault: unhandled internal exception: The channel parameter 222clone-test_label is invalid. It Must  be at least 6 characters long, begin with a letter, and contain only lowercase letters, digits, '-', '_', and '.'.  Also, it cannot begin with 'rhn', 'redhat', or 'red hat'.">

Expected results:
The channel is cloned successfully as it will happen if the same action was done on WebUI.

Additional info:
Comment 1 Dimitar Yordanov 2013-08-28 17:14:42 EDT
Fixed in Spacewalk Master: bec830185e23457cc913633c7a7fe7ac41a0183a
Comment 2 Tomas Lestach 2013-08-29 02:25:26 EDT
Making the Comment#1 public, as it is a commit to Spacewalk master.

Dimitar, this commit does not fix the described issue. The code you touched gets applied in case of channel cloning, but not creation.
However, if we touch the channel name and label regexp, we would like to re-use the regexp defined on one place - for webui and for api.

Please, either re-work the patch or revert it.

Changing to ASSIGNED.
Comment 3 Tomas Lestach 2013-08-29 08:12:47 EDT
> The code you touched gets applied in case of channel cloning, but not creation.

Taking back, this bus is about channel cloning. My fault.

Keeping on ASSIGNED, as I'll do the basic re-factoring.
Comment 5 Tomas Lestach 2018-04-09 11:58:32 EDT
We have re-reviewed this bug, as part of an ongoing effort to improve Satellite/Proxy feature and bug updates, review and backlog.

This is a low priority bug and has no currently open customer cases. While this bug may still valid, we do not see it being implemented prior to the EOL of the Satellite 5.x product. As such, this is being CLOSED DEFERRED. 

Closing now to help set customer expectations as early as possible. You are welcome to re-open this bug if needed.

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