mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-14 09:36:21 +01:00
make delete_package() and delete_project() more userfriendly (added trivial exception handling..)
This commit is contained in:
parent
f36e3133c7
commit
63d6dede67
24
osc/core.py
24
osc/core.py
@ -1360,15 +1360,31 @@ def copy_pac(src_apiurl, src_project, src_package,
|
|||||||
|
|
||||||
|
|
||||||
def delete_package(apiurl, prj, pac):
|
def delete_package(apiurl, prj, pac):
|
||||||
|
|
||||||
u = makeurl(apiurl, ['source', prj, pac])
|
u = makeurl(apiurl, ['source', prj, pac])
|
||||||
http_DELETE(u)
|
try:
|
||||||
|
http_DELETE(u)
|
||||||
|
except urllib2.HTTPError, e:
|
||||||
|
if e.code == 404:
|
||||||
|
print >>sys.stderr, 'Package \'%s\' does not exist' % pac
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
print >>sys.stderr, 'an unexpected error occured while deleting ' \
|
||||||
|
'\'%s\'' % pac
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def delete_project(apiurl, prj):
|
def delete_project(apiurl, prj):
|
||||||
|
|
||||||
u = makeurl(apiurl, ['source', prj])
|
u = makeurl(apiurl, ['source', prj])
|
||||||
http_DELETE(u)
|
try:
|
||||||
|
http_DELETE(u)
|
||||||
|
except urllib2.HTTPError, e:
|
||||||
|
if e.code == 404:
|
||||||
|
print >>sys.stderr, 'Package \'%s\' does not exist' % pac
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
print >>sys.stderr, 'an unexpected error occured while deleting ' \
|
||||||
|
'\'%s\'' % pac
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def get_platforms(apiurl):
|
def get_platforms(apiurl):
|
||||||
|
Loading…
Reference in New Issue
Block a user