Bug 1002308 - Cloning a channel via API fails if channel label starts with a digit.
Summary: Cloning a channel via API fails if channel label starts with a digit.
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API
Version: 560
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
Assignee: Tomas Lestach
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: 462714
TreeView+ depends on / blocked
 
Reported: 2013-08-28 21:08 UTC by Dimitar Yordanov
Modified: 2018-04-09 15:58 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-09 15:58:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Dimitar Yordanov 2013-08-28 21:08:42 UTC
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):
spacewalk-java-2.1.28-1

How reproducible:
100

Steps to Reproduce:
1. Execute the following script.

import sys, xmlrpclib
RHN_SERVER='https://xxxx.redhat.com/rpc/api'
RHN_USER='xxxx'
RHN_PASS='xxxx'
client = xmlrpclib.Server(RHN_SERVER, verbose=0)
key = client.auth.login(RHN_USER, RHN_PASS)

client.channel.software.create(key,'test_label','test_name','summary','channel-x86_64','')
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
    verbose=self.__verbose
  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 21:14:42 UTC
Fixed in Spacewalk Master: bec830185e23457cc913633c7a7fe7ac41a0183a

Comment 2 Tomas Lestach 2013-08-29 06:25:26 UTC
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 12:12:47 UTC
> 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 15:58:32 UTC
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.