From patchwork Tue Sep 8 22:32:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 46259 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n88MWw2H025350 for ; Tue, 8 Sep 2009 22:32:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752344AbZIHWcx (ORCPT ); Tue, 8 Sep 2009 18:32:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752227AbZIHWcx (ORCPT ); Tue, 8 Sep 2009 18:32:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25316 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752150AbZIHWct (ORCPT ); Tue, 8 Sep 2009 18:32:49 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n88MWppF030045; Tue, 8 Sep 2009 18:32:51 -0400 Received: from localhost.localdomain (vpn-10-42.bos.redhat.com [10.16.10.42]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n88MWfrv001935; Tue, 8 Sep 2009 18:32:49 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, mgoldish@redhat.com, Lucas Meneghel Rodrigues Subject: [PATCH 3/4] KVM test: Removing the fix_cdkeys.py program Date: Tue, 8 Sep 2009 19:32:38 -0300 Message-Id: <1252449159-8499-3-git-send-email-lmr@redhat.com> In-Reply-To: <1252449159-8499-2-git-send-email-lmr@redhat.com> References: <1252449159-8499-1-git-send-email-lmr@redhat.com> <1252449159-8499-2-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org That is no longer necessary since we handle cd keys on a separate configuration file. Signed-off-by: Lucas Meneghel Rodrigues --- client/tests/kvm/fix_cdkeys.py | 76 ---------------------------------------- 1 files changed, 0 insertions(+), 76 deletions(-) delete mode 100755 client/tests/kvm/fix_cdkeys.py diff --git a/client/tests/kvm/fix_cdkeys.py b/client/tests/kvm/fix_cdkeys.py deleted file mode 100755 index aa9fc3e..0000000 --- a/client/tests/kvm/fix_cdkeys.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/python -""" -Program that replaces the CD keys present on a KVM autotest configuration file. - -@copyright: Red Hat 2008-2009 -@author: uril@redhat.com (Uri Lublin) -""" - -import shutil, os, sys -import common - - -def file_to_lines(filename): - f = open(filename, 'r') - lines = f.readlines() - f.close - return lines - -def lines_to_file(filename, lines): - f = open(filename, 'w') - f.writelines(lines) - f.close() - -def replace_var_with_val(lines, variables): - new = [] - for line in lines: - for (var,val) in variables: - if var in line: - print 'replacing %s with %s in "%s"' % (var, val, line[:-1]) - line = line.replace(var, val) - print ' ... new line is "%s"' % (line[:-1]) - new.append(line) - return new - -def filter_comments(line): - return not line.strip().startswith('#') - -def filter_empty(line): - return len(line.strip()) != 0 - -def line_to_pair(line): - x,y = line.split('=', 1) - return (x.strip(), y.strip()) - -def read_vars(varfile): - varlines = file_to_lines(varfile) - varlines = filter(filter_comments, varlines) - varlines = filter(filter_empty, varlines) - vars = map(line_to_pair, varlines) - return vars - -def main(cfgfile, varfile): - # first save a copy of the original file (if does not exist) - backupfile = '%s.backup' % cfgfile - if not os.path.exists(backupfile): - shutil.copy(cfgfile, backupfile) - - vars = read_vars(varfile) - datalines = file_to_lines(cfgfile) - newlines = replace_var_with_val(datalines, vars) - lines_to_file(cfgfile, newlines) - - -if __name__ == '__main__': - def die(msg, val): - print msg - sys.exit(val) - if len(sys.argv) != 3: - die('usage: %s ', 1) - cfgfile = sys.argv[1] - varfile = sys.argv[2] - if not os.path.exists(cfgfile): - die('bad cfgfile "%s"' % cfgfile, 2) - if not os.path.exists(varfile): - die('bad varfile "%s"' % varfile, 2) - main(cfgfile, varfile)