Bug 843098 - UnicodeEncodeError when creating repo with i18n repo-id
UnicodeEncodeError when creating repo with i18n repo-id
Status: CLOSED CURRENTRELEASE
Product: Pulp
Classification: Community
Component: user-experience (Show other bugs)
2.0.6
Unspecified Unspecified
unspecified Severity unspecified
: ---
: Sprint 42
Assigned To: Jay Dobies
Preethi Thomas
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-25 11:11 EDT by Preethi Thomas
Modified: 2013-09-09 12:34 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-01-09 12:05:26 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Preethi Thomas 2012-07-25 11:11:57 EDT
Description of problem:
Needs to handle i18n characters for repo-id in v2

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


How reproducible:
always

Steps to Reproduce:
1.create a repo with i18n character for id
2.
3.
  
Actual results:

[root@pulp-f16 ~]# pulp-admin -u admin -p admin repo create --repo Brasília 
An internal error occurred on the Pulp server. More information can be found in
the client log file ~/.pulp/admin.log.

[root@pulp-f16 ~]# pulp-admin -u admin -p admin repo create --repo Brasília 
Traceback (most recent call last):
  File "/usr/bin/pulp-admin", line 36, in <module>
    sys.exit(pulp.client.launcher.main(config_files))
  File "/usr/lib/python2.7/site-packages/pulp/client/launcher.py", line 94, in main
    code = cli.run(args)
  File "/usr/lib/python2.7/site-packages/pulp/client/extensions/core.py", line 473, in run
    code = self.context.exception_handler.handle_exception(e)
  File "/usr/lib/python2.7/site-packages/pulp/client/extensions/exceptions.py", line 89, in handle_exception
    exit_code = handle_func(e)
  File "/usr/lib/python2.7/site-packages/pulp/client/extensions/exceptions.py", line 181, in handle_conflict
    self.prompt.render_failure_message(msg)
  File "/usr/lib/python2.7/site-packages/pulp/client/extensions/core.py", line 193, in render_failure_message
    self.write(message, color=COLOR_FAILURE, tag=TAG_FAILURE)
  File "/usr/lib/python2.7/site-packages/okaara/prompt.py", line 157, in write
    content = str(content)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 211: ordinal not in range(128)

Expected results:


Additional info:
Comment 1 Jay Dobies 2012-07-26 15:26:16 EDT
commit 9d2ef0a15aa3109fd36b3170b6cc9179454c90d3
Author: Jay Dobies <jason.dobies@redhat.com>
Date:   Thu Jul 26 15:25:32 2012 -0400

    843098 - Run all written content through encode_unicode first

platform/src/pulp/client/extensions/core.py
Comment 2 Jeff Ortel 2012-08-02 09:48:22 EDT
build: 0.320.
Comment 3 Preethi Thomas 2012-08-16 09:32:43 EDT
fails_qa
[root@pulp-master ~]# rpm -q pulp-server
pulp-server-0.0.323-1.fc17.noarch
[root@pulp-master ~]# 

[root@pulp-master ~]# pulp-admin -u admin -p admin repo create --repo-id Brasília 
An internal error occurred on the Pulp server. More information can be found in
the client log file ~/.pulp/admin.log.

[root@pulp-master ~]# 
[root@pulp-master ~]# 
[root@pulp-master ~]# 
[root@pulp-master ~]# pulp-admin -u admin -p admin repo create --repo-id Brasília 
The requested operation conflicts with one or more operations already queued for
the resource. The following operations on the specified resources caused the
request to be rejected:

Resource:  repository - Brasília
Operation: create

[root@pulp-master ~]# pulp-admin -u admin -p admin repo create --repo-id Brasília1
An internal error occurred on the Pulp server. More information can be found in
the client log file ~/.pulp/admin.log.



From pulp.log
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/middleware/exception.py", line 44, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/middleware/postponed.py", line 38, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/web/application.py", line 277, in wsgi
    result = self.handle_with_processors()
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 28, in _handle_with_processors
    return process(self.processors)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.7/site-packages/web/application.py", line 555, in processor
    return handler()
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.7/site-packages/web/application.py", line 570, in processor
    result = handler()
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 27, in process
    return self.handle()
  File "/usr/lib/python2.7/site-packages/web/application.py", line 228, in handle
    return self._delegate(fn, self.fvars, args)
  File "/usr/lib/python2.7/site-packages/web/application.py", line 411, in _delegate
    return f()
  File "/usr/lib/python2.7/site-packages/web/application.py", line 419, in <lambda>
    f = lambda: self._delegate_sub_application(pat, what)
  File "/usr/lib/python2.7/site-packages/web/application.py", line 444, in _delegate_sub_application
    return app.handle_with_processors()
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 28, in _handle_with_processors
    return process(self.processors)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.7/site-packages/web/application.py", line 555, in processor
    return handler()
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.7/site-packages/web/application.py", line 570, in processor
    result = handler()
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 27, in process
    return self.handle()
  File "/usr/lib/python2.7/site-packages/web/application.py", line 228, in handle
    return self._delegate(fn, self.fvars, args)
  File "/usr/lib/python2.7/site-packages/web/application.py", line 409, in _delegate
    return handle_class(cls)
  File "/usr/lib/python2.7/site-packages/web/application.py", line 385, in handle_class
    return tocall(*args)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py", line 137, in _auth_decorator
    value = method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/repositories.py", line 180, in POST
    repo = execution.execute_sync(call_request)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/execution.py", line 110, in execute_sync
    call_report = coordinator.execute_call_synchronously(call_request, timeout=timeout)
  File "/usr/lib/python2.7/site-packages/pulp/server/dispatch/coordinator.py", line 105, in execute_call_synchronously
    self._run_task(task, True, timeout)
  File "/usr/lib/python2.7/site-packages/pulp/server/dispatch/coordinator.py", line 198, in _run_task
    task_queue.enqueue(task)
  File "/usr/lib/python2.7/site-packages/pulp/server/dispatch/taskqueue.py", line 202, in enqueue
    self.queued_call_collection.save(queued_call, safe=True)
  File "/usr/lib/python2.7/site-packages/pulp/server/db/connection.py", line 80, in retry
    return method(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 237, in save
    manipulate, safe, _check_keys=True, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/db/connection.py", line 80, in retry
    return method(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 411, in update
    _check_keys, self.__uuid_subtype), safe)
InvalidStringData: strings in documents must be valid UTF-8



From admin.log

012-08-16 09:30:13,120 - ERROR - Exception occurred:
        href:      /pulp/api/v2/repositories/
        method:    POST
        status:    500
        error:     Unhandled Exception
        traceback: [u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/middleware/exception.py", line 44, in __call__\n    return self.app(environ, start_response)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/middleware/postponed.py", line 38, in __call__\n    return self.app(environ, start_response)\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 277, in wsgi\n    result = self.handle_with_processors()\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 28, in _handle_with_processors\n    return process(self.processors)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in process\n    return p(lambda : process(processors))\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 555, in processor\n    return handler()\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in <lambda>\n    return p(lambda : process(processors))\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in process\n    return p(lambda : process(processors))\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 570, in processor\n    result = handler()\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in <lambda>\n    return p(lambda : process(processors))\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 27, in process\n    return self.handle()\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 228, in handle\n    return self._delegate(fn, self.fvars, args)\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 411, in _delegate\n    return f()\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 419, in <lambda>\n    f = lambda: self._delegate_sub_application(pat, what)\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 444, in _delegate_sub_application\n    return app.handle_with_processors()\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 28, in _handle_with_processors\n    return process(self.processors)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in process\n    return p(lambda : process(processors))\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 555, in processor\n    return handler()\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in <lambda>\n    return p(lambda : process(processors))\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in process\n    return p(lambda : process(processors))\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 570, in processor\n    result = handler()\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 25, in <lambda>\n    return p(lambda : process(processors))\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py", line 27, in process\n    return self.handle()\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 228, in handle\n    return self._delegate(fn, self.fvars, args)\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 409, in _delegate\n    return handle_class(cls)\n', u'  File "/usr/lib/python2.7/site-packages/web/application.py", line 385, in handle_class\n    return tocall(*args)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py", line 137, in _auth_decorator\n    value = method(self, *args, **kwargs)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/repositories.py", line 180, in POST\n    repo = execution.execute_sync(call_request)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/execution.py", line 110, in execute_sync\n    call_report = coordinator.execute_call_synchronously(call_request, timeout=timeout)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/dispatch/coordinator.py", line 105, in execute_call_synchronously\n    self._run_task(task, True, timeout)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/dispatch/coordinator.py", line 198, in _run_task\n    task_queue.enqueue(task)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/dispatch/taskqueue.py", line 202, in enqueue\n    self.queued_call_collection.save(queued_call, safe=True)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/db/connection.py", line 80, in retry\n    return method(*args, **kwargs)\n', u'  File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 237, in save\n    manipulate, safe, _check_keys=True, **kwargs)\n', u'  File "/usr/lib/python2.7/site-packages/pulp/server/db/connection.py", line 80, in retry\n    return method(*args, **kwargs)\n', u'  File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 411, in update\n    _check_keys, self.__uuid_subtype), safe)\n']
        data:      {}
Comment 4 Jay Dobies 2012-11-28 18:18:28 EST
I believe we don't allow i18n repo IDs anymore. Preethi, please verify that you can't reproduce this.
Comment 5 Preethi Thomas 2012-12-03 20:37:37 EST
verified


[root@preethi ~]#  pulp-admin -u admin -p admin rpm repo create --repo-id Brasília 
Validation failed for argument [--repo-id]: value must contain only letters,
numbers, underscores, and hyphens

[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]#  pulp-admin -u admin -p admin puppet repo create --repo-id Brasília 
Validation failed for argument [--repo-id]: value must contain only letters,
numbers, underscores, and hyphens

[root@preethi ~]# rpm -q pulp-server
pulp-server-2.0.6-0.11.beta.noarch
[root@preethi ~]#
Comment 6 Preethi Thomas 2013-01-09 12:05:26 EST
Pulp v2.0 released

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