Merge "Allow empty directories for tempest init"
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index af8f270..a4ed064 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -116,9 +116,9 @@
         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')
diff --git a/tempest/tests/cmd/test_tempest_init.py b/tempest/tests/cmd/test_tempest_init.py
index 1d60c67..1048a52 100644
--- a/tempest/tests/cmd/test_tempest_init.py
+++ b/tempest/tests/cmd/test_tempest_init.py
@@ -58,9 +58,11 @@
         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,