Bug 796854 - task list blows up if you have repos with unicode id
Summary: task list blows up if you have repos with unicode id
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: 1.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Sayli Karmarkar
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-23 19:00 UTC by Preethi Thomas
Modified: 2015-03-23 01:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-05-25 14:14:49 UTC


Attachments (Terms of Use)

Description Preethi Thomas 2012-02-23 19:00:59 UTC
Description of problem:

I created a repo with unicode in the the id and sync it. If you run task list, it fails with unicode error.
Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. enable tasking (/etc/pulp/admin/task.conf
2.create are repo with which has a unicode character in the id
3.sync the repo
4.Run pulp-admin task list
  
Actual results:

[root@preethi-el6-pulp ~]# pulp-admin task list
Traceback (most recent call last):
  File "/usr/bin/pulp-admin", line 23, in <module>
    admin.main()
  File "/usr/lib/python2.6/site-packages/pulp/client/lib/cli.py", line 152, in main
    command.main(self.args[1:])
  File "/usr/lib/python2.6/site-packages/pulp/client/pluginlib/command.py", line 129, in main
    action.main(args[1:])
  File "/usr/lib/python2.6/site-packages/pulp/client/pluginlib/command.py", line 213, in main
    self.run()
  File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py", line 93, in run
    print '\n'.join(self.format_task(t) for t in tasks)
  File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py", line 93, in <genexpr>
    print '\n'.join(self.format_task(t) for t in tasks)
  File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py", line 64, in format_task
    ', '.join([str(a) for a in task['args']]),
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 7: ordinal not in range(128)
[root@preethi-el6-pulp ~]# 

Expected results:

Task list displayed

Additional info:

Comment 1 Preethi Thomas 2012-03-01 16:37:07 UTC
I still see the same issue on the latest qe build.

this time I did not create any repo with unicode in id.

1. enable tasking (/etc/pulp/admin/task.conf
2.create are repo ( I did not create any repo with unicode this time- just 2 regular repo) 
3.sync the repo (I didn't sync the repo. Just added sync schedule for the repos) 
4.Run pulp-admin task list

[root@preethi-el6-pulp ~]# pulp-admin task list
Traceback (most recent call last):
  File "/usr/bin/pulp-admin", line 23, in <module>
    admin.main()
  File "/usr/lib/python2.6/site-packages/pulp/client/lib/cli.py", line 152, in main
    command.main(self.args[1:])
  File "/usr/lib/python2.6/site-packages/pulp/client/pluginlib/command.py", line 129, in main
    action.main(args[1:])
  File "/usr/lib/python2.6/site-packages/pulp/client/pluginlib/command.py", line 213, in main
    self.run()
  File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py", line 101, in run
    print '\n'.join(self.format_task(t) for t in tasks)
  File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py", line 101, in <genexpr>
    print '\n'.join(self.format_task(t) for t in tasks)
  File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py", line 72, in format_task
    ', '.join([self.encode_unicode(a) for a in task['args']]),
TypeError: sequence item 1: expected string, NoneType found
[root@preethi-el6-pulp ~]# 
[root@preethi-el6-pulp ~]# 
[root@preethi-el6-pulp ~]# 
[root@preethi-el6-pulp ~]# 
[root@preethi-el6-pulp ~]# rpm -qa |grep pulp
mod_wsgi-3.3-3.pulp.el6.x86_64
pulp-0.0.270-1.el6.noarch
python-oauth2-1.5.170-2.pulp.el6.noarch
m2crypto-0.21.1.pulp-7.el6.x86_64
pulp-selinux-server-0.0.270-1.el6.noarch
pulp-client-lib-0.0.270-1.el6.noarch
pulp-common-0.0.270-1.el6.noarch
pulp-admin-0.0.270-1.el6.noarch
[root@preethi-el6-pulp ~]#

Comment 2 Sayli Karmarkar 2012-03-02 20:01:18 UTC
I am not able to reproduce this issue on my box and the one on Preethi's machine disappeared after bouncing the server. However, looking at Traceback this doesn't look like a unicode bug. This looks like a general Task list issue.  

 File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py",
line 72, in format_task
    ', '.join([self.encode_unicode(a) for a in task['args']]),
TypeError: sequence item 1: expected string, NoneType found

Here we are running .join assuming that none of the items in task['args'] are 'None'. We will see "expected string, NoneType found" error if that is not true and task['args'] contains one or more NoneType arguments (whether we call self.encode_unicode(a), does not matter).

Preethi, can you verify this, probably by trying to run task list in different cases without unicode involved at all and then running the same with unicode. If we don't see any difference between both, you can verify this bug and open a new one for "task list blows up when task['args'] contain one or more NoneTypes".

Thanks,

Comment 3 Preethi Thomas 2012-03-02 20:35:03 UTC
This is pretty easily reproducible.

It does go away if you restart the server.

But with the steps in the description , I can reproduce it.

2.create are repo with which has a unicode character in the id
3.sync the repo
4.Run pulp-admin task list


[root@preethi-el6-pulp ~]# pulp-admin repo create --id á145 --feed=http://repos.fedorapeople.org/repos/pulp/pulp/v1/testing/fedora-16/x86_64/
Successfully created repository [ á145 ]

[root@preethi-el6-pulp ~]# pulp-admin task list
Task: 83fce3cf-64a6-11e1-8bc4-525400c5886c
    Job: None
    Scheduler: interval
    Call: cull_history
    Arguments: 
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-03T06:00:00Z
    Result: None
    Exception: None
    Traceback: None

Task: 83fccc42-64a6-11e1-8bc3-525400c5886c
    Job: None
    Scheduler: interval
    Call: cull_audited_events
    Arguments: 
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-03T18:00:00Z
    Result: None
    Exception: None
    Traceback: None

Task: aa6dcb5e-64a6-11e1-87b1-525400c5886c
    Job: None
    Scheduler: immediate
    Call: RepoApi.delete
    Arguments: a145
    State: finished
    Start time: 2012-03-02T15:31:18-05:00
    Finish time: 2012-03-02T15:31:18-05:00
    Scheduled time: None
    Result: None
    Exception: None
    Traceback: None


[root@preethi-el6-pulp ~]# pulp-admin repo sync --id á145 -F
Sync for repository á145 started
Sync: Finished
21/21 new items downloaded
0/21 existing items processed

Item Details: 
RPMs: 21/21

[root@preethi-el6-pulp ~]# pulp-admin task list
Traceback (most recent call last):
  File "/usr/bin/pulp-admin", line 23, in <module>
    admin.main()
  File "/usr/lib/python2.6/site-packages/pulp/client/lib/cli.py", line 152, in main
    command.main(self.args[1:])
  File "/usr/lib/python2.6/site-packages/pulp/client/pluginlib/command.py", line 129, in main
    action.main(args[1:])
  File "/usr/lib/python2.6/site-packages/pulp/client/pluginlib/command.py", line 213, in main
    self.run()
  File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py", line 101, in run
    print '\n'.join(self.format_task(t) for t in tasks)
  File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py", line 101, in <genexpr>
    print '\n'.join(self.format_task(t) for t in tasks)
  File "/usr/lib/python2.6/site-packages/pulp/client/admin/plugins/task.py", line 79, in format_task
    task['traceback'])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)
[root@preethi-el6-pulp ~]#

Comment 4 Sayli Karmarkar 2012-03-06 00:43:38 UTC
commit b7648cc211b35b8fd3ace40d11cf33087ad45573
Author: Sayli Karmarkar <skarmark>
Date:   Mon Mar 5 16:41:07 2012 -0800

    796854 - Removing encode_unicode from task list as changes to tasking now converts all task information in unicode format

Comment 5 Jeff Ortel 2012-03-08 16:13:29 UTC
build: 0.272

Comment 6 Preethi Thomas 2012-03-08 20:22:23 UTC
[root@preethi-el6-pulp ~]# rpm -q pulp
pulp-0.0.272-1.el6.noarch
[root@preethi-el6-pulp ~]# 


[root@preethi-el6-pulp ~]# pulp-admin -u admin -p admin repo create --id á145 --feed=http://repos.fedorapeople.org/repos/pulp/pulp/v1/testing/fedora-16/x86_64
Successfully created repository [ á145 ]

[root@preethi-el6-pulp ~]# pulp-admin -u admin -p admin task list
Task: 4b1251fd-695b-11e1-ad49-525400c5886c
    Job: None
    Scheduler: interval
    Call: _sync
    Arguments: Rhel6-1
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-08T21:20:00Z
    Result: None
    Exception: None
    Traceback: None

Task: 6826c200-695b-11e1-abdd-525400c5886c
    Job: None
    Scheduler: interval
    Call: _sync
    Arguments: Rhel6-2
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-08T21:20:00Z
    Result: None
    Exception: None
    Traceback: None

Task: d18a3da6-6955-11e1-8c36-525400c5886c
    Job: None
    Scheduler: interval
    Call: cull_history
    Arguments: 
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-09T06:00:00Z
    Result: None
    Exception: None
    Traceback: None

Task: d18a22d9-6955-11e1-8c35-525400c5886c
    Job: None
    Scheduler: interval
    Call: cull_audited_events
    Arguments: 
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-09T18:00:00Z
    Result: None
    Exception: None
    Traceback: None


[root@preethi-el6-pulp ~]# pulp-admin -u admin -p admin repo sync --id á145 -FSync for repository á145 started
Sync: Finished
21/21 new items downloaded
0/21 existing items processed

Item Details: 
RPMs: 21/21

[root@preethi-el6-pulp ~]# pulp-admin -u admin -p admin task list
Task: 4b1251fd-695b-11e1-ad49-525400c5886c
    Job: None
    Scheduler: interval
    Call: _sync
    Arguments: Rhel6-1
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-08T21:20:00Z
    Result: None
    Exception: None
    Traceback: None

Task: 6826c200-695b-11e1-abdd-525400c5886c
    Job: None
    Scheduler: interval
    Call: _sync
    Arguments: Rhel6-2
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-08T21:20:00Z
    Result: None
    Exception: None
    Traceback: None

Task: d18a3da6-6955-11e1-8c36-525400c5886c
    Job: None
    Scheduler: interval
    Call: cull_history
    Arguments: 
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-09T06:00:00Z
    Result: None
    Exception: None
    Traceback: None

Task: d18a22d9-6955-11e1-8c35-525400c5886c
    Job: None
    Scheduler: interval
    Call: cull_audited_events
    Arguments: 
    State: waiting
    Start time: None
    Finish time: None
    Scheduled time: 2012-03-09T18:00:00Z
    Result: None
    Exception: None
    Traceback: None

Task: 3b04f84c-695c-11e1-91cf-525400c5886c
    Job: None
    Scheduler: immediate
    Call: _sync
    Arguments: á145
    State: finished
    Start time: 2012-03-08T15:21:04-05:00
    Finish time: 2012-03-08T15:21:21-05:00
    Scheduled time: None
    Result: True
    Exception: None
    Traceback: None

Comment 7 Preethi Thomas 2012-05-25 14:14:49 UTC
Pulp v1.1 Release


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