Merge "Allow empty directories for tempest init"
This commit is contained in:
commit
4d91bfe9fc
tempest
@ -116,9 +116,9 @@ class TempestInit(command.Command):
|
||||
if not os.path.isdir(local_dir):
|
||||
LOG.debug('Creating local working dir: %s' % local_dir)
|
||||
os.mkdir(local_dir)
|
||||
else:
|
||||
elif not os.listdir(local_dir) == []:
|
||||
raise OSError("Directory you are trying to initialize already "
|
||||
"exists: %s" % local_dir)
|
||||
"exists and is not empty: %s" % local_dir)
|
||||
|
||||
lock_dir = os.path.join(local_dir, 'tempest_lock')
|
||||
etc_dir = os.path.join(local_dir, 'etc')
|
||||
|
@ -58,9 +58,11 @@ class TestTempestInit(base.TestCase):
|
||||
self.assertTrue(os.path.isfile(local_sample_conf_file))
|
||||
self.assertGreater(os.path.getsize(local_sample_conf_file), 0)
|
||||
|
||||
def test_create_working_dir_with_existing_local_dir(self):
|
||||
def test_create_working_dir_with_existing_local_dir_non_empty(self):
|
||||
fake_local_dir = self.useFixture(fixtures.TempDir())
|
||||
fake_local_conf_dir = self.useFixture(fixtures.TempDir())
|
||||
open("%s/foo" % fake_local_dir.path, 'w').close()
|
||||
|
||||
_init = init.TempestInit(None, None)
|
||||
self.assertRaises(OSError,
|
||||
_init.create_working_dir,
|
||||
|
Loading…
x
Reference in New Issue
Block a user