Bug 1325333

Summary: unexpected error occurs since custom repo creation function doesn't check the uniqueness of the relative path
Product: Red Hat Update Infrastructure for Cloud Providers Reporter: Irina Gulina <igulina>
Component: ToolsAssignee: RHUI Bug List <rhui-bugs>
Status: CLOSED DUPLICATE QA Contact: Irina Gulina <igulina>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.0.0CC: bizhang, bkearney, pcreech
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-26 10:35:45 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:

Description Irina Gulina 2016-04-08 13:06:33 UTC
Description of problem:

If one creates a custom repo and specifies the non unique relative path (url) at which the repository will be served an unexpected error will occur, and a traceback will be shown in logs.  

Version-Release number of selected component (if applicable):
>> rpm -qa *rhui*
rhui-installer-base-0.0.24-1.el7ui.noarch
rh-rhui-tools-libs-pre.3.0.16-1.el7ui.noarch
rhui-installer-0.0.24-1.el7ui.noarch
rh-rhui-tools-pre.3.0.16-1.el7ui.noarch
rhui-default-ca-1.0-1.noarch
rh-amazon-rhui-client-2.2.118-1.el7.noarch
rh-amazon-rhui-client-rhs30-2.2.124-1.el7.noarch

RHUI iso 20151013

How reproducible:
always

Steps to Reproduce:
1. Create a simple custom repo (home RHUI screen -> 'r' -> 'c')
2. Create the second custom repo and specify the same relative path (url) at which the repository will be served
3. Observe the error and the traceback in /root/.rhui/rhui.log

Actual results:
rhui (repo) => c

Unique ID for the custom repository (alphanumerics, _, and - only):
repo_1

Display name for the custom repository [repo_1]:
repo_1

Path at which the repository will be served [repo_1]:
repo_1

Algorithm to use when calculating the checksum values for repository metadata:
* Select "sha256" for RHEL6:
* Select "sha1" for either RHEL5 or RHEL6:

  1  - sha256
  2  - sha1
Enter value (1-2) or 'b' to abort: 1

Should the repository require an entitlement certificate to access? (y/n)
n

Should the repository require clients to perform a GPG check and
verify packages are signed by a GPG key? (y/n)
n

The following repository will be created:
  ID:              repo_1
  Name:            repo_1
  Path:            repo_1
  GPG Check        No
  Red Hat GPG Key: No
Proceed? (y/n) y

Successfully created repository repo_1

------------------------------------------------------------------------------
rhui (repo) => c

Unique ID for the custom repository (alphanumerics, _, and - only):
repo_2

Display name for the custom repository [repo_2]:
repo_2

Path at which the repository will be served [repo_2]:
repo_1

Algorithm to use when calculating the checksum values for repository metadata:
* Select "sha256" for RHEL6:
* Select "sha1" for either RHEL5 or RHEL6:

  1  - sha256
  2  - sha1
Enter value (1-2) or 'b' to abort: 1

Should the repository require an entitlement certificate to access? (y/n)
n

Should the repository require clients to perform a GPG check and
verify packages are signed by a GPG key? (y/n)
n

The following repository will be created:
  ID:              repo_2
  Name:            repo_2
  Path:            repo_1
  GPG Check        No
  Red Hat GPG Key: No
Proceed? (y/n) y


An unexpected error has occurred during the last operation.
More information can be found in /root/.rhui/rhui.log.

2016-04-08 08:54:25,962 - <class 'pulp.bindings.exceptions.PulpServerException'>
2016-04-08 08:54:25,962 - Unexpected error caught at the shell level
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/rhui/tools/shell.py", line 88, in safe_listen
    self.listen(clear=first_run)
  File "/usr/lib/python2.7/site-packages/rhui/tools/shell.py", line 122, in listen
    Shell.listen(self)
  File "/usr/lib/python2.7/site-packages/rhui/common/shell.py", line 186, in listen
    item.func(*args, **item.kwargs)
  File "/usr/lib/python2.7/site-packages/rhui/tools/screens/repo.py", line 520, in create_custom
    rh_gpg_key)
  File "/usr/lib/python2.7/site-packages/rhui/tools/pulp_api.py", line 783, in create_custom_repo
    distributors)
  File "/usr/lib/python2.7/site-packages/pulp/bindings/repository.py", line 81, in create_and_configure
    return self.server.POST(path, repo_data)
  File "/usr/lib/python2.7/site-packages/pulp/bindings/server.py", line 98, in POST
    log_request_body=log_request_body)
  File "/usr/lib/python2.7/site-packages/pulp/bindings/server.py", line 161, in _request
    self._handle_exceptions(response_code, response_body)
  File "/usr/lib/python2.7/site-packages/pulp/bindings/server.py", line 199, in _handle_exceptions
    raise exceptions.PulpServerException(response_body)
PulpServerException: RequestException: POST request on /pulp/api/v2/repositories/ failed with 500 - 'relative_url'


Expected results:
1) When one specifies non unique repo path a message: "A repository with a relative path <relative_url> already exists" should be displayed like when one tries to create a repo with non unique repo ID, there is a message: "A repository with ID "repo_1" already exists".
2) In custom repo creation dialog a phrase "Path at which the repository will be served [relative_url]:" should be replaced with "Unique path at which the repository will be served [relative_url]:"

Comment 5 Bryan Kearney 2016-08-02 12:58:14 UTC
may be dupe of 1303039

Comment 6 Irina Gulina 2016-10-26 10:35:45 UTC

*** This bug has been marked as a duplicate of bug 1303039 ***