* Re: [PATCH 1/3] Make possible to use kvm_config as a standalone program.
[not found] <1321633905.1397161244441001336.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
@ 2009-06-08 6:07 ` Michael Goldish
2009-06-08 7:06 ` Michael Goldish
0 siblings, 1 reply; 4+ messages in thread
From: Michael Goldish @ 2009-06-08 6:07 UTC (permalink / raw)
To: Lucas Meneghel Rodrigues; +Cc: kvm
1. It would also be nice to add a '#!/usr/bin/python' line at the beginning of the file, so I can make the file executable and run it without the 'python' prefix.
2. I think you missed the exception raised in parse_file().
3. Wouldn't it be a good idea to define our own ConfigError exception class and raise it instead of ValueError or IOError?
Thanks,
Michael
----- Original Message -----
From: "Lucas Meneghel Rodrigues" <lmr@redhat.com>
To: kvm@vger.kernel.org
Cc: "Lucas Meneghel Rodrigues" <lmr@redhat.com>
Sent: Monday, June 8, 2009 7:01:47 AM (GMT+0200) Auto-Detected
Subject: [PATCH 1/3] Make possible to use kvm_config as a standalone program.
Replace autotest exceptions for standard python exceptions. This
will allow kvm_config.py to be used as a stand alone program.
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
client/tests/kvm/kvm_config.py | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index 8b6ab15..dda421b 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -1,5 +1,4 @@
import re, os, sys, StringIO
-from autotest_lib.client.common_lib import error
"""
KVM configuration file utility functions.
@@ -356,7 +355,7 @@ class config:
# (inside an exception or inside subvariants)
if restricted:
e_msg = "Using variants in this context is not allowed"
- raise error.AutotestError()
+ raise ValueError(e_msg)
if self.debug and not restricted:
self.__debug_print(indented_line,
"Entering variants block (%d dicts in"
@@ -401,7 +400,7 @@ class config:
words[1])
if not os.path.exists(filename):
e_msg = "Cannot include %s -- file not found" % filename
- raise error.AutotestError(e_msg)
+ raise IOError(e_msg)
new_file = open(filename, "r")
list = self.parse(new_file, list, restricted)
new_file.close()
@@ -409,7 +408,7 @@ class config:
self.__debug_print("", "Leaving file %s" % words[1])
else:
e_msg = "Cannot include anything because no file is open"
- raise error.AutotestError(e_msg)
+ raise ValueError(e_msg)
# Parse multi-line exceptions
# (the block is parsed for each dict separately)
--
1.6.2.2
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/3] Make possible to use kvm_config as a standalone program.
2009-06-08 6:07 ` [PATCH 1/3] Make possible to use kvm_config as a standalone program Michael Goldish
@ 2009-06-08 7:06 ` Michael Goldish
0 siblings, 0 replies; 4+ messages in thread
From: Michael Goldish @ 2009-06-08 7:06 UTC (permalink / raw)
To: Lucas Meneghel Rodrigues; +Cc: kvm, Autotest mailing list
Small correction to 1: '#!/usr/bin/env python' instead of '#!/usr/bin/python'. I'm not really sure what's better, but we used the one with 'env' before the merge. We still use it in stepeditor.
Also CCing Autotest.
----- Original Message -----
From: "Michael Goldish" <mgoldish@redhat.com>
To: "Lucas Meneghel Rodrigues" <lmr@redhat.com>
Cc: kvm@vger.kernel.org
Sent: Monday, June 8, 2009 9:07:58 AM (GMT+0200) Auto-Detected
Subject: Re: [PATCH 1/3] Make possible to use kvm_config as a standalone program.
1. It would also be nice to add a '#!/usr/bin/python' line at the beginning of the file, so I can make the file executable and run it without the 'python' prefix.
2. I think you missed the exception raised in parse_file().
3. Wouldn't it be a good idea to define our own ConfigError exception class and raise it instead of ValueError or IOError?
Thanks,
Michael
----- Original Message -----
From: "Lucas Meneghel Rodrigues" <lmr@redhat.com>
To: kvm@vger.kernel.org
Cc: "Lucas Meneghel Rodrigues" <lmr@redhat.com>
Sent: Monday, June 8, 2009 7:01:47 AM (GMT+0200) Auto-Detected
Subject: [PATCH 1/3] Make possible to use kvm_config as a standalone program.
Replace autotest exceptions for standard python exceptions. This
will allow kvm_config.py to be used as a stand alone program.
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
client/tests/kvm/kvm_config.py | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index 8b6ab15..dda421b 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -1,5 +1,4 @@
import re, os, sys, StringIO
-from autotest_lib.client.common_lib import error
"""
KVM configuration file utility functions.
@@ -356,7 +355,7 @@ class config:
# (inside an exception or inside subvariants)
if restricted:
e_msg = "Using variants in this context is not allowed"
- raise error.AutotestError()
+ raise ValueError(e_msg)
if self.debug and not restricted:
self.__debug_print(indented_line,
"Entering variants block (%d dicts in"
@@ -401,7 +400,7 @@ class config:
words[1])
if not os.path.exists(filename):
e_msg = "Cannot include %s -- file not found" % filename
- raise error.AutotestError(e_msg)
+ raise IOError(e_msg)
new_file = open(filename, "r")
list = self.parse(new_file, list, restricted)
new_file.close()
@@ -409,7 +408,7 @@ class config:
self.__debug_print("", "Leaving file %s" % words[1])
else:
e_msg = "Cannot include anything because no file is open"
- raise error.AutotestError(e_msg)
+ raise ValueError(e_msg)
# Parse multi-line exceptions
# (the block is parsed for each dict separately)
--
1.6.2.2
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/3] Make possible to use kvm_config as a standalone program.
@ 2009-06-08 4:04 Lucas Meneghel Rodrigues
0 siblings, 0 replies; 4+ messages in thread
From: Lucas Meneghel Rodrigues @ 2009-06-08 4:04 UTC (permalink / raw)
To: autotest; +Cc: kvm, Lucas Meneghel Rodrigues
Replace autotest exceptions for standard python exceptions. This
will allow kvm_config.py to be used as a stand alone program.
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
client/tests/kvm/kvm_config.py | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index 8b6ab15..dda421b 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -1,5 +1,4 @@
import re, os, sys, StringIO
-from autotest_lib.client.common_lib import error
"""
KVM configuration file utility functions.
@@ -356,7 +355,7 @@ class config:
# (inside an exception or inside subvariants)
if restricted:
e_msg = "Using variants in this context is not allowed"
- raise error.AutotestError()
+ raise ValueError(e_msg)
if self.debug and not restricted:
self.__debug_print(indented_line,
"Entering variants block (%d dicts in"
@@ -401,7 +400,7 @@ class config:
words[1])
if not os.path.exists(filename):
e_msg = "Cannot include %s -- file not found" % filename
- raise error.AutotestError(e_msg)
+ raise IOError(e_msg)
new_file = open(filename, "r")
list = self.parse(new_file, list, restricted)
new_file.close()
@@ -409,7 +408,7 @@ class config:
self.__debug_print("", "Leaving file %s" % words[1])
else:
e_msg = "Cannot include anything because no file is open"
- raise error.AutotestError(e_msg)
+ raise ValueError(e_msg)
# Parse multi-line exceptions
# (the block is parsed for each dict separately)
--
1.6.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [KVM-AUTOTEST PATCH 0/8] Re-submitting some of the patches on the patch queue
@ 2009-06-08 4:01 Lucas Meneghel Rodrigues
2009-06-08 4:01 ` [KVM-AUTOTEST PATCH 1/8] kvm_config: Allow for "=" in the value of a config parameter Lucas Meneghel Rodrigues
0 siblings, 1 reply; 4+ messages in thread
From: Lucas Meneghel Rodrigues @ 2009-06-08 4:01 UTC (permalink / raw)
To: kvm; +Cc: Lucas Meneghel Rodrigues
I have rebased some of the patches on the patch queue I sent earlier to the
list. I am sending them to your appreciation, the other will follow.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [KVM-AUTOTEST PATCH 1/8] kvm_config: Allow for "=" in the value of a config parameter
2009-06-08 4:01 [KVM-AUTOTEST PATCH 0/8] Re-submitting some of the patches on the patch queue Lucas Meneghel Rodrigues
@ 2009-06-08 4:01 ` Lucas Meneghel Rodrigues
2009-06-08 4:01 ` [PATCH 1/3] Make possible to use kvm_config as a standalone program Lucas Meneghel Rodrigues
0 siblings, 1 reply; 4+ messages in thread
From: Lucas Meneghel Rodrigues @ 2009-06-08 4:01 UTC (permalink / raw)
To: kvm; +Cc: Lucas Meneghel Rodrigues, David Huff
fix modifies kvm_config.split_and_strip so it will only split once per
line.
example: kernel_args = "ks=floppy console=ttyS0 noacpi"
Signed-off-by: David Huff <dhuff@redhat.com>
---
client/tests/kvm/kvm_config.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index 8b6ab15..40f16f1 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -136,7 +136,7 @@ class config:
@param str: String that will be processed
@param sep: Separator that will be used to split the string
"""
- temp = str.split(sep)
+ temp = str.split(sep, 1)
for i in range(len(temp)):
temp[i] = temp[i].strip()
temp[i] = temp[i].strip("\"\'")
--
1.6.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 1/3] Make possible to use kvm_config as a standalone program.
2009-06-08 4:01 ` [KVM-AUTOTEST PATCH 1/8] kvm_config: Allow for "=" in the value of a config parameter Lucas Meneghel Rodrigues
@ 2009-06-08 4:01 ` Lucas Meneghel Rodrigues
0 siblings, 0 replies; 4+ messages in thread
From: Lucas Meneghel Rodrigues @ 2009-06-08 4:01 UTC (permalink / raw)
To: kvm; +Cc: Lucas Meneghel Rodrigues
Replace autotest exceptions for standard python exceptions. This
will allow kvm_config.py to be used as a stand alone program.
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
client/tests/kvm/kvm_config.py | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index 8b6ab15..dda421b 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -1,5 +1,4 @@
import re, os, sys, StringIO
-from autotest_lib.client.common_lib import error
"""
KVM configuration file utility functions.
@@ -356,7 +355,7 @@ class config:
# (inside an exception or inside subvariants)
if restricted:
e_msg = "Using variants in this context is not allowed"
- raise error.AutotestError()
+ raise ValueError(e_msg)
if self.debug and not restricted:
self.__debug_print(indented_line,
"Entering variants block (%d dicts in"
@@ -401,7 +400,7 @@ class config:
words[1])
if not os.path.exists(filename):
e_msg = "Cannot include %s -- file not found" % filename
- raise error.AutotestError(e_msg)
+ raise IOError(e_msg)
new_file = open(filename, "r")
list = self.parse(new_file, list, restricted)
new_file.close()
@@ -409,7 +408,7 @@ class config:
self.__debug_print("", "Leaving file %s" % words[1])
else:
e_msg = "Cannot include anything because no file is open"
- raise error.AutotestError(e_msg)
+ raise ValueError(e_msg)
# Parse multi-line exceptions
# (the block is parsed for each dict separately)
--
1.6.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-08 7:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1321633905.1397161244441001336.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-06-08 6:07 ` [PATCH 1/3] Make possible to use kvm_config as a standalone program Michael Goldish
2009-06-08 7:06 ` Michael Goldish
2009-06-08 4:04 Lucas Meneghel Rodrigues
-- strict thread matches above, loose matches on Subject: below --
2009-06-08 4:01 [KVM-AUTOTEST PATCH 0/8] Re-submitting some of the patches on the patch queue Lucas Meneghel Rodrigues
2009-06-08 4:01 ` [KVM-AUTOTEST PATCH 1/8] kvm_config: Allow for "=" in the value of a config parameter Lucas Meneghel Rodrigues
2009-06-08 4:01 ` [PATCH 1/3] Make possible to use kvm_config as a standalone program Lucas Meneghel Rodrigues
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox