Bug 1159071

Summary: repos and users named with a single period
Product: [Retired] Pulp Reporter: Irina Gulina <igulina>
Component: z_otherAssignee: pulp-bugs
Status: CLOSED UPSTREAM QA Contact: Irina Gulina <igulina>
Severity: low Docs Contact:
Priority: medium    
Version: 2.5CC: austin, jortel
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-28 22:42:22 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 2014-10-30 21:07:55 UTC
Description of problem:
It's possible to create a repo named '.' (period), but after it's not possible to do anything with this repo, e.g. to update or delete.
 

Version-Release number of selected component (if applicable):
>>rpm -qa | grep pulp-server
pulp-server-2.5.0-0.14.beta.el6.noarch

How reproducible:
always


Steps to Reproduce:

>>pulp-admin docker repo create --repo-id=' '
Validation failed for argument [--repo-id]: value must contain only letters,
numbers, underscores, periods and hyphens

>> pulp-admin docker repo create --repo-id='.'
Repository [.] successfully created

>>pulp-admin docker repo create --repo-id='-'
Repository [-] successfully created

>>pulp-admin -u admin -p admin docker repo list
+----------------------------------------------------------------------+
                          Docker Repositories
+----------------------------------------------------------------------+

Id:                  zoo
Display Name:        zoo
Description:         None
Content Unit Counts: 

Id:                  _
Display Name:        _
Description:         None
Content Unit Counts: 

Id:                  woo.doo
Display Name:        woo.doo
Description:         None
Content Unit Counts: 

Id:                  .
Display Name:        .
Description:         None
Content Unit Counts: 

Id:                  -
Display Name:        -
Description:         None
Content Unit Counts: 

Id:                  1
Display Name:        1
Description:         None
Content Unit Counts: 

Id:                  _-
Display Name:        _-
Description:         None
Content Unit Counts: 

>>pulp-admin -u admin -p admin docker repo update --repo-id '_' --description='update underscore repo'
Repository [_] successfully updated

>> pulp-admin -u admin -p admin docker repo list
+----------------------------------------------------------------------+
                          Docker Repositories
+----------------------------------------------------------------------+

Id:                  zoo
Display Name:        zoo
Description:         None
Content Unit Counts: 

Id:                  woo.doo
Display Name:        woo.doo
Description:         None
Content Unit Counts: 

Id:                  .
Display Name:        .
Description:         None
Content Unit Counts: 

Id:                  _-
Display Name:        _-
Description:         None
Content Unit Counts: 

Id:                  _
Display Name:        _
Description:         update underscore repo
Content Unit Counts:

>>pulp-admin -u admin -p admin docker repo update --repo-id . --description='update period repo'
An unexpected error has occurred. More information can be found in the client
log file ~/.pulp/admin.log.

>>pulp-admin -u admin -p admin docker repo delete --repo-id='.'
The web server reported an error trying to access the Pulp application. The
likely cause is that the pulp-manage-db script has not been run prior to
starting the server. More information can be found in Apache's error log file on
the server itself.

>>pulp-admin -u admin -p admin docker repo delete --repo-id '.'
The web server reported an error trying to access the Pulp application. The
likely cause is that the pulp-manage-db script has not been run prior to
starting the server. More information can be found in Apache's error log file on
the server itself.

>>less ~/.pulp/admin.log

2014-10-30 17:00:45,829 - ERROR - Client-side exception occurred
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/client/extensions/core.py", line 478, in run
    exit_code = Cli.run(self, args)
  File "/usr/lib/python2.6/site-packages/okaara/cli.py", line 974, in run
    exit_code = command_or_section.execute(self.prompt, remaining_args)
  File "/usr/lib/python2.6/site-packages/pulp/client/extensions/extensions.py", line 224, in execute
    return self.method(*arg_list, **clean_kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/client/commands/repo/cudl.py", line 171, in run
    delete_task = self.context.server.repo.delete(self.repo_id).response_body
  File "/usr/lib/python2.6/site-packages/pulp/bindings/repository.py", line 100, in delete
    return self.server.DELETE(path)
  File "/usr/lib/python2.6/site-packages/pulp/bindings/server.py", line 90, in DELETE
    return self._request('DELETE', path, body=body)
  File "/usr/lib/python2.6/site-packages/pulp/bindings/server.py", line 151, in _request
    self._handle_exceptions(response_code, response_body)
  File "/usr/lib/python2.6/site-packages/pulp/bindings/server.py", line 187, in _handle_exceptions
    raise exceptions.ApacheServerException(response_body)
ApacheServerException
2014-10-30 17:01:22,244 - ERROR - Client-side exception occurred
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/client/extensions/core.py", line 478, in run
    exit_code = Cli.run(self, args)
  File "/usr/lib/python2.6/site-packages/okaara/cli.py", line 974, in run
    exit_code = command_or_section.execute(self.prompt, remaining_args)
  File "/usr/lib/python2.6/site-packages/pulp/client/extensions/extensions.py", line 224, in execute
    return self.method(*arg_list, **clean_kwargs)
  File "/usr/lib/python2.6/site-packages/pulp_docker/extensions/admin/cudl.py", line 183, in run
    scratchpad = response.get(u'scratchpad', {})
AttributeError: 'list' object has no attribute 'get'

Comment 1 Irina Gulina 2014-10-31 09:59:11 UTC
However, everything is fine if a repo-id starts with a period....

>> pulp-admin docker repo list
+----------------------------------------------------------------------+
                          Docker Repositories
+----------------------------------------------------------------------+

Id:                  zoo
Display Name:        zoo
Description:         None
Content Unit Counts: 

Id:                  woo.doo
Display Name:        woo.doo
Description:         None
Content Unit Counts: 

Id:                  .
Display Name:        .
Description:         None
Content Unit Counts: 


>> pulp-admin docker repo create --repo-id .myrepo
Repository [.myrepo] successfully created

>> pulp-admin -u admin -p admin docker repo update --repo-id .myrepo --description 'my repo'
Repository [.myrepo] successfully updated

>> pulp-admin -u admin -p admin docker repo list+----------------------------------------------------------------------+
                          Docker Repositories
+----------------------------------------------------------------------+

Id:                  zoo
Display Name:        zoo
Description:         None
Content Unit Counts: 

Id:                  woo.doo
Display Name:        woo.doo
Description:         None
Content Unit Counts: 

Id:                  .
Display Name:        .
Description:         None
Content Unit Counts: 

Id:                  .myrepo
Display Name:        .myrepo
Description:         my repo
Content Unit Counts:

Comment 2 amacdona@redhat.com 2014-12-02 17:08:10 UTC
I think this is a webpy problem. 

/v2/repositories/foo/ and matches based on foo/
/v2/reposotiroes/./ matches /
/v2/repositories/././ also matches /

We can validate against the repo name of '.' but I think this will probably be fixed by a move to Django, so I will leave it for now.

Comment 3 Irina Gulina 2015-01-14 10:21:39 UTC
Here is a little note that the user has the same issue if named with a signle perid [1]. Ok, let's wait for moving to Django. 

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1158138#c4

Comment 4 Brian Bouterse 2015-02-28 22:42:22 UTC
Moved to https://pulp.plan.io/issues/600