mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-12 04:26:26 +00:00
Prevent overwrite of existing files when saving licenses
This commit is contained in:
@@ -2592,6 +2592,9 @@ class XCCClient(IMMClient):
|
||||
if filename:
|
||||
url = '/download/' + filename
|
||||
savefile = os.path.join(directory, filename)
|
||||
if os.path.exists(savefile):
|
||||
raise pygexc.InvalidParameterValue(
|
||||
'File already exists: ' + savefile)
|
||||
wc = await self.wc()
|
||||
fd = webclient.make_downloader(wc, url, savefile)
|
||||
while not fd.completed():
|
||||
|
||||
@@ -1658,6 +1658,9 @@ class OEMHandler(object):
|
||||
if dload:
|
||||
filename = os.path.basename(dload)
|
||||
savefile = os.path.join(directory, filename)
|
||||
if os.path.exists(savefile):
|
||||
raise exc.PyghmiException(
|
||||
'File {} already exists'.format(savefile))
|
||||
dler = webclient.make_downloader(fishclient.wc, dload, savefile)
|
||||
await dler.join()
|
||||
yield savefile
|
||||
|
||||
@@ -1697,6 +1697,9 @@ class OEMHandler(generic.OEMHandler):
|
||||
if filename:
|
||||
url = '/download/' + filename
|
||||
savefile = os.path.join(directory, filename)
|
||||
if os.path.exists(savefile):
|
||||
raise pygexc.InvalidParameterValue(
|
||||
'File {0} already exists'.format(savefile))
|
||||
fd = webclient.make_downloader(wc, url, savefile)
|
||||
while not fd.completed():
|
||||
try:
|
||||
|
||||
@@ -789,6 +789,9 @@ class OEMHandler(generic.OEMHandler):
|
||||
fname = os.path.basename(durl)
|
||||
if autosuffix and not savefile.endswith('.tar.zst'):
|
||||
savefile += '-{0}'.format(fname)
|
||||
if os.path.exists(savefile):
|
||||
raise pygexc.InvalidParameterValue(
|
||||
'File {0} already exists'.format(savefile))
|
||||
fd = webclient.make_downloader(self.webclient, durl, savefile)
|
||||
while not fd.completed():
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user