FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 08-22-2011, 02:49 PM
James Laska
 
Default Add support for 'autopart --nolvm'

---
pykickstart/commands/autopart.py | 29 +++++++++++++++++++++++++++++
pykickstart/handlers/control.py | 2 +-
tests/commands/autopart.py | 15 +++++++++++++++
3 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/pykickstart/commands/autopart.py b/pykickstart/commands/autopart.py
index 3ea3a16..d4b6873 100644
--- a/pykickstart/commands/autopart.py
+++ b/pykickstart/commands/autopart.py
@@ -119,3 +119,32 @@ class F12_AutoPart(F9_AutoPart):
op.add_option("--escrowcert")
op.add_option("--backuppassphrase", action="store_true", default=False)
return op
+
+class F16_AutoPart(F12_AutoPart):
+ removedKeywords = F12_AutoPart.removedKeywords
+ removedAttrs = F12_AutoPart.removedAttrs
+
+ def __init__(self, writePriority=100, *args, **kwargs):
+ F12_AutoPart.__init__(self, writePriority=writePriority, *args, **kwargs)
+ self.lvm = kwargs.get("lvm", True)
+
+ def __str__(self):
+ retval = F12_AutoPart.__str__(self)
+
+ # If requested, disable LVM autopart
+ if not self.lvm:
+ # remove any trailing newline
+ retval = retval.strip()
+ retval += " --nolvm"
+ retval += "
"
+
+ return retval
+
+ def _getParser(self):
+ def lvm_cb (option, opt_str, value, parser):
+ parser.values.lvm = False
+
+ op = F12_AutoPart._getParser(self)
+ op.add_option("--nolvm", action="callback", callback=lvm_cb,
+ dest="lvm", default=True, nargs=0)
+ return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index d8c8f2b..27cbaad 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -767,7 +767,7 @@ commandMap = {
F16: {
"auth": authconfig.FC3_Authconfig,
"authconfig": authconfig.FC3_Authconfig,
- "autopart": autopart.F12_AutoPart,
+ "autopart": autopart.F16_AutoPart,
"autostep": autostep.FC3_AutoStep,
"bootloader": bootloader.F15_Bootloader,
"cdrom": method.F14_Method,
diff --git a/tests/commands/autopart.py b/tests/commands/autopart.py
index 51c663e..5949fea 100644
--- a/tests/commands/autopart.py
+++ b/tests/commands/autopart.py
@@ -79,5 +79,20 @@ class F12_TestCase(F9_TestCase):
self.assert_parse_error("autopart --backuppassphrase=False")
self.assert_parse_error("autopart --backuppassphrase=True")

+class F16_TestCase(F12_TestCase):
+ def runTest(self):
+ # Run F12 test case
+ F12_TestCase.runTest(self)
+
+ # pass
+ self.assert_parse("autopart --nolvm",
+ "autopart --nolvm
")
+
+ # fail
+ self.assert_parse_error("autopart --nolvm=asdf")
+ self.assert_parse_error("autopart --nolvm True", KickstartValueError)
+ self.assert_parse_error("autopart --nolvm=1")
+ self.assert_parse_error("autopart --nolvm 0", KickstartValueError)
+
if __name__ == "__main__":
unittest.main()
--
1.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 08-22-2011, 06:17 PM
Chris Lumens
 
Default Add support for 'autopart --nolvm'

> + def _getParser(self):
> + def lvm_cb (option, opt_str, value, parser):
> + parser.values.lvm = False
> +
> + op = F12_AutoPart._getParser(self)
> + op.add_option("--nolvm", action="callback", callback=lvm_cb,
> + dest="lvm", default=True, nargs=0)
> + return op

You should just be able to make this:

op.add_option("--nolvm", action="store_false", default=True, dest="lvm")

Right?

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 08-22-2011, 08:03 PM
James Laska
 
Default Add support for 'autopart --nolvm'

---
pykickstart/commands/autopart.py | 26 ++++++++++++++++++++++++++
pykickstart/handlers/control.py | 2 +-
tests/commands/autopart.py | 15 +++++++++++++++
3 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/pykickstart/commands/autopart.py b/pykickstart/commands/autopart.py
index 3ea3a16..c104380 100644
--- a/pykickstart/commands/autopart.py
+++ b/pykickstart/commands/autopart.py
@@ -119,3 +119,29 @@ class F12_AutoPart(F9_AutoPart):
op.add_option("--escrowcert")
op.add_option("--backuppassphrase", action="store_true", default=False)
return op
+
+class F16_AutoPart(F12_AutoPart):
+ removedKeywords = F12_AutoPart.removedKeywords
+ removedAttrs = F12_AutoPart.removedAttrs
+
+ def __init__(self, writePriority=100, *args, **kwargs):
+ F12_AutoPart.__init__(self, writePriority=writePriority, *args, **kwargs)
+ self.lvm = kwargs.get("lvm", True)
+
+ def __str__(self):
+ retval = F12_AutoPart.__str__(self)
+
+ # If requested, disable LVM autopart
+ if not self.lvm:
+ # remove any trailing newline
+ retval = retval.strip()
+ retval += " --nolvm"
+ retval += "
"
+
+ return retval
+
+ def _getParser(self):
+ op = F12_AutoPart._getParser(self)
+ op.add_option("--nolvm", action="store_false", dest="lvm",
+ default=True)
+ return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index d8c8f2b..27cbaad 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -767,7 +767,7 @@ commandMap = {
F16: {
"auth": authconfig.FC3_Authconfig,
"authconfig": authconfig.FC3_Authconfig,
- "autopart": autopart.F12_AutoPart,
+ "autopart": autopart.F16_AutoPart,
"autostep": autostep.FC3_AutoStep,
"bootloader": bootloader.F15_Bootloader,
"cdrom": method.F14_Method,
diff --git a/tests/commands/autopart.py b/tests/commands/autopart.py
index 51c663e..5949fea 100644
--- a/tests/commands/autopart.py
+++ b/tests/commands/autopart.py
@@ -79,5 +79,20 @@ class F12_TestCase(F9_TestCase):
self.assert_parse_error("autopart --backuppassphrase=False")
self.assert_parse_error("autopart --backuppassphrase=True")

+class F16_TestCase(F12_TestCase):
+ def runTest(self):
+ # Run F12 test case
+ F12_TestCase.runTest(self)
+
+ # pass
+ self.assert_parse("autopart --nolvm",
+ "autopart --nolvm
")
+
+ # fail
+ self.assert_parse_error("autopart --nolvm=asdf")
+ self.assert_parse_error("autopart --nolvm True", KickstartValueError)
+ self.assert_parse_error("autopart --nolvm=1")
+ self.assert_parse_error("autopart --nolvm 0", KickstartValueError)
+
if __name__ == "__main__":
unittest.main()
--
1.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 09:24 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org