Bug 677662

Summary: ServicesConnection.upload() should not throw an exception when uploaded package exists
Product: [Retired] Pulp Reporter: Daniel Mach <dmach>
Component: z_otherAssignee: Pradeep Kilambi <pkilambi>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: pkilambi, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 21   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 12:11:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 563609, 647488    

Description Daniel Mach 2011-02-15 14:18:57 UTC
When re-uploading existing package, an exception is thrown.
This exception doesn't contain any information other than a traceback text.
I think server should return an error code (and message) instead so client can act properly.

sconn = pulp.client.connection.ServicesConnection()
sconn.upload(...)

This is *text*, not actual exception instance:
500: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/base.py", line 52, in report_error
    return method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/compat.py", line 40, in _decorator
    return decorator(*args,**kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/base.py", line 124, in _auth_decorator
    value = method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/services.py", line 61, in POST
    return self.ok(papi.upload(data['pkginfo'], data['pkgstream']))
  File "/usr/lib/python2.7/site-packages/pulp/server/api/package.py", line 230, in upload
    raise pae
PackageAlreadyExists: Package testpkg-1-1.el5.noarch.rpm Already Exists on the server with checksum [2f77b988b8c85eb7c09832bbe4b5fb9514b1c0231bd4d19936f6c01f3f2b1e3d]; skipping upload.

Comment 1 Pradeep Kilambi 2011-02-23 15:09:20 UTC
fixed this as part of upload rewrite.

Comment 2 Jeff Ortel 2011-02-23 17:59:58 UTC
Build: 0.141

Comment 3 Preethi Thomas 2011-03-07 20:04:32 UTC
verified

[root@preethi ~]# rpm -q pulp
pulp-0.0.144-1.fc14.noarch

[root@preethi ~]# pulp-admin content upload -r upload2 /root/upload/gofer-0.20-1.fc14.noarch.rpm  -v 
* Starting Package Upload

* Performing Package Uploads to Pulp server
Package [/root/upload/gofer-0.20-1.fc14.noarch.rpm] is not signed. Please use --nosig. Skipping 
No applicable content to associate.
[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]# pulp-admin content upload -r upload2 /root/upload/gofer-0.20-1.fc14.noarch.rpm  --nosig -v 
* Starting Package Upload

* Performing Package Uploads to Pulp server
Successfully uploaded [gofer-0.20-1.fc14.noarch.rpm] to server

* Performing Repo Associations 
Package association Complete for Repo [upload2]: 
 Packages: 
gofer-0.20-1.fc14.noarch.rpm 
 
 Files: 
None

* Content Upload complete.
[root@preethi ~]# pulp-admin content upload -r upload2 /root/upload/gofer-0.20-1.fc14.noarch.rpm  --nosig -v 
* Starting Package Upload

* Performing Package Uploads to Pulp server
Package [gofer-0.20-1.fc14.noarch.rpm] already exists on the server with checksum [37f3605eabbb0ef9fb73f504b84422036e9af17f3d6247d594e610ca2a727df2]

* Performing Repo Associations 
Package association Complete for Repo [upload2]: 
 Packages: 
gofer-0.20-1.fc14.noarch.rpm 
 
 Files: 
None

* Content Upload complete.

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

pulp-0.0.223-4.

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

pulp-0.0.223-4.