PR#631: cg_import fails immediately if build directory already exists
Merges #631 https://pagure.io/koji/pull-request/631 Merges #425 https://pagure.io//koji/issue/425
This commit is contained in:
commit
21fefc4c77
1 changed files with 8 additions and 0 deletions
|
|
@ -5225,6 +5225,7 @@ class CG_Importer(object):
|
|||
|
||||
self.assert_policy()
|
||||
self.set_volume()
|
||||
self.check_build_dir()
|
||||
|
||||
koji.plugin.run_callbacks('preImport', type='cg', metadata=metadata,
|
||||
directory=directory)
|
||||
|
|
@ -5312,6 +5313,13 @@ class CG_Importer(object):
|
|||
self.buildinfo['volume_name'] = vol['name']
|
||||
|
||||
|
||||
def check_build_dir(self):
|
||||
"""Check that the import directory does not already exist"""
|
||||
path = koji.pathinfo.build(self.buildinfo)
|
||||
if os.path.lexists(path):
|
||||
raise koji.GenericError("Destination directory already exists: %s" % path)
|
||||
|
||||
|
||||
def prep_build(self):
|
||||
metadata = self.metadata
|
||||
buildinfo = get_build(metadata['build'], strict=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue