diff mbox

KVM test: get_started.py: Create from all sample files found

Message ID 1315248893-12451-1-git-send-email-lmr@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Meneghel Rodrigues Sept. 5, 2011, 6:54 p.m. UTC
Rather than keeping a list of sample files on the kvm test
dir, just glob for them and create the actual config files
as needed. This way we won't have to modify the program
every time a new config file gets added.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/get_started.py |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/client/tests/kvm/get_started.py b/client/tests/kvm/get_started.py
index d97fd8a..1a65613 100755
--- a/client/tests/kvm/get_started.py
+++ b/client/tests/kvm/get_started.py
@@ -5,7 +5,7 @@  Program to help setup kvm test environment
 @copyright: Red Hat 2010
 """
 
-import os, sys, logging, shutil
+import os, sys, logging, shutil, glob
 import common
 from autotest_lib.client.common_lib import logging_manager
 from autotest_lib.client.bin import utils
@@ -85,11 +85,10 @@  if __name__ == "__main__":
                  "config samples to actual config files)")
     kvm_test_dir = os.path.dirname(sys.modules[__name__].__file__)
     kvm_test_dir = os.path.abspath(kvm_test_dir)
-    config_file_list = ["build.cfg", "cdkeys.cfg", "tests_base.cfg",
-                        "tests.cfg", "unittests.cfg", "virtio-win.cfg"]
+    config_file_list = glob.glob(os.path.join(kvm_test_dir, "*.cfg.sample"))
     for config_file in config_file_list:
-        src_file = os.path.join(kvm_test_dir, "%s.sample" % config_file)
-        dst_file = os.path.join(kvm_test_dir, config_file)
+        src_file = config_file
+        dst_file = src_file.rstrip(".sample")
         if not os.path.isfile(dst_file):
             logging.debug("Creating config file %s from sample", dst_file)
             shutil.copyfile(src_file, dst_file)