Bug 674600 - checksum warning in credentials,py
Summary: checksum warning in credentials,py
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: Sprint 20
Assignee: Jeff Ortel
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks: verified-to-close
TreeView+ depends on / blocked
 
Reported: 2011-02-02 15:43 UTC by Pradeep Kilambi
Modified: 2011-08-16 12:22 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-08-16 12:11:16 UTC
Embargoed:


Attachments (Terms of Use)

Description Pradeep Kilambi 2011-02-02 15:43:26 UTC
Description of problem:

$ sudo pulp-admin -u admin -p admin repo create --id=tfoo --feed=local:blah
/home/pkilambi/code/pulp/src/pulp/client/credentials.py:21: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha as SHA

We should not default to sha imports anymore. Newer versions of python enforce use of hashlib. We need a try except to use hashlib by default and if that fails use sha.

something like:

try:
    import hashlib
except ImportError:
    import sha
    class hashlib:
        @staticmethod
        def new(checksum):
            if checksum == 'sha':
                return sha.new()

and the code would invoke it as

hashlib.new('sha')

Comment 1 Jeff Ortel 2011-02-02 17:22:29 UTC
Since pulp packages require hashlib and we already import directly and use in other places, I simply replaced sha with hashlib.

Fixed: 0b2f7aaa4e2176997789dd20e615de8d728abfba

This can be tested by creating/deleting a consumer and noting the consumer cert, key, pulp.rep are cleaned up.

Comment 2 Jay Dobies 2011-02-02 20:07:18 UTC
Fixed in 0.134.

Comment 3 Preethi Thomas 2011-02-03 20:00:49 UTC
[root@preethi ~]# rpm -q pulp
pulp-0.0.134-1.fc14.noarch
[root@preethi ~]# pulp-admin -u admin -p admin repo create --id=tfoo --feed=local:blah
Successfully created repository [ tfoo ]

Comment 4 Preethi Thomas 2011-02-03 20:05:25 UTC
I still see this in the f13 pulp-server
fails-qa
[root@pulp-qe ~]# rpm -q pulp
pulp-0.0.134-1.fc13.noarch

[root@pulp-qe ~]#  pulp-admin -u admin -p admin repo create --id=tfoo --feed=local:blah
/usr/lib/python2.6/site-packages/pulp/client/credentials.py:21: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha as SHA
Successfully created repository [ tfoo ]

Comment 5 Jeff Ortel 2011-02-04 21:41:38 UTC
The fix is on master but must have missed the 0.134 build.  Perhaps I forget to push?  Anyway, it really should be in 0.135 - putting back to MODIFIED.

Comment 6 Preethi Thomas 2011-02-07 14:23:57 UTC
verified
[root@pulp-qe ~]# rpm -q pulp
pulp-0.0.135-1.fc13.noarch

[root@pulp-qe ~]#  pulp-admin -u admin -p admin repo create --id=testfoo --feed=local:blah

checked the /usr/lib/python2.6/site-packages/pulp/client/credentials.py:21:

 import hashlib

Comment 7 Preethi Thomas 2011-08-16 12:11:16 UTC
Closing with Community Release 15

pulp-0.0.223-4.

Comment 8 Preethi Thomas 2011-08-16 12:22:49 UTC
Closing with Community Release 15

pulp-0.0.223-4.


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