diff options
Diffstat (limited to 'scripts/lib/mic/3rdparty/pykickstart/commands')
51 files changed, 6019 insertions, 0 deletions
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/__init__.py b/scripts/lib/mic/3rdparty/pykickstart/commands/__init__.py new file mode 100644 index 0000000000..da48ff50d5 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/__init__.py | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2009 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | import authconfig, autopart, autostep, bootloader, clearpart, device | ||
| 21 | import deviceprobe, displaymode, dmraid, driverdisk, fcoe, firewall, firstboot | ||
| 22 | import group, ignoredisk, interactive, iscsi, iscsiname, key, keyboard, lang | ||
| 23 | import langsupport, lilocheck, logging, logvol, mediacheck, method, monitor | ||
| 24 | import mouse, multipath, network, partition, raid, reboot, repo, rescue, rootpw | ||
| 25 | import selinux, services, skipx, sshpw, timezone, updates, upgrade, user, vnc | ||
| 26 | import volgroup, xconfig, zerombr, zfcp | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/authconfig.py b/scripts/lib/mic/3rdparty/pykickstart/commands/authconfig.py new file mode 100644 index 0000000000..9af9c0ff14 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/authconfig.py | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | |||
| 22 | class FC3_Authconfig(KickstartCommand): | ||
| 23 | removedKeywords = KickstartCommand.removedKeywords | ||
| 24 | removedAttrs = KickstartCommand.removedAttrs | ||
| 25 | |||
| 26 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 27 | KickstartCommand.__init__(self, *args, **kwargs) | ||
| 28 | self.authconfig = kwargs.get("authconfig", "") | ||
| 29 | |||
| 30 | def __str__(self): | ||
| 31 | retval = KickstartCommand.__str__(self) | ||
| 32 | |||
| 33 | if self.authconfig: | ||
| 34 | retval += "# System authorization information\nauth %s\n" % self.authconfig | ||
| 35 | |||
| 36 | return retval | ||
| 37 | |||
| 38 | def parse(self, args): | ||
| 39 | self.authconfig = self.currentLine[len(self.currentCmd):].strip() | ||
| 40 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/autopart.py b/scripts/lib/mic/3rdparty/pykickstart/commands/autopart.py new file mode 100644 index 0000000000..cf28b5c7f7 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/autopart.py | |||
| @@ -0,0 +1,119 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_AutoPart(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=100, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.autopart = kwargs.get("autopart", False) | ||
| 34 | |||
| 35 | def __str__(self): | ||
| 36 | retval = KickstartCommand.__str__(self) | ||
| 37 | |||
| 38 | if self.autopart: | ||
| 39 | retval += "autopart\n" | ||
| 40 | |||
| 41 | return retval | ||
| 42 | |||
| 43 | def parse(self, args): | ||
| 44 | if len(args) > 0: | ||
| 45 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "autopart") | ||
| 46 | |||
| 47 | self.autopart = True | ||
| 48 | return self | ||
| 49 | |||
| 50 | class F9_AutoPart(FC3_AutoPart): | ||
| 51 | removedKeywords = FC3_AutoPart.removedKeywords | ||
| 52 | removedAttrs = FC3_AutoPart.removedAttrs | ||
| 53 | |||
| 54 | def __init__(self, writePriority=100, *args, **kwargs): | ||
| 55 | FC3_AutoPart.__init__(self, writePriority=writePriority, *args, **kwargs) | ||
| 56 | self.encrypted = kwargs.get("encrypted", False) | ||
| 57 | self.passphrase = kwargs.get("passphrase", "") | ||
| 58 | |||
| 59 | self.op = self._getParser() | ||
| 60 | |||
| 61 | def __str__(self): | ||
| 62 | retval = KickstartCommand.__str__(self) | ||
| 63 | |||
| 64 | if self.autopart: | ||
| 65 | retval += "autopart" | ||
| 66 | |||
| 67 | if self.encrypted: | ||
| 68 | retval += " --encrypted" | ||
| 69 | |||
| 70 | if self.passphrase != "": | ||
| 71 | retval += " --passphrase=\"%s\""% self.passphrase | ||
| 72 | |||
| 73 | if retval != "": | ||
| 74 | retval += "\n" | ||
| 75 | |||
| 76 | return retval | ||
| 77 | |||
| 78 | def _getParser(self): | ||
| 79 | op = KSOptionParser() | ||
| 80 | op.add_option("--encrypted", action="store_true", default=False) | ||
| 81 | op.add_option("--passphrase") | ||
| 82 | return op | ||
| 83 | |||
| 84 | def parse(self, args): | ||
| 85 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 86 | self._setToSelf(self.op, opts) | ||
| 87 | self.autopart = True | ||
| 88 | return self | ||
| 89 | |||
| 90 | class F12_AutoPart(F9_AutoPart): | ||
| 91 | removedKeywords = F9_AutoPart.removedKeywords | ||
| 92 | removedAttrs = F9_AutoPart.removedAttrs | ||
| 93 | |||
| 94 | def __init__(self, writePriority=100, *args, **kwargs): | ||
| 95 | F9_AutoPart.__init__(self, writePriority=writePriority, *args, **kwargs) | ||
| 96 | |||
| 97 | self.escrowcert = kwargs.get("escrowcert", "") | ||
| 98 | self.backuppassphrase = kwargs.get("backuppassphrase", False) | ||
| 99 | |||
| 100 | def __str__(self): | ||
| 101 | retval = F9_AutoPart.__str__(self) | ||
| 102 | |||
| 103 | if self.encrypted and self.escrowcert != "": | ||
| 104 | retval = retval.strip() | ||
| 105 | |||
| 106 | retval += " --escrowcert=\"%s\"" % self.escrowcert | ||
| 107 | |||
| 108 | if self.backuppassphrase: | ||
| 109 | retval += " --backuppassphrase" | ||
| 110 | |||
| 111 | retval += "\n" | ||
| 112 | |||
| 113 | return retval | ||
| 114 | |||
| 115 | def _getParser(self): | ||
| 116 | op = F9_AutoPart._getParser(self) | ||
| 117 | op.add_option("--escrowcert") | ||
| 118 | op.add_option("--backuppassphrase", action="store_true", default=False) | ||
| 119 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/autostep.py b/scripts/lib/mic/3rdparty/pykickstart/commands/autostep.py new file mode 100644 index 0000000000..e6ae71cefc --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/autostep.py | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | class FC3_AutoStep(KickstartCommand): | ||
| 24 | removedKeywords = KickstartCommand.removedKeywords | ||
| 25 | removedAttrs = KickstartCommand.removedAttrs | ||
| 26 | |||
| 27 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 28 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 29 | self.op = self._getParser() | ||
| 30 | |||
| 31 | self.autostep = kwargs.get("autostep", False) | ||
| 32 | self.autoscreenshot = kwargs.get("autoscreenshot", False) | ||
| 33 | |||
| 34 | def __str__(self): | ||
| 35 | retval = KickstartCommand.__str__(self) | ||
| 36 | |||
| 37 | if self.autostep: | ||
| 38 | if self.autoscreenshot: | ||
| 39 | retval += "autostep --autoscreenshot\n" | ||
| 40 | else: | ||
| 41 | retval += "autostep\n" | ||
| 42 | |||
| 43 | return retval | ||
| 44 | |||
| 45 | def _getParser(self): | ||
| 46 | op = KSOptionParser() | ||
| 47 | op.add_option("--autoscreenshot", dest="autoscreenshot", | ||
| 48 | action="store_true", default=False) | ||
| 49 | return op | ||
| 50 | |||
| 51 | def parse(self, args): | ||
| 52 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 53 | self._setToSelf(self.op, opts) | ||
| 54 | self.autostep = True | ||
| 55 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py b/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py new file mode 100644 index 0000000000..b227fac3be --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py | |||
| @@ -0,0 +1,265 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | class FC3_Bootloader(KickstartCommand): | ||
| 24 | removedKeywords = KickstartCommand.removedKeywords | ||
| 25 | removedAttrs = KickstartCommand.removedAttrs | ||
| 26 | |||
| 27 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 28 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 29 | self.op = self._getParser() | ||
| 30 | |||
| 31 | self.driveorder = kwargs.get("driveorder", []) | ||
| 32 | self.appendLine = kwargs.get("appendLine", "") | ||
| 33 | self.forceLBA = kwargs.get("forceLBA", False) | ||
| 34 | self.linear = kwargs.get("linear", True) | ||
| 35 | self.location = kwargs.get("location", "") | ||
| 36 | self.md5pass = kwargs.get("md5pass", "") | ||
| 37 | self.password = kwargs.get("password", "") | ||
| 38 | self.upgrade = kwargs.get("upgrade", False) | ||
| 39 | self.useLilo = kwargs.get("useLilo", False) | ||
| 40 | |||
| 41 | self.deleteRemovedAttrs() | ||
| 42 | |||
| 43 | def _getArgsAsStr(self): | ||
| 44 | retval = "" | ||
| 45 | |||
| 46 | if self.appendLine != "": | ||
| 47 | retval += " --append=\"%s\"" % self.appendLine | ||
| 48 | if self.linear: | ||
| 49 | retval += " --linear" | ||
| 50 | if self.location: | ||
| 51 | retval += " --location=%s" % self.location | ||
| 52 | if hasattr(self, "forceLBA") and self.forceLBA: | ||
| 53 | retval += " --lba32" | ||
| 54 | if self.password != "": | ||
| 55 | retval += " --password=\"%s\"" % self.password | ||
| 56 | if self.md5pass != "": | ||
| 57 | retval += " --md5pass=\"%s\"" % self.md5pass | ||
| 58 | if self.upgrade: | ||
| 59 | retval += " --upgrade" | ||
| 60 | if self.useLilo: | ||
| 61 | retval += " --useLilo" | ||
| 62 | if len(self.driveorder) > 0: | ||
| 63 | retval += " --driveorder=\"%s\"" % ",".join(self.driveorder) | ||
| 64 | |||
| 65 | return retval | ||
| 66 | |||
| 67 | def __str__(self): | ||
| 68 | retval = KickstartCommand.__str__(self) | ||
| 69 | |||
| 70 | if self.location != "": | ||
| 71 | retval += "# System bootloader configuration\nbootloader" | ||
| 72 | retval += self._getArgsAsStr() + "\n" | ||
| 73 | |||
| 74 | return retval | ||
| 75 | |||
| 76 | def _getParser(self): | ||
| 77 | def driveorder_cb (option, opt_str, value, parser): | ||
| 78 | for d in value.split(','): | ||
| 79 | parser.values.ensure_value(option.dest, []).append(d) | ||
| 80 | |||
| 81 | op = KSOptionParser() | ||
| 82 | op.add_option("--append", dest="appendLine") | ||
| 83 | op.add_option("--linear", dest="linear", action="store_true", | ||
| 84 | default=True) | ||
| 85 | op.add_option("--nolinear", dest="linear", action="store_false") | ||
| 86 | op.add_option("--location", dest="location", type="choice", | ||
| 87 | default="mbr", | ||
| 88 | choices=["mbr", "partition", "none", "boot"]) | ||
| 89 | op.add_option("--lba32", dest="forceLBA", action="store_true", | ||
| 90 | default=False) | ||
| 91 | op.add_option("--password", dest="password", default="") | ||
| 92 | op.add_option("--md5pass", dest="md5pass", default="") | ||
| 93 | op.add_option("--upgrade", dest="upgrade", action="store_true", | ||
| 94 | default=False) | ||
| 95 | op.add_option("--useLilo", dest="useLilo", action="store_true", | ||
| 96 | default=False) | ||
| 97 | op.add_option("--driveorder", dest="driveorder", action="callback", | ||
| 98 | callback=driveorder_cb, nargs=1, type="string") | ||
| 99 | return op | ||
| 100 | |||
| 101 | def parse(self, args): | ||
| 102 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 103 | self._setToSelf(self.op, opts) | ||
| 104 | |||
| 105 | if self.currentCmd == "lilo": | ||
| 106 | self.useLilo = True | ||
| 107 | |||
| 108 | return self | ||
| 109 | |||
| 110 | class FC4_Bootloader(FC3_Bootloader): | ||
| 111 | removedKeywords = FC3_Bootloader.removedKeywords + ["linear", "useLilo"] | ||
| 112 | removedAttrs = FC3_Bootloader.removedAttrs + ["linear", "useLilo"] | ||
| 113 | |||
| 114 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 115 | FC3_Bootloader.__init__(self, writePriority, *args, **kwargs) | ||
| 116 | |||
| 117 | def _getArgsAsStr(self): | ||
| 118 | retval = "" | ||
| 119 | if self.appendLine != "": | ||
| 120 | retval += " --append=\"%s\"" % self.appendLine | ||
| 121 | if self.location: | ||
| 122 | retval += " --location=%s" % self.location | ||
| 123 | if hasattr(self, "forceLBA") and self.forceLBA: | ||
| 124 | retval += " --lba32" | ||
| 125 | if self.password != "": | ||
| 126 | retval += " --password=\"%s\"" % self.password | ||
| 127 | if self.md5pass != "": | ||
| 128 | retval += " --md5pass=\"%s\"" % self.md5pass | ||
| 129 | if self.upgrade: | ||
| 130 | retval += " --upgrade" | ||
| 131 | if len(self.driveorder) > 0: | ||
| 132 | retval += " --driveorder=\"%s\"" % ",".join(self.driveorder) | ||
| 133 | return retval | ||
| 134 | |||
| 135 | def _getParser(self): | ||
| 136 | op = FC3_Bootloader._getParser(self) | ||
| 137 | op.remove_option("--linear") | ||
| 138 | op.remove_option("--nolinear") | ||
| 139 | op.remove_option("--useLilo") | ||
| 140 | return op | ||
| 141 | |||
| 142 | def parse(self, args): | ||
| 143 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 144 | self._setToSelf(self.op, opts) | ||
| 145 | return self | ||
| 146 | |||
| 147 | class F8_Bootloader(FC4_Bootloader): | ||
| 148 | removedKeywords = FC4_Bootloader.removedKeywords | ||
| 149 | removedAttrs = FC4_Bootloader.removedAttrs | ||
| 150 | |||
| 151 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 152 | FC4_Bootloader.__init__(self, writePriority, *args, **kwargs) | ||
| 153 | |||
| 154 | self.timeout = kwargs.get("timeout", None) | ||
| 155 | self.default = kwargs.get("default", "") | ||
| 156 | |||
| 157 | def _getArgsAsStr(self): | ||
| 158 | ret = FC4_Bootloader._getArgsAsStr(self) | ||
| 159 | |||
| 160 | if self.timeout is not None: | ||
| 161 | ret += " --timeout=%d" %(self.timeout,) | ||
| 162 | if self.default: | ||
| 163 | ret += " --default=%s" %(self.default,) | ||
| 164 | |||
| 165 | return ret | ||
| 166 | |||
| 167 | def _getParser(self): | ||
| 168 | op = FC4_Bootloader._getParser(self) | ||
| 169 | op.add_option("--timeout", dest="timeout", type="int") | ||
| 170 | op.add_option("--default", dest="default") | ||
| 171 | return op | ||
| 172 | |||
| 173 | class F12_Bootloader(F8_Bootloader): | ||
| 174 | removedKeywords = F8_Bootloader.removedKeywords | ||
| 175 | removedAttrs = F8_Bootloader.removedAttrs | ||
| 176 | |||
| 177 | def _getParser(self): | ||
| 178 | op = F8_Bootloader._getParser(self) | ||
| 179 | op.add_option("--lba32", dest="forceLBA", deprecated=1, action="store_true") | ||
| 180 | return op | ||
| 181 | |||
| 182 | class F14_Bootloader(F12_Bootloader): | ||
| 183 | removedKeywords = F12_Bootloader.removedKeywords + ["forceLBA"] | ||
| 184 | removedAttrs = F12_Bootloader.removedKeywords + ["forceLBA"] | ||
| 185 | |||
| 186 | def _getParser(self): | ||
| 187 | op = F12_Bootloader._getParser(self) | ||
| 188 | op.remove_option("--lba32") | ||
| 189 | return op | ||
| 190 | |||
| 191 | class F15_Bootloader(F14_Bootloader): | ||
| 192 | removedKeywords = F14_Bootloader.removedKeywords | ||
| 193 | removedAttrs = F14_Bootloader.removedAttrs | ||
| 194 | |||
| 195 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 196 | F14_Bootloader.__init__(self, writePriority, *args, **kwargs) | ||
| 197 | |||
| 198 | self.isCrypted = kwargs.get("isCrypted", False) | ||
| 199 | |||
| 200 | def _getArgsAsStr(self): | ||
| 201 | ret = F14_Bootloader._getArgsAsStr(self) | ||
| 202 | |||
| 203 | if self.isCrypted: | ||
| 204 | ret += " --iscrypted" | ||
| 205 | |||
| 206 | return ret | ||
| 207 | |||
| 208 | def _getParser(self): | ||
| 209 | def password_cb(option, opt_str, value, parser): | ||
| 210 | parser.values.isCrypted = True | ||
| 211 | parser.values.password = value | ||
| 212 | |||
| 213 | op = F14_Bootloader._getParser(self) | ||
| 214 | op.add_option("--iscrypted", dest="isCrypted", action="store_true", default=False) | ||
| 215 | op.add_option("--md5pass", action="callback", callback=password_cb, nargs=1, type="string") | ||
| 216 | return op | ||
| 217 | |||
| 218 | class RHEL5_Bootloader(FC4_Bootloader): | ||
| 219 | removedKeywords = FC4_Bootloader.removedKeywords | ||
| 220 | removedAttrs = FC4_Bootloader.removedAttrs | ||
| 221 | |||
| 222 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 223 | FC4_Bootloader.__init__(self, writePriority, *args, **kwargs) | ||
| 224 | |||
| 225 | self.hvArgs = kwargs.get("hvArgs", "") | ||
| 226 | |||
| 227 | def _getArgsAsStr(self): | ||
| 228 | ret = FC4_Bootloader._getArgsAsStr(self) | ||
| 229 | |||
| 230 | if self.hvArgs: | ||
| 231 | ret += " --hvargs=\"%s\"" %(self.hvArgs,) | ||
| 232 | |||
| 233 | return ret | ||
| 234 | |||
| 235 | def _getParser(self): | ||
| 236 | op = FC4_Bootloader._getParser(self) | ||
| 237 | op.add_option("--hvargs", dest="hvArgs", type="string") | ||
| 238 | return op | ||
| 239 | |||
| 240 | class RHEL6_Bootloader(F12_Bootloader): | ||
| 241 | removedKeywords = F12_Bootloader.removedKeywords | ||
| 242 | removedAttrs = F12_Bootloader.removedAttrs | ||
| 243 | |||
| 244 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 245 | F12_Bootloader.__init__(self, writePriority, *args, **kwargs) | ||
| 246 | |||
| 247 | self.isCrypted = kwargs.get("isCrypted", False) | ||
| 248 | |||
| 249 | def _getArgsAsStr(self): | ||
| 250 | ret = F12_Bootloader._getArgsAsStr(self) | ||
| 251 | |||
| 252 | if self.isCrypted: | ||
| 253 | ret += " --iscrypted" | ||
| 254 | |||
| 255 | return ret | ||
| 256 | |||
| 257 | def _getParser(self): | ||
| 258 | def password_cb(option, opt_str, value, parser): | ||
| 259 | parser.values.isCrypted = True | ||
| 260 | parser.values.password = value | ||
| 261 | |||
| 262 | op = F12_Bootloader._getParser(self) | ||
| 263 | op.add_option("--iscrypted", dest="isCrypted", action="store_true", default=False) | ||
| 264 | op.add_option("--md5pass", action="callback", callback=password_cb, nargs=1, type="string") | ||
| 265 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/clearpart.py b/scripts/lib/mic/3rdparty/pykickstart/commands/clearpart.py new file mode 100644 index 0000000000..a8089fcb99 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/clearpart.py | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | class FC3_ClearPart(KickstartCommand): | ||
| 26 | removedKeywords = KickstartCommand.removedKeywords | ||
| 27 | removedAttrs = KickstartCommand.removedAttrs | ||
| 28 | |||
| 29 | def __init__(self, writePriority=120, *args, **kwargs): | ||
| 30 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 31 | self.op = self._getParser() | ||
| 32 | |||
| 33 | self.drives = kwargs.get("drives", []) | ||
| 34 | self.initAll = kwargs.get("initAll", False) | ||
| 35 | self.type = kwargs.get("type", None) | ||
| 36 | |||
| 37 | def __str__(self): | ||
| 38 | retval = KickstartCommand.__str__(self) | ||
| 39 | |||
| 40 | if self.type is None: | ||
| 41 | return retval | ||
| 42 | |||
| 43 | if self.type == CLEARPART_TYPE_NONE: | ||
| 44 | clearstr = "--none" | ||
| 45 | elif self.type == CLEARPART_TYPE_LINUX: | ||
| 46 | clearstr = "--linux" | ||
| 47 | elif self.type == CLEARPART_TYPE_ALL: | ||
| 48 | clearstr = "--all" | ||
| 49 | else: | ||
| 50 | clearstr = "" | ||
| 51 | |||
| 52 | if self.initAll: | ||
| 53 | initstr = "--initlabel" | ||
| 54 | else: | ||
| 55 | initstr = "" | ||
| 56 | |||
| 57 | if len(self.drives) > 0: | ||
| 58 | drivestr = "--drives=" + ",".join(self.drives) | ||
| 59 | else: | ||
| 60 | drivestr = "" | ||
| 61 | |||
| 62 | retval += "# Partition clearing information\nclearpart %s %s %s\n" % (clearstr, initstr, drivestr) | ||
| 63 | return retval | ||
| 64 | |||
| 65 | def _getParser(self): | ||
| 66 | def drive_cb (option, opt_str, value, parser): | ||
| 67 | for d in value.split(','): | ||
| 68 | parser.values.ensure_value(option.dest, []).append(d) | ||
| 69 | |||
| 70 | op = KSOptionParser() | ||
| 71 | op.add_option("--all", dest="type", action="store_const", | ||
| 72 | const=CLEARPART_TYPE_ALL) | ||
| 73 | op.add_option("--drives", dest="drives", action="callback", | ||
| 74 | callback=drive_cb, nargs=1, type="string") | ||
| 75 | op.add_option("--initlabel", dest="initAll", action="store_true", | ||
| 76 | default=False) | ||
| 77 | op.add_option("--linux", dest="type", action="store_const", | ||
| 78 | const=CLEARPART_TYPE_LINUX) | ||
| 79 | op.add_option("--none", dest="type", action="store_const", | ||
| 80 | const=CLEARPART_TYPE_NONE) | ||
| 81 | return op | ||
| 82 | |||
| 83 | def parse(self, args): | ||
| 84 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 85 | self._setToSelf(self.op, opts) | ||
| 86 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/device.py b/scripts/lib/mic/3rdparty/pykickstart/commands/device.py new file mode 100644 index 0000000000..321410e2e2 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/device.py | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | import gettext | ||
| 24 | import warnings | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class F8_DeviceData(BaseData): | ||
| 28 | removedKeywords = BaseData.removedKeywords | ||
| 29 | removedAttrs = BaseData.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, *args, **kwargs): | ||
| 32 | BaseData.__init__(self, *args, **kwargs) | ||
| 33 | self.moduleName = kwargs.get("moduleName", "") | ||
| 34 | self.moduleOpts = kwargs.get("moduleOpts", "") | ||
| 35 | |||
| 36 | def __eq__(self, y): | ||
| 37 | return self.moduleName == y.moduleName | ||
| 38 | |||
| 39 | def __str__(self): | ||
| 40 | retval = BaseData.__str__(self) | ||
| 41 | |||
| 42 | if self.moduleName != "": | ||
| 43 | retval += "device %s" % self.moduleName | ||
| 44 | |||
| 45 | if self.moduleOpts != "": | ||
| 46 | retval += " --opts=\"%s\"" % self.moduleOpts | ||
| 47 | |||
| 48 | return retval + "\n" | ||
| 49 | |||
| 50 | class FC3_Device(KickstartCommand): | ||
| 51 | removedKeywords = KickstartCommand.removedKeywords | ||
| 52 | removedAttrs = KickstartCommand.removedAttrs | ||
| 53 | |||
| 54 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 55 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 56 | self.op = self._getParser() | ||
| 57 | |||
| 58 | self.type = kwargs.get("type", "") | ||
| 59 | self.moduleName = kwargs.get("moduleName", "") | ||
| 60 | self.moduleOpts = kwargs.get("moduleOpts", "") | ||
| 61 | |||
| 62 | def __eq__(self, y): | ||
| 63 | return self.moduleName == y.moduleName | ||
| 64 | |||
| 65 | def __str__(self): | ||
| 66 | retval = KickstartCommand.__str__(self) | ||
| 67 | |||
| 68 | if self.moduleName != "": | ||
| 69 | retval += "device %s %s" % (self.type, self.moduleName) | ||
| 70 | |||
| 71 | if self.moduleOpts != "": | ||
| 72 | retval += " --opts=\"%s\"" % self.moduleOpts | ||
| 73 | |||
| 74 | return retval + "\n" | ||
| 75 | |||
| 76 | def _getParser(self): | ||
| 77 | op = KSOptionParser() | ||
| 78 | op.add_option("--opts", dest="moduleOpts", default="") | ||
| 79 | return op | ||
| 80 | |||
| 81 | def parse(self, args): | ||
| 82 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 83 | |||
| 84 | if len(extra) != 2: | ||
| 85 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("device command requires two arguments: module type and name")) | ||
| 86 | |||
| 87 | self.moduleOpts = opts.moduleOpts | ||
| 88 | self.type = extra[0] | ||
| 89 | self.moduleName = extra[1] | ||
| 90 | return self | ||
| 91 | |||
| 92 | class F8_Device(FC3_Device): | ||
| 93 | removedKeywords = FC3_Device.removedKeywords | ||
| 94 | removedAttrs = FC3_Device.removedAttrs | ||
| 95 | |||
| 96 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 97 | FC3_Device.__init__(self, writePriority, *args, **kwargs) | ||
| 98 | self.deviceList = kwargs.get("deviceList", []) | ||
| 99 | |||
| 100 | def __str__(self): | ||
| 101 | retval = "" | ||
| 102 | for device in self.deviceList: | ||
| 103 | retval += device.__str__() | ||
| 104 | |||
| 105 | return retval | ||
| 106 | |||
| 107 | def parse(self, args): | ||
| 108 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 109 | |||
| 110 | if len(extra) != 1: | ||
| 111 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("%s command requires a single argument: %s") % ("device", "module name")) | ||
| 112 | |||
| 113 | dd = F8_DeviceData() | ||
| 114 | self._setToObj(self.op, opts, dd) | ||
| 115 | dd.lineno = self.lineno | ||
| 116 | dd.moduleName = extra[0] | ||
| 117 | |||
| 118 | # Check for duplicates in the data list. | ||
| 119 | if dd in self.dataList(): | ||
| 120 | warnings.warn(_("A module with the name %s has already been defined.") % dd.moduleName) | ||
| 121 | |||
| 122 | return dd | ||
| 123 | |||
| 124 | def dataList(self): | ||
| 125 | return self.deviceList | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/deviceprobe.py b/scripts/lib/mic/3rdparty/pykickstart/commands/deviceprobe.py new file mode 100644 index 0000000000..9f462fdff7 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/deviceprobe.py | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | |||
| 22 | class FC3_DeviceProbe(KickstartCommand): | ||
| 23 | removedKeywords = KickstartCommand.removedKeywords | ||
| 24 | removedAttrs = KickstartCommand.removedAttrs | ||
| 25 | |||
| 26 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 27 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 28 | self.deviceprobe = kwargs.get("deviceprobe", "") | ||
| 29 | |||
| 30 | def __str__(self): | ||
| 31 | retval = KickstartCommand.__str__(self) | ||
| 32 | |||
| 33 | if self.deviceprobe != "": | ||
| 34 | retval += "deviceprobe %s\n" % self.deviceprobe | ||
| 35 | |||
| 36 | return retval | ||
| 37 | |||
| 38 | def parse(self, args): | ||
| 39 | self.deviceprobe = " ".join(args) | ||
| 40 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/displaymode.py b/scripts/lib/mic/3rdparty/pykickstart/commands/displaymode.py new file mode 100644 index 0000000000..6a12d58ec2 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/displaymode.py | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_DisplayMode(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | self.displayMode = kwargs.get("displayMode", None) | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if self.displayMode is None: | ||
| 40 | return retval | ||
| 41 | |||
| 42 | if self.displayMode == DISPLAY_MODE_CMDLINE: | ||
| 43 | retval += "cmdline\n" | ||
| 44 | elif self.displayMode == DISPLAY_MODE_GRAPHICAL: | ||
| 45 | retval += "# Use graphical install\ngraphical\n" | ||
| 46 | elif self.displayMode == DISPLAY_MODE_TEXT: | ||
| 47 | retval += "# Use text mode install\ntext\n" | ||
| 48 | |||
| 49 | return retval | ||
| 50 | |||
| 51 | def _getParser(self): | ||
| 52 | op = KSOptionParser() | ||
| 53 | return op | ||
| 54 | |||
| 55 | def parse(self, args): | ||
| 56 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 57 | |||
| 58 | if len(extra) > 0: | ||
| 59 | raise KickstartParseError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % self.currentCmd) | ||
| 60 | |||
| 61 | if self.currentCmd == "cmdline": | ||
| 62 | self.displayMode = DISPLAY_MODE_CMDLINE | ||
| 63 | elif self.currentCmd == "graphical": | ||
| 64 | self.displayMode = DISPLAY_MODE_GRAPHICAL | ||
| 65 | elif self.currentCmd == "text": | ||
| 66 | self.displayMode = DISPLAY_MODE_TEXT | ||
| 67 | |||
| 68 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/dmraid.py b/scripts/lib/mic/3rdparty/pykickstart/commands/dmraid.py new file mode 100644 index 0000000000..993575a041 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/dmraid.py | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # Peter Jones <pjones@redhat.com> | ||
| 4 | # | ||
| 5 | # Copyright 2006, 2007 Red Hat, Inc. | ||
| 6 | # | ||
| 7 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 8 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 9 | # General Public License v.2. This program is distributed in the hope that it | ||
| 10 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 11 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 12 | # See the GNU General Public License for more details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License along with | ||
| 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 17 | # trademarks that are incorporated in the source code or documentation are not | ||
| 18 | # subject to the GNU General Public License and may only be used or replicated | ||
| 19 | # with the express permission of Red Hat, Inc. | ||
| 20 | # | ||
| 21 | from pykickstart.base import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | import warnings | ||
| 27 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 28 | |||
| 29 | class FC6_DmRaidData(BaseData): | ||
| 30 | removedKeywords = BaseData.removedKeywords | ||
| 31 | removedAttrs = BaseData.removedAttrs | ||
| 32 | |||
| 33 | def __init__(self, *args, **kwargs): | ||
| 34 | BaseData.__init__(self, *args, **kwargs) | ||
| 35 | |||
| 36 | self.name = kwargs.get("name", "") | ||
| 37 | self.devices = kwargs.get("devices", []) | ||
| 38 | self.dmset = kwargs.get("dmset", None) | ||
| 39 | |||
| 40 | def __eq__(self, y): | ||
| 41 | return self.name == y.name and self.devices == y.devices | ||
| 42 | |||
| 43 | def __str__(self): | ||
| 44 | retval = BaseData.__str__(self) | ||
| 45 | retval += "dmraid --name=%s" % self.name | ||
| 46 | |||
| 47 | for dev in self.devices: | ||
| 48 | retval += " --dev=\"%s\"" % dev | ||
| 49 | |||
| 50 | return retval + "\n" | ||
| 51 | |||
| 52 | class FC6_DmRaid(KickstartCommand): | ||
| 53 | removedKeywords = KickstartCommand.removedKeywords | ||
| 54 | removedAttrs = KickstartCommand.removedAttrs | ||
| 55 | |||
| 56 | def __init__(self, writePriority=60, *args, **kwargs): | ||
| 57 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 58 | self.op = self._getParser() | ||
| 59 | |||
| 60 | self.dmraids = kwargs.get("dmraids", []) | ||
| 61 | |||
| 62 | def __str__(self): | ||
| 63 | retval = "" | ||
| 64 | for dm in self.dmraids: | ||
| 65 | retval += dm.__str__() | ||
| 66 | |||
| 67 | return retval | ||
| 68 | |||
| 69 | def _getParser(self): | ||
| 70 | op = KSOptionParser() | ||
| 71 | op.add_option("--name", dest="name", action="store", type="string", | ||
| 72 | required=1) | ||
| 73 | op.add_option("--dev", dest="devices", action="append", type="string", | ||
| 74 | required=1) | ||
| 75 | return op | ||
| 76 | |||
| 77 | def parse(self, args): | ||
| 78 | dm = FC6_DmRaidData() | ||
| 79 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 80 | dm.name = dm.name.split('/')[-1] | ||
| 81 | self._setToObj(self.op, opts, dm) | ||
| 82 | dm.lineno = self.lineno | ||
| 83 | |||
| 84 | # Check for duplicates in the data list. | ||
| 85 | if dm in self.dataList(): | ||
| 86 | warnings.warn(_("A DM RAID device with the name %s and devices %s has already been defined.") % (dm.name, dm.devices)) | ||
| 87 | |||
| 88 | return dm | ||
| 89 | |||
| 90 | def dataList(self): | ||
| 91 | return self.dmraids | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/driverdisk.py b/scripts/lib/mic/3rdparty/pykickstart/commands/driverdisk.py new file mode 100644 index 0000000000..82a58c0e28 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/driverdisk.py | |||
| @@ -0,0 +1,184 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | import gettext | ||
| 24 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 25 | |||
| 26 | class FC3_DriverDiskData(BaseData): | ||
| 27 | removedKeywords = BaseData.removedKeywords | ||
| 28 | removedAttrs = BaseData.removedAttrs | ||
| 29 | |||
| 30 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 31 | BaseData.__init__(self, *args, **kwargs) | ||
| 32 | |||
| 33 | self.partition = kwargs.get("partition", "") | ||
| 34 | self.source = kwargs.get("source", "") | ||
| 35 | self.type = kwargs.get("type", "") | ||
| 36 | |||
| 37 | def _getArgsAsStr(self): | ||
| 38 | retval = "" | ||
| 39 | |||
| 40 | if self.partition: | ||
| 41 | retval += "%s" % self.partition | ||
| 42 | |||
| 43 | if hasattr(self, "type") and self.type: | ||
| 44 | retval += " --type=%s" % self.type | ||
| 45 | elif self.source: | ||
| 46 | retval += "--source=%s" % self.source | ||
| 47 | return retval | ||
| 48 | |||
| 49 | def __str__(self): | ||
| 50 | retval = BaseData.__str__(self) | ||
| 51 | retval += "driverdisk %s\n" % self._getArgsAsStr() | ||
| 52 | return retval | ||
| 53 | |||
| 54 | class FC4_DriverDiskData(FC3_DriverDiskData): | ||
| 55 | removedKeywords = FC3_DriverDiskData.removedKeywords | ||
| 56 | removedAttrs = FC3_DriverDiskData.removedAttrs | ||
| 57 | |||
| 58 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 59 | FC3_DriverDiskData.__init__(self, *args, **kwargs) | ||
| 60 | self.deleteRemovedAttrs() | ||
| 61 | |||
| 62 | self.biospart = kwargs.get("biospart", "") | ||
| 63 | |||
| 64 | def _getArgsAsStr(self): | ||
| 65 | retval = "" | ||
| 66 | |||
| 67 | if self.partition: | ||
| 68 | retval += "%s" % self.partition | ||
| 69 | |||
| 70 | if hasattr(self, "type") and self.type: | ||
| 71 | retval += " --type=%s" % self.type | ||
| 72 | elif self.source: | ||
| 73 | retval += "--source=%s" % self.source | ||
| 74 | elif self.biospart: | ||
| 75 | retval += "--biospart=%s" % self.biospart | ||
| 76 | |||
| 77 | return retval | ||
| 78 | |||
| 79 | class F12_DriverDiskData(FC4_DriverDiskData): | ||
| 80 | removedKeywords = FC4_DriverDiskData.removedKeywords + ["type"] | ||
| 81 | removedAttrs = FC4_DriverDiskData.removedAttrs + ["type"] | ||
| 82 | |||
| 83 | def __init__(self, *args, **kwargs): | ||
| 84 | FC4_DriverDiskData.__init__(self, *args, **kwargs) | ||
| 85 | self.deleteRemovedAttrs() | ||
| 86 | |||
| 87 | F14_DriverDiskData = F12_DriverDiskData | ||
| 88 | |||
| 89 | class FC3_DriverDisk(KickstartCommand): | ||
| 90 | removedKeywords = KickstartCommand.removedKeywords | ||
| 91 | removedAttrs = KickstartCommand.removedAttrs | ||
| 92 | |||
| 93 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 94 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 95 | self.op = self._getParser() | ||
| 96 | |||
| 97 | self.driverdiskList = kwargs.get("driverdiskList", []) | ||
| 98 | |||
| 99 | def __str__(self): | ||
| 100 | retval = "" | ||
| 101 | for dd in self.driverdiskList: | ||
| 102 | retval += dd.__str__() | ||
| 103 | |||
| 104 | return retval | ||
| 105 | |||
| 106 | def _getParser(self): | ||
| 107 | op = KSOptionParser() | ||
| 108 | op.add_option("--source") | ||
| 109 | op.add_option("--type") | ||
| 110 | return op | ||
| 111 | |||
| 112 | def parse(self, args): | ||
| 113 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 114 | |||
| 115 | if len(extra) > 1: | ||
| 116 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Only one partition may be specified for driverdisk command.")) | ||
| 117 | |||
| 118 | if len(extra) == 1 and opts.source: | ||
| 119 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Only one of --source and partition may be specified for driverdisk command.")) | ||
| 120 | |||
| 121 | if not extra and not opts.source: | ||
| 122 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("One of --source or partition must be specified for driverdisk command.")) | ||
| 123 | |||
| 124 | ddd = self.handler.DriverDiskData() | ||
| 125 | self._setToObj(self.op, opts, ddd) | ||
| 126 | ddd.lineno = self.lineno | ||
| 127 | if len(extra) == 1: | ||
| 128 | ddd.partition = extra[0] | ||
| 129 | |||
| 130 | return ddd | ||
| 131 | |||
| 132 | def dataList(self): | ||
| 133 | return self.driverdiskList | ||
| 134 | |||
| 135 | class FC4_DriverDisk(FC3_DriverDisk): | ||
| 136 | removedKeywords = FC3_DriverDisk.removedKeywords | ||
| 137 | removedAttrs = FC3_DriverDisk.removedKeywords | ||
| 138 | |||
| 139 | def _getParser(self): | ||
| 140 | op = FC3_DriverDisk._getParser(self) | ||
| 141 | op.add_option("--biospart") | ||
| 142 | return op | ||
| 143 | |||
| 144 | def parse(self, args): | ||
| 145 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 146 | |||
| 147 | if len(extra) > 1: | ||
| 148 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Only one partition may be specified for driverdisk command.")) | ||
| 149 | |||
| 150 | if len(extra) == 1 and opts.source: | ||
| 151 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Only one of --source and partition may be specified for driverdisk command.")) | ||
| 152 | elif len(extra) == 1 and opts.biospart: | ||
| 153 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Only one of --biospart and partition may be specified for driverdisk command.")) | ||
| 154 | elif opts.source and opts.biospart: | ||
| 155 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Only one of --biospart and --source may be specified for driverdisk command.")) | ||
| 156 | |||
| 157 | if not extra and not opts.source and not opts.biospart: | ||
| 158 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("One of --source, --biospart, or partition must be specified for driverdisk command.")) | ||
| 159 | |||
| 160 | ddd = self.handler.DriverDiskData() | ||
| 161 | self._setToObj(self.op, opts, ddd) | ||
| 162 | ddd.lineno = self.lineno | ||
| 163 | if len(extra) == 1: | ||
| 164 | ddd.partition = extra[0] | ||
| 165 | |||
| 166 | return ddd | ||
| 167 | |||
| 168 | class F12_DriverDisk(FC4_DriverDisk): | ||
| 169 | removedKeywords = FC4_DriverDisk.removedKeywords | ||
| 170 | removedAttrs = FC4_DriverDisk.removedKeywords | ||
| 171 | |||
| 172 | def _getParser(self): | ||
| 173 | op = FC4_DriverDisk._getParser(self) | ||
| 174 | op.add_option("--type", deprecated=1) | ||
| 175 | return op | ||
| 176 | |||
| 177 | class F14_DriverDisk(F12_DriverDisk): | ||
| 178 | removedKeywords = F12_DriverDisk.removedKeywords | ||
| 179 | removedAttrs = F12_DriverDisk.removedKeywords | ||
| 180 | |||
| 181 | def _getParser(self): | ||
| 182 | op = F12_DriverDisk._getParser(self) | ||
| 183 | op.remove_option("--type") | ||
| 184 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/fcoe.py b/scripts/lib/mic/3rdparty/pykickstart/commands/fcoe.py new file mode 100644 index 0000000000..33208499b3 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/fcoe.py | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | # | ||
| 2 | # Hans de Goede <hdegoede@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2009 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | import gettext | ||
| 24 | import warnings | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class F12_FcoeData(BaseData): | ||
| 28 | removedKeywords = BaseData.removedKeywords | ||
| 29 | removedAttrs = BaseData.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, *args, **kwargs): | ||
| 32 | BaseData.__init__(self, *args, **kwargs) | ||
| 33 | self.nic = kwargs.get("nic", None) | ||
| 34 | |||
| 35 | def __eq__(self, y): | ||
| 36 | return self.nic == y.nic | ||
| 37 | |||
| 38 | def _getArgsAsStr(self): | ||
| 39 | retval = "" | ||
| 40 | |||
| 41 | if self.nic: | ||
| 42 | retval += " --nic=%s" % self.nic | ||
| 43 | |||
| 44 | return retval | ||
| 45 | |||
| 46 | def __str__(self): | ||
| 47 | retval = BaseData.__str__(self) | ||
| 48 | retval += "fcoe%s\n" % self._getArgsAsStr() | ||
| 49 | return retval | ||
| 50 | |||
| 51 | class F13_FcoeData(F12_FcoeData): | ||
| 52 | removedKeywords = F12_FcoeData.removedKeywords | ||
| 53 | removedAttrs = F12_FcoeData.removedAttrs | ||
| 54 | |||
| 55 | def __init__(self, *args, **kwargs): | ||
| 56 | F12_FcoeData.__init__(self, *args, **kwargs) | ||
| 57 | self.dcb = kwargs.get("dcb", False) | ||
| 58 | |||
| 59 | def _getArgsAsStr(self): | ||
| 60 | retval = F12_FcoeData._getArgsAsStr(self) | ||
| 61 | |||
| 62 | if self.dcb: | ||
| 63 | retval += " --dcb" | ||
| 64 | |||
| 65 | return retval | ||
| 66 | |||
| 67 | class F12_Fcoe(KickstartCommand): | ||
| 68 | removedKeywords = KickstartCommand.removedKeywords | ||
| 69 | removedAttrs = KickstartCommand.removedAttrs | ||
| 70 | |||
| 71 | def __init__(self, writePriority=71, *args, **kwargs): | ||
| 72 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 73 | self.op = self._getParser() | ||
| 74 | self.fcoe = kwargs.get("fcoe", []) | ||
| 75 | |||
| 76 | def __str__(self): | ||
| 77 | retval = "" | ||
| 78 | for fcoe in self.fcoe: | ||
| 79 | retval += fcoe.__str__() | ||
| 80 | |||
| 81 | return retval | ||
| 82 | |||
| 83 | def _getParser(self): | ||
| 84 | op = KSOptionParser() | ||
| 85 | op.add_option("--nic", dest="nic", required=1) | ||
| 86 | return op | ||
| 87 | |||
| 88 | def parse(self, args): | ||
| 89 | zd = self.handler.FcoeData() | ||
| 90 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 91 | if len(extra) > 0: | ||
| 92 | mapping = {"command": "fcoe", "options": extra} | ||
| 93 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping) | ||
| 94 | |||
| 95 | self._setToObj(self.op, opts, zd) | ||
| 96 | zd.lineno = self.lineno | ||
| 97 | |||
| 98 | # Check for duplicates in the data list. | ||
| 99 | if zd in self.dataList(): | ||
| 100 | warnings.warn(_("A FCOE device with the name %s has already been defined.") % zd.nic) | ||
| 101 | |||
| 102 | return zd | ||
| 103 | |||
| 104 | def dataList(self): | ||
| 105 | return self.fcoe | ||
| 106 | |||
| 107 | class F13_Fcoe(F12_Fcoe): | ||
| 108 | removedKeywords = F12_Fcoe.removedKeywords | ||
| 109 | removedAttrs = F12_Fcoe.removedAttrs | ||
| 110 | |||
| 111 | def _getParser(self): | ||
| 112 | op = F12_Fcoe._getParser(self) | ||
| 113 | op.add_option("--dcb", dest="dcb", action="store_true", default=False) | ||
| 114 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/firewall.py b/scripts/lib/mic/3rdparty/pykickstart/commands/firewall.py new file mode 100644 index 0000000000..24a01bd610 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/firewall.py | |||
| @@ -0,0 +1,193 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_Firewall(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.enabled = kwargs.get("enabled", None) | ||
| 36 | self.ports = kwargs.get("ports", []) | ||
| 37 | self.trusts = kwargs.get("trusts", []) | ||
| 38 | |||
| 39 | def __str__(self): | ||
| 40 | extra = [] | ||
| 41 | filteredPorts = [] | ||
| 42 | |||
| 43 | retval = KickstartCommand.__str__(self) | ||
| 44 | |||
| 45 | if self.enabled is None: | ||
| 46 | return retval | ||
| 47 | |||
| 48 | if self.enabled: | ||
| 49 | # It's possible we have words in the ports list instead of | ||
| 50 | # port:proto (s-c-kickstart may do this). So, filter those | ||
| 51 | # out into their own list leaving what we expect. | ||
| 52 | for port in self.ports: | ||
| 53 | if port == "ssh": | ||
| 54 | extra.append(" --ssh") | ||
| 55 | elif port == "telnet": | ||
| 56 | extra.append(" --telnet") | ||
| 57 | elif port == "smtp": | ||
| 58 | extra.append(" --smtp") | ||
| 59 | elif port == "http": | ||
| 60 | extra.append(" --http") | ||
| 61 | elif port == "ftp": | ||
| 62 | extra.append(" --ftp") | ||
| 63 | else: | ||
| 64 | filteredPorts.append(port) | ||
| 65 | |||
| 66 | # All the port:proto strings go into a comma-separated list. | ||
| 67 | portstr = ",".join(filteredPorts) | ||
| 68 | if len(portstr) > 0: | ||
| 69 | portstr = " --port=" + portstr | ||
| 70 | else: | ||
| 71 | portstr = "" | ||
| 72 | |||
| 73 | extrastr = "".join(extra) | ||
| 74 | truststr = ",".join(self.trusts) | ||
| 75 | |||
| 76 | if len(truststr) > 0: | ||
| 77 | truststr = " --trust=" + truststr | ||
| 78 | |||
| 79 | # The output port list consists only of port:proto for | ||
| 80 | # everything that we don't recognize, and special options for | ||
| 81 | # those that we do. | ||
| 82 | retval += "# Firewall configuration\nfirewall --enabled%s%s%s\n" % (extrastr, portstr, truststr) | ||
| 83 | else: | ||
| 84 | retval += "# Firewall configuration\nfirewall --disabled\n" | ||
| 85 | |||
| 86 | return retval | ||
| 87 | |||
| 88 | def _getParser(self): | ||
| 89 | def firewall_port_cb (option, opt_str, value, parser): | ||
| 90 | for p in value.split(","): | ||
| 91 | p = p.strip() | ||
| 92 | if p.find(":") == -1: | ||
| 93 | p = "%s:tcp" % p | ||
| 94 | parser.values.ensure_value(option.dest, []).append(p) | ||
| 95 | |||
| 96 | op = KSOptionParser(mapping={"ssh":["22:tcp"], "telnet":["23:tcp"], | ||
| 97 | "smtp":["25:tcp"], "http":["80:tcp", "443:tcp"], | ||
| 98 | "ftp":["21:tcp"]}) | ||
| 99 | |||
| 100 | op.add_option("--disable", "--disabled", dest="enabled", | ||
| 101 | action="store_false") | ||
| 102 | op.add_option("--enable", "--enabled", dest="enabled", | ||
| 103 | action="store_true", default=True) | ||
| 104 | op.add_option("--ftp", "--http", "--smtp", "--ssh", "--telnet", | ||
| 105 | dest="ports", action="map_extend") | ||
| 106 | op.add_option("--high", deprecated=1) | ||
| 107 | op.add_option("--medium", deprecated=1) | ||
| 108 | op.add_option("--port", dest="ports", action="callback", | ||
| 109 | callback=firewall_port_cb, nargs=1, type="string") | ||
| 110 | op.add_option("--trust", dest="trusts", action="append") | ||
| 111 | return op | ||
| 112 | |||
| 113 | def parse(self, args): | ||
| 114 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 115 | |||
| 116 | if len(extra) != 0: | ||
| 117 | mapping = {"command": "firewall", "options": extra} | ||
| 118 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping) | ||
| 119 | |||
| 120 | self._setToSelf(self.op, opts) | ||
| 121 | return self | ||
| 122 | |||
| 123 | class F9_Firewall(FC3_Firewall): | ||
| 124 | removedKeywords = FC3_Firewall.removedKeywords | ||
| 125 | removedAttrs = FC3_Firewall.removedAttrs | ||
| 126 | |||
| 127 | def _getParser(self): | ||
| 128 | op = FC3_Firewall._getParser(self) | ||
| 129 | op.remove_option("--high") | ||
| 130 | op.remove_option("--medium") | ||
| 131 | return op | ||
| 132 | |||
| 133 | class F10_Firewall(F9_Firewall): | ||
| 134 | removedKeywords = F9_Firewall.removedKeywords | ||
| 135 | removedAttrs = F9_Firewall.removedAttrs | ||
| 136 | |||
| 137 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 138 | F9_Firewall.__init__(self, writePriority, *args, **kwargs) | ||
| 139 | self.services = kwargs.get("services", []) | ||
| 140 | |||
| 141 | def __str__(self): | ||
| 142 | if self.enabled is None: | ||
| 143 | return "" | ||
| 144 | |||
| 145 | retval = F9_Firewall.__str__(self) | ||
| 146 | if self.enabled: | ||
| 147 | retval = retval.strip() | ||
| 148 | |||
| 149 | svcstr = ",".join(self.services) | ||
| 150 | if len(svcstr) > 0: | ||
| 151 | svcstr = " --service=" + svcstr | ||
| 152 | else: | ||
| 153 | svcstr = "" | ||
| 154 | |||
| 155 | return retval + "%s\n" % svcstr | ||
| 156 | else: | ||
| 157 | return retval | ||
| 158 | |||
| 159 | def _getParser(self): | ||
| 160 | def service_cb (option, opt_str, value, parser): | ||
| 161 | # python2.4 does not support action="append_const" that we were | ||
| 162 | # using for these options. Instead, we have to fake it by | ||
| 163 | # appending whatever the option string is to the service list. | ||
| 164 | if not value: | ||
| 165 | parser.values.ensure_value(option.dest, []).append(opt_str[2:]) | ||
| 166 | return | ||
| 167 | |||
| 168 | for p in value.split(","): | ||
| 169 | p = p.strip() | ||
| 170 | parser.values.ensure_value(option.dest, []).append(p) | ||
| 171 | |||
| 172 | op = F9_Firewall._getParser(self) | ||
| 173 | op.add_option("--service", dest="services", action="callback", | ||
| 174 | callback=service_cb, nargs=1, type="string") | ||
| 175 | op.add_option("--ftp", dest="services", action="callback", | ||
| 176 | callback=service_cb) | ||
| 177 | op.add_option("--http", dest="services", action="callback", | ||
| 178 | callback=service_cb) | ||
| 179 | op.add_option("--smtp", dest="services", action="callback", | ||
| 180 | callback=service_cb) | ||
| 181 | op.add_option("--ssh", dest="services", action="callback", | ||
| 182 | callback=service_cb) | ||
| 183 | op.add_option("--telnet", deprecated=1) | ||
| 184 | return op | ||
| 185 | |||
| 186 | class F14_Firewall(F10_Firewall): | ||
| 187 | removedKeywords = F10_Firewall.removedKeywords + ["telnet"] | ||
| 188 | removedAttrs = F10_Firewall.removedAttrs + ["telnet"] | ||
| 189 | |||
| 190 | def _getParser(self): | ||
| 191 | op = F10_Firewall._getParser(self) | ||
| 192 | op.remove_option("--telnet") | ||
| 193 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/firstboot.py b/scripts/lib/mic/3rdparty/pykickstart/commands/firstboot.py new file mode 100644 index 0000000000..05c0ac11c6 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/firstboot.py | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | class FC3_Firstboot(KickstartCommand): | ||
| 25 | removedKeywords = KickstartCommand.removedKeywords | ||
| 26 | removedAttrs = KickstartCommand.removedAttrs | ||
| 27 | |||
| 28 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 29 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 30 | self.op = self._getParser() | ||
| 31 | |||
| 32 | self.firstboot = kwargs.get("firstboot", None) | ||
| 33 | |||
| 34 | def __str__(self): | ||
| 35 | retval = KickstartCommand.__str__(self) | ||
| 36 | |||
| 37 | if self.firstboot is None: | ||
| 38 | return retval | ||
| 39 | |||
| 40 | if self.firstboot == FIRSTBOOT_SKIP: | ||
| 41 | retval += "firstboot --disable\n" | ||
| 42 | elif self.firstboot == FIRSTBOOT_DEFAULT: | ||
| 43 | retval += "# Run the Setup Agent on first boot\nfirstboot --enable\n" | ||
| 44 | elif self.firstboot == FIRSTBOOT_RECONFIG: | ||
| 45 | retval += "# Run the Setup Agent on first boot\nfirstboot --reconfig\n" | ||
| 46 | |||
| 47 | return retval | ||
| 48 | |||
| 49 | def _getParser(self): | ||
| 50 | op = KSOptionParser() | ||
| 51 | op.add_option("--disable", "--disabled", dest="firstboot", | ||
| 52 | action="store_const", const=FIRSTBOOT_SKIP) | ||
| 53 | op.add_option("--enable", "--enabled", dest="firstboot", | ||
| 54 | action="store_const", const=FIRSTBOOT_DEFAULT) | ||
| 55 | op.add_option("--reconfig", dest="firstboot", action="store_const", | ||
| 56 | const=FIRSTBOOT_RECONFIG) | ||
| 57 | return op | ||
| 58 | |||
| 59 | def parse(self, args): | ||
| 60 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 61 | self.firstboot = opts.firstboot | ||
| 62 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/group.py b/scripts/lib/mic/3rdparty/pykickstart/commands/group.py new file mode 100644 index 0000000000..80ba5bdca6 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/group.py | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2009 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | import warnings | ||
| 27 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 28 | |||
| 29 | class F12_GroupData(BaseData): | ||
| 30 | removedKeywords = BaseData.removedKeywords | ||
| 31 | removedAttrs = BaseData.removedAttrs | ||
| 32 | |||
| 33 | def __init__(self, *args, **kwargs): | ||
| 34 | BaseData.__init__(self, *args, **kwargs) | ||
| 35 | self.name = kwargs.get("name", "") | ||
| 36 | self.gid = kwargs.get("gid", None) | ||
| 37 | |||
| 38 | def __eq__(self, y): | ||
| 39 | return self.name == y.name | ||
| 40 | |||
| 41 | def __str__(self): | ||
| 42 | retval = BaseData.__str__(self) | ||
| 43 | retval += "group" | ||
| 44 | |||
| 45 | if self.name: | ||
| 46 | retval += " --name=%s" % self.name | ||
| 47 | if self.gid: | ||
| 48 | retval += " --gid=%s" % self.gid | ||
| 49 | |||
| 50 | return retval + "\n" | ||
| 51 | |||
| 52 | class F12_Group(KickstartCommand): | ||
| 53 | removedKeywords = KickstartCommand.removedKeywords | ||
| 54 | removedAttrs = KickstartCommand.removedAttrs | ||
| 55 | |||
| 56 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 57 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 58 | self.op = self._getParser() | ||
| 59 | |||
| 60 | self.groupList = kwargs.get("groupList", []) | ||
| 61 | |||
| 62 | def __str__(self): | ||
| 63 | retval = "" | ||
| 64 | for user in self.groupList: | ||
| 65 | retval += user.__str__() | ||
| 66 | |||
| 67 | return retval | ||
| 68 | |||
| 69 | def _getParser(self): | ||
| 70 | op = KSOptionParser() | ||
| 71 | op.add_option("--name", required=1) | ||
| 72 | op.add_option("--gid", type="int") | ||
| 73 | return op | ||
| 74 | |||
| 75 | def parse(self, args): | ||
| 76 | gd = self.handler.GroupData() | ||
| 77 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 78 | self._setToObj(self.op, opts, gd) | ||
| 79 | gd.lineno = self.lineno | ||
| 80 | |||
| 81 | # Check for duplicates in the data list. | ||
| 82 | if gd in self.dataList(): | ||
| 83 | warnings.warn(_("A group with the name %s has already been defined.") % gd.name) | ||
| 84 | |||
| 85 | return gd | ||
| 86 | |||
| 87 | def dataList(self): | ||
| 88 | return self.groupList | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/ignoredisk.py b/scripts/lib/mic/3rdparty/pykickstart/commands/ignoredisk.py new file mode 100644 index 0000000000..676d080836 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/ignoredisk.py | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2009 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | import gettext | ||
| 24 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 25 | |||
| 26 | class FC3_IgnoreDisk(KickstartCommand): | ||
| 27 | removedKeywords = KickstartCommand.removedKeywords | ||
| 28 | removedAttrs = KickstartCommand.removedAttrs | ||
| 29 | |||
| 30 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 31 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 32 | self.op = self._getParser() | ||
| 33 | |||
| 34 | self.ignoredisk = kwargs.get("ignoredisk", []) | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if len(self.ignoredisk) > 0: | ||
| 40 | retval += "ignoredisk --drives=%s\n" % ",".join(self.ignoredisk) | ||
| 41 | |||
| 42 | return retval | ||
| 43 | |||
| 44 | def _getParser(self): | ||
| 45 | def drive_cb (option, opt_str, value, parser): | ||
| 46 | for d in value.split(','): | ||
| 47 | parser.values.ensure_value(option.dest, []).append(d) | ||
| 48 | |||
| 49 | op = KSOptionParser() | ||
| 50 | op.add_option("--drives", dest="ignoredisk", action="callback", | ||
| 51 | callback=drive_cb, nargs=1, type="string", required=1) | ||
| 52 | return op | ||
| 53 | |||
| 54 | def parse(self, args): | ||
| 55 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 56 | self._setToSelf(self.op, opts) | ||
| 57 | return self | ||
| 58 | |||
| 59 | class F8_IgnoreDisk(FC3_IgnoreDisk): | ||
| 60 | removedKeywords = FC3_IgnoreDisk.removedKeywords | ||
| 61 | removedAttrs = FC3_IgnoreDisk.removedAttrs | ||
| 62 | |||
| 63 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 64 | FC3_IgnoreDisk.__init__(self, writePriority, *args, **kwargs) | ||
| 65 | |||
| 66 | self.onlyuse = kwargs.get("onlyuse", []) | ||
| 67 | |||
| 68 | def __str__(self): | ||
| 69 | retval = KickstartCommand.__str__(self) | ||
| 70 | |||
| 71 | if len(self.ignoredisk) > 0: | ||
| 72 | retval += "ignoredisk --drives=%s\n" % ",".join(self.ignoredisk) | ||
| 73 | elif len(self.onlyuse) > 0: | ||
| 74 | retval += "ignoredisk --only-use=%s\n" % ",".join(self.onlyuse) | ||
| 75 | |||
| 76 | return retval | ||
| 77 | |||
| 78 | def parse(self, args, errorCheck=True): | ||
| 79 | retval = FC3_IgnoreDisk.parse(self, args) | ||
| 80 | |||
| 81 | if errorCheck: | ||
| 82 | if (len(self.ignoredisk) == 0 and len(self.onlyuse) == 0) or (len(self.ignoredisk) > 0 and (len(self.onlyuse) > 0)): | ||
| 83 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("One of --drives or --only-use must be specified for ignoredisk command.")) | ||
| 84 | |||
| 85 | return retval | ||
| 86 | |||
| 87 | def _getParser(self): | ||
| 88 | def drive_cb (option, opt_str, value, parser): | ||
| 89 | for d in value.split(','): | ||
| 90 | parser.values.ensure_value(option.dest, []).append(d) | ||
| 91 | |||
| 92 | op = FC3_IgnoreDisk._getParser(self) | ||
| 93 | op.add_option("--drives", dest="ignoredisk", action="callback", | ||
| 94 | callback=drive_cb, nargs=1, type="string") | ||
| 95 | op.add_option("--only-use", dest="onlyuse", action="callback", | ||
| 96 | callback=drive_cb, nargs=1, type="string") | ||
| 97 | return op | ||
| 98 | |||
| 99 | class RHEL6_IgnoreDisk(F8_IgnoreDisk): | ||
| 100 | removedKeywords = F8_IgnoreDisk.removedKeywords | ||
| 101 | removedAttrs = F8_IgnoreDisk.removedAttrs | ||
| 102 | |||
| 103 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 104 | F8_IgnoreDisk.__init__(self, writePriority, *args, **kwargs) | ||
| 105 | |||
| 106 | self.interactive = kwargs.get("interactive", False) | ||
| 107 | if self.interactive: | ||
| 108 | self.ignoredisk = [] | ||
| 109 | |||
| 110 | def __str__(self): | ||
| 111 | retval = F8_IgnoreDisk.__str__(self) | ||
| 112 | |||
| 113 | if self.interactive: | ||
| 114 | retval = "ignoredisk --interactive\n" | ||
| 115 | |||
| 116 | return retval | ||
| 117 | |||
| 118 | def parse(self, args): | ||
| 119 | retval = F8_IgnoreDisk.parse(self, args, errorCheck=False) | ||
| 120 | |||
| 121 | howmany = 0 | ||
| 122 | if len(self.ignoredisk) > 0: | ||
| 123 | howmany += 1 | ||
| 124 | if len(self.onlyuse) > 0: | ||
| 125 | howmany += 1 | ||
| 126 | if self.interactive: | ||
| 127 | howmany += 1 | ||
| 128 | if howmany != 1: | ||
| 129 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("One of --drives , --only-use , or --interactive must be specified for ignoredisk command.")) | ||
| 130 | |||
| 131 | return retval | ||
| 132 | |||
| 133 | def _getParser(self): | ||
| 134 | op = F8_IgnoreDisk._getParser(self) | ||
| 135 | op.add_option("--interactive", dest="interactive", action="store_true", | ||
| 136 | default=False) | ||
| 137 | return op | ||
| 138 | |||
| 139 | F14_IgnoreDisk = RHEL6_IgnoreDisk | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/interactive.py b/scripts/lib/mic/3rdparty/pykickstart/commands/interactive.py new file mode 100644 index 0000000000..fa3dc025b1 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/interactive.py | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_Interactive(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | self.interactive = kwargs.get("interactive", False) | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if self.interactive: | ||
| 40 | retval += "# Use interactive kickstart installation method\ninteractive\n" | ||
| 41 | |||
| 42 | return retval | ||
| 43 | |||
| 44 | def _getParser(self): | ||
| 45 | op = KSOptionParser() | ||
| 46 | return op | ||
| 47 | |||
| 48 | def parse(self, args): | ||
| 49 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 50 | if len(extra) > 0: | ||
| 51 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "interactive") | ||
| 52 | |||
| 53 | self.interactive = True | ||
| 54 | return self | ||
| 55 | |||
| 56 | class F14_Interactive(DeprecatedCommand): | ||
| 57 | def __init__(self): | ||
| 58 | DeprecatedCommand.__init__(self) | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/iscsi.py b/scripts/lib/mic/3rdparty/pykickstart/commands/iscsi.py new file mode 100644 index 0000000000..da5a544e86 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/iscsi.py | |||
| @@ -0,0 +1,133 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # Peter Jones <pjones@redhat.com> | ||
| 4 | # | ||
| 5 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 6 | # | ||
| 7 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 8 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 9 | # General Public License v.2. This program is distributed in the hope that it | ||
| 10 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 11 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 12 | # See the GNU General Public License for more details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License along with | ||
| 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 17 | # trademarks that are incorporated in the source code or documentation are not | ||
| 18 | # subject to the GNU General Public License and may only be used or replicated | ||
| 19 | # with the express permission of Red Hat, Inc. | ||
| 20 | # | ||
| 21 | from pykickstart.base import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 27 | |||
| 28 | class FC6_IscsiData(BaseData): | ||
| 29 | removedKeywords = BaseData.removedKeywords | ||
| 30 | removedAttrs = BaseData.removedAttrs | ||
| 31 | |||
| 32 | def __init__(self, *args, **kwargs): | ||
| 33 | BaseData.__init__(self, *args, **kwargs) | ||
| 34 | self.ipaddr = kwargs.get("ipaddr", "") | ||
| 35 | self.port = kwargs.get("port", "3260") | ||
| 36 | self.target = kwargs.get("target", "") | ||
| 37 | self.user = kwargs.get("user", None) | ||
| 38 | self.password = kwargs.get("password", None) | ||
| 39 | |||
| 40 | def _getArgsAsStr(self): | ||
| 41 | retval = "" | ||
| 42 | |||
| 43 | if self.target != "": | ||
| 44 | retval += " --target=%s" % self.target | ||
| 45 | if self.ipaddr != "": | ||
| 46 | retval += " --ipaddr=%s" % self.ipaddr | ||
| 47 | if self.port != "3260": | ||
| 48 | retval += " --port=%s" % self.port | ||
| 49 | if self.user is not None: | ||
| 50 | retval += " --user=%s" % self.user | ||
| 51 | if self.password is not None: | ||
| 52 | retval += " --password=%s" % self.password | ||
| 53 | |||
| 54 | return retval | ||
| 55 | |||
| 56 | def __str__(self): | ||
| 57 | retval = BaseData.__str__(self) | ||
| 58 | retval += "iscsi%s\n" % self._getArgsAsStr() | ||
| 59 | return retval | ||
| 60 | |||
| 61 | class F10_IscsiData(FC6_IscsiData): | ||
| 62 | removedKeywords = FC6_IscsiData.removedKeywords | ||
| 63 | removedAttrs = FC6_IscsiData.removedAttrs | ||
| 64 | |||
| 65 | def __init__(self, *args, **kwargs): | ||
| 66 | FC6_IscsiData.__init__(self, *args, **kwargs) | ||
| 67 | self.user_in = kwargs.get("user_in", None) | ||
| 68 | self.password_in = kwargs.get("password_in", None) | ||
| 69 | |||
| 70 | def _getArgsAsStr(self): | ||
| 71 | retval = FC6_IscsiData._getArgsAsStr(self) | ||
| 72 | |||
| 73 | if self.user_in is not None: | ||
| 74 | retval += " --reverse-user=%s" % self.user_in | ||
| 75 | if self.password_in is not None: | ||
| 76 | retval += " --reverse-password=%s" % self.password_in | ||
| 77 | |||
| 78 | return retval | ||
| 79 | |||
| 80 | class FC6_Iscsi(KickstartCommand): | ||
| 81 | removedKeywords = KickstartCommand.removedKeywords | ||
| 82 | removedAttrs = KickstartCommand.removedAttrs | ||
| 83 | |||
| 84 | def __init__(self, writePriority=71, *args, **kwargs): | ||
| 85 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 86 | self.op = self._getParser() | ||
| 87 | |||
| 88 | self.iscsi = kwargs.get("iscsi", []) | ||
| 89 | |||
| 90 | def __str__(self): | ||
| 91 | retval = "" | ||
| 92 | for iscsi in self.iscsi: | ||
| 93 | retval += iscsi.__str__() | ||
| 94 | |||
| 95 | return retval | ||
| 96 | |||
| 97 | def _getParser(self): | ||
| 98 | op = KSOptionParser() | ||
| 99 | op.add_option("--target", dest="target", action="store", type="string") | ||
| 100 | op.add_option("--ipaddr", dest="ipaddr", action="store", type="string", | ||
| 101 | required=1) | ||
| 102 | op.add_option("--port", dest="port", action="store", type="string") | ||
| 103 | op.add_option("--user", dest="user", action="store", type="string") | ||
| 104 | op.add_option("--password", dest="password", action="store", | ||
| 105 | type="string") | ||
| 106 | return op | ||
| 107 | |||
| 108 | def parse(self, args): | ||
| 109 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 110 | |||
| 111 | if len(extra) != 0: | ||
| 112 | mapping = {"command": "iscsi", "options": extra} | ||
| 113 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping) | ||
| 114 | |||
| 115 | dd = self.handler.IscsiData() | ||
| 116 | self._setToObj(self.op, opts, dd) | ||
| 117 | dd.lineno = self.lineno | ||
| 118 | return dd | ||
| 119 | |||
| 120 | def dataList(self): | ||
| 121 | return self.iscsi | ||
| 122 | |||
| 123 | class F10_Iscsi(FC6_Iscsi): | ||
| 124 | removedKeywords = FC6_Iscsi.removedKeywords | ||
| 125 | removedAttrs = FC6_Iscsi.removedAttrs | ||
| 126 | |||
| 127 | def _getParser(self): | ||
| 128 | op = FC6_Iscsi._getParser(self) | ||
| 129 | op.add_option("--reverse-user", dest="user_in", action="store", | ||
| 130 | type="string") | ||
| 131 | op.add_option("--reverse-password", dest="password_in", action="store", | ||
| 132 | type="string") | ||
| 133 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/iscsiname.py b/scripts/lib/mic/3rdparty/pykickstart/commands/iscsiname.py new file mode 100644 index 0000000000..a87d0637d6 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/iscsiname.py | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # Peter Jones <pjones@redhat.com> | ||
| 4 | # | ||
| 5 | # Copyright 2006, 2007 Red Hat, Inc. | ||
| 6 | # | ||
| 7 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 8 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 9 | # General Public License v.2. This program is distributed in the hope that it | ||
| 10 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 11 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 12 | # See the GNU General Public License for more details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License along with | ||
| 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 17 | # trademarks that are incorporated in the source code or documentation are not | ||
| 18 | # subject to the GNU General Public License and may only be used or replicated | ||
| 19 | # with the express permission of Red Hat, Inc. | ||
| 20 | # | ||
| 21 | from pykickstart.base import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 27 | |||
| 28 | class FC6_IscsiName(KickstartCommand): | ||
| 29 | removedKeywords = KickstartCommand.removedKeywords | ||
| 30 | removedAttrs = KickstartCommand.removedAttrs | ||
| 31 | |||
| 32 | def __init__(self, writePriority=70, *args, **kwargs): | ||
| 33 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 34 | self.op = self._getParser() | ||
| 35 | self.iscsiname = kwargs.get("iscsiname", "") | ||
| 36 | |||
| 37 | def __str__(self): | ||
| 38 | retval = KickstartCommand.__str__(self) | ||
| 39 | |||
| 40 | if self.iscsiname != "": | ||
| 41 | retval += "iscsiname %s\n" % self.iscsiname | ||
| 42 | |||
| 43 | return retval | ||
| 44 | |||
| 45 | def _getParser(self): | ||
| 46 | op = KSOptionParser() | ||
| 47 | return op | ||
| 48 | |||
| 49 | def parse(self, args): | ||
| 50 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 51 | if len(extra) != 1: | ||
| 52 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires one argument") % "iscsiname") | ||
| 53 | self.iscsiname = extra[0] | ||
| 54 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/key.py b/scripts/lib/mic/3rdparty/pykickstart/commands/key.py new file mode 100644 index 0000000000..c20c4231f6 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/key.py | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 27 | |||
| 28 | class RHEL5_Key(KickstartCommand): | ||
| 29 | removedKeywords = KickstartCommand.removedKeywords | ||
| 30 | removedAttrs = KickstartCommand.removedAttrs | ||
| 31 | |||
| 32 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 33 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 34 | self.op = self._getParser() | ||
| 35 | self.key = kwargs.get("key", "") | ||
| 36 | self.skip = kwargs.get("skip", False) | ||
| 37 | |||
| 38 | def __str__(self): | ||
| 39 | retval = KickstartCommand.__str__(self) | ||
| 40 | |||
| 41 | if self.key == KS_INSTKEY_SKIP: | ||
| 42 | retval += "key --skip\n" | ||
| 43 | elif self.key != "": | ||
| 44 | retval += "key %s\n" % self.key | ||
| 45 | |||
| 46 | return retval | ||
| 47 | |||
| 48 | def _getParser(self): | ||
| 49 | op = KSOptionParser() | ||
| 50 | op.add_option("--skip", action="store_true", default=False) | ||
| 51 | return op | ||
| 52 | |||
| 53 | def parse(self, args): | ||
| 54 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 55 | self._setToSelf(self.op, opts) | ||
| 56 | |||
| 57 | if self.skip: | ||
| 58 | self.key = KS_INSTKEY_SKIP | ||
| 59 | elif len(extra) != 1: | ||
| 60 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires one argument") % "key") | ||
| 61 | else: | ||
| 62 | self.key = extra[0] | ||
| 63 | |||
| 64 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/keyboard.py b/scripts/lib/mic/3rdparty/pykickstart/commands/keyboard.py new file mode 100644 index 0000000000..babc2acd4c --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/keyboard.py | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_Keyboard(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | self.keyboard = kwargs.get("keyboard", "") | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if self.keyboard != "": | ||
| 40 | retval += "# System keyboard\nkeyboard %s\n" % self.keyboard | ||
| 41 | |||
| 42 | return retval | ||
| 43 | |||
| 44 | def _getParser(self): | ||
| 45 | op = KSOptionParser() | ||
| 46 | return op | ||
| 47 | |||
| 48 | def parse(self, args): | ||
| 49 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 50 | |||
| 51 | if len(extra) != 1: | ||
| 52 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires one argument") % "keyboard") | ||
| 53 | |||
| 54 | self.keyboard = extra[0] | ||
| 55 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/lang.py b/scripts/lib/mic/3rdparty/pykickstart/commands/lang.py new file mode 100644 index 0000000000..cf5e46cda7 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/lang.py | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_Lang(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | self.lang = kwargs.get("lang", "") | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if self.lang != "": | ||
| 40 | retval += "# System language\nlang %s\n" % self.lang | ||
| 41 | |||
| 42 | return retval | ||
| 43 | |||
| 44 | def _getParser(self): | ||
| 45 | op = KSOptionParser() | ||
| 46 | return op | ||
| 47 | |||
| 48 | def parse(self, args): | ||
| 49 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 50 | if len(extra) != 1: | ||
| 51 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires one argument") % "lang") | ||
| 52 | |||
| 53 | self.lang = extra[0] | ||
| 54 | return self | ||
| 55 | |||
| 56 | def apply(self, instroot="/"): | ||
| 57 | if self.lang == "": return | ||
| 58 | f = open(instroot + "/etc/sysconfig/i18n", "w+") | ||
| 59 | f.write("LANG=\"%s\"\n" %(self.lang,)) | ||
| 60 | f.close() | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/langsupport.py b/scripts/lib/mic/3rdparty/pykickstart/commands/langsupport.py new file mode 100644 index 0000000000..73a9e537a9 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/langsupport.py | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | class FC3_LangSupport(KickstartCommand): | ||
| 24 | removedKeywords = KickstartCommand.removedKeywords | ||
| 25 | removedAttrs = KickstartCommand.removedAttrs | ||
| 26 | |||
| 27 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 28 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 29 | self.op = self._getParser() | ||
| 30 | |||
| 31 | self.deflang = kwargs.get("deflang", "") | ||
| 32 | self.supported = kwargs.get("supported", []) | ||
| 33 | |||
| 34 | def __str__(self): | ||
| 35 | retval = KickstartCommand.__str__(self) | ||
| 36 | |||
| 37 | if self.deflang: | ||
| 38 | retval += "langsupport --default=%s" % self.deflang | ||
| 39 | |||
| 40 | if self.supported: | ||
| 41 | retval += " %s" % " ".join(self.supported) | ||
| 42 | |||
| 43 | return retval + "\n" | ||
| 44 | |||
| 45 | def _getParser(self): | ||
| 46 | op = KSOptionParser() | ||
| 47 | op.add_option("--default", dest="deflang", default="en_US.UTF-8") | ||
| 48 | return op | ||
| 49 | |||
| 50 | def parse(self, args): | ||
| 51 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 52 | self._setToSelf(self.op, opts) | ||
| 53 | self.supported = extra | ||
| 54 | return self | ||
| 55 | |||
| 56 | class FC5_LangSupport(DeprecatedCommand): | ||
| 57 | def __init__(self): | ||
| 58 | DeprecatedCommand.__init__(self) | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/lilocheck.py b/scripts/lib/mic/3rdparty/pykickstart/commands/lilocheck.py new file mode 100644 index 0000000000..92b3f930b6 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/lilocheck.py | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_LiloCheck(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | self.check = kwargs.get("check", False) | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if self.check: | ||
| 40 | retval += "lilocheck\n" | ||
| 41 | |||
| 42 | return retval | ||
| 43 | |||
| 44 | def _getParser(self): | ||
| 45 | op = KSOptionParser() | ||
| 46 | return op | ||
| 47 | |||
| 48 | def parse(self, args): | ||
| 49 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 50 | if len(extra) > 0: | ||
| 51 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "lilocheck") | ||
| 52 | |||
| 53 | self.check = True | ||
| 54 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/logging.py b/scripts/lib/mic/3rdparty/pykickstart/commands/logging.py new file mode 100644 index 0000000000..698561994d --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/logging.py | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007, 2009 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC6_Logging(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.host = kwargs.get("host", "") | ||
| 36 | self.level = kwargs.get("level", "info") | ||
| 37 | self.port = kwargs.get("port", "") | ||
| 38 | |||
| 39 | def __str__(self): | ||
| 40 | retval = KickstartCommand.__str__(self) | ||
| 41 | retval += "# Installation logging level\nlogging --level=%s" % self.level | ||
| 42 | |||
| 43 | if self.host != "": | ||
| 44 | retval += " --host=%s" % self.host | ||
| 45 | |||
| 46 | if self.port != "": | ||
| 47 | retval += " --port=%s" % self.port | ||
| 48 | |||
| 49 | return retval + "\n" | ||
| 50 | |||
| 51 | def _getParser(self): | ||
| 52 | op = KSOptionParser() | ||
| 53 | op.add_option("--host") | ||
| 54 | op.add_option("--level", type="choice", default="info", | ||
| 55 | choices=["debug", "info", "warning", "error", "critical"]) | ||
| 56 | op.add_option("--port") | ||
| 57 | return op | ||
| 58 | |||
| 59 | def parse(self, args): | ||
| 60 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 61 | |||
| 62 | if opts.port and not opts.host: | ||
| 63 | raise KickstartParseError, formatErrorMsg(self.lineno, msg=_("Can't specify --port without --host.")) | ||
| 64 | |||
| 65 | self._setToSelf(self.op, opts) | ||
| 66 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/logvol.py b/scripts/lib/mic/3rdparty/pykickstart/commands/logvol.py new file mode 100644 index 0000000000..c1b9cc3a61 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/logvol.py | |||
| @@ -0,0 +1,304 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | import warnings | ||
| 26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 27 | |||
| 28 | class FC3_LogVolData(BaseData): | ||
| 29 | removedKeywords = BaseData.removedKeywords | ||
| 30 | removedAttrs = BaseData.removedAttrs | ||
| 31 | |||
| 32 | def __init__(self, *args, **kwargs): | ||
| 33 | BaseData.__init__(self, *args, **kwargs) | ||
| 34 | self.fstype = kwargs.get("fstype", "") | ||
| 35 | self.grow = kwargs.get("grow", False) | ||
| 36 | self.maxSizeMB = kwargs.get("maxSizeMB", 0) | ||
| 37 | self.name = kwargs.get("name", "") | ||
| 38 | self.format = kwargs.get("format", True) | ||
| 39 | self.percent = kwargs.get("percent", 0) | ||
| 40 | self.recommended = kwargs.get("recommended", False) | ||
| 41 | self.size = kwargs.get("size", None) | ||
| 42 | self.preexist = kwargs.get("preexist", False) | ||
| 43 | self.vgname = kwargs.get("vgname", "") | ||
| 44 | self.mountpoint = kwargs.get("mountpoint", "") | ||
| 45 | |||
| 46 | def __eq__(self, y): | ||
| 47 | return self.vgname == y.vgname and self.name == y.name | ||
| 48 | |||
| 49 | def _getArgsAsStr(self): | ||
| 50 | retval = "" | ||
| 51 | |||
| 52 | if self.fstype != "": | ||
| 53 | retval += " --fstype=\"%s\"" % self.fstype | ||
| 54 | if self.grow: | ||
| 55 | retval += " --grow" | ||
| 56 | if self.maxSizeMB > 0: | ||
| 57 | retval += " --maxsize=%d" % self.maxSizeMB | ||
| 58 | if not self.format: | ||
| 59 | retval += " --noformat" | ||
| 60 | if self.percent > 0: | ||
| 61 | retval += " --percent=%d" % self.percent | ||
| 62 | if self.recommended: | ||
| 63 | retval += " --recommended" | ||
| 64 | if self.size > 0: | ||
| 65 | retval += " --size=%d" % self.size | ||
| 66 | if self.preexist: | ||
| 67 | retval += " --useexisting" | ||
| 68 | |||
| 69 | return retval | ||
| 70 | |||
| 71 | def __str__(self): | ||
| 72 | retval = BaseData.__str__(self) | ||
| 73 | retval += "logvol %s %s --name=%s --vgname=%s\n" % (self.mountpoint, self._getArgsAsStr(), self.name, self.vgname) | ||
| 74 | return retval | ||
| 75 | |||
| 76 | class FC4_LogVolData(FC3_LogVolData): | ||
| 77 | removedKeywords = FC3_LogVolData.removedKeywords | ||
| 78 | removedAttrs = FC3_LogVolData.removedAttrs | ||
| 79 | |||
| 80 | def __init__(self, *args, **kwargs): | ||
| 81 | FC3_LogVolData.__init__(self, *args, **kwargs) | ||
| 82 | self.bytesPerInode = kwargs.get("bytesPerInode", 4096) | ||
| 83 | self.fsopts = kwargs.get("fsopts", "") | ||
| 84 | |||
| 85 | def _getArgsAsStr(self): | ||
| 86 | retval = FC3_LogVolData._getArgsAsStr(self) | ||
| 87 | |||
| 88 | if hasattr(self, "bytesPerInode") and self.bytesPerInode != 0: | ||
| 89 | retval += " --bytes-per-inode=%d" % self.bytesPerInode | ||
| 90 | if self.fsopts != "": | ||
| 91 | retval += " --fsoptions=\"%s\"" % self.fsopts | ||
| 92 | |||
| 93 | return retval | ||
| 94 | |||
| 95 | class RHEL5_LogVolData(FC4_LogVolData): | ||
| 96 | removedKeywords = FC4_LogVolData.removedKeywords | ||
| 97 | removedAttrs = FC4_LogVolData.removedAttrs | ||
| 98 | |||
| 99 | def __init__(self, *args, **kwargs): | ||
| 100 | FC4_LogVolData.__init__(self, *args, **kwargs) | ||
| 101 | self.encrypted = kwargs.get("encrypted", False) | ||
| 102 | self.passphrase = kwargs.get("passphrase", "") | ||
| 103 | |||
| 104 | def _getArgsAsStr(self): | ||
| 105 | retval = FC4_LogVolData._getArgsAsStr(self) | ||
| 106 | |||
| 107 | if self.encrypted: | ||
| 108 | retval += " --encrypted" | ||
| 109 | |||
| 110 | if self.passphrase != "": | ||
| 111 | retval += " --passphrase=\"%s\"" % self.passphrase | ||
| 112 | |||
| 113 | return retval | ||
| 114 | |||
| 115 | class F9_LogVolData(FC4_LogVolData): | ||
| 116 | removedKeywords = FC4_LogVolData.removedKeywords + ["bytesPerInode"] | ||
| 117 | removedAttrs = FC4_LogVolData.removedAttrs + ["bytesPerInode"] | ||
| 118 | |||
| 119 | def __init__(self, *args, **kwargs): | ||
| 120 | FC4_LogVolData.__init__(self, *args, **kwargs) | ||
| 121 | self.deleteRemovedAttrs() | ||
| 122 | |||
| 123 | self.fsopts = kwargs.get("fsopts", "") | ||
| 124 | self.fsprofile = kwargs.get("fsprofile", "") | ||
| 125 | self.encrypted = kwargs.get("encrypted", False) | ||
| 126 | self.passphrase = kwargs.get("passphrase", "") | ||
| 127 | |||
| 128 | def _getArgsAsStr(self): | ||
| 129 | retval = FC4_LogVolData._getArgsAsStr(self) | ||
| 130 | |||
| 131 | if self.fsprofile != "": | ||
| 132 | retval += " --fsprofile=\"%s\"" % self.fsprofile | ||
| 133 | if self.encrypted: | ||
| 134 | retval += " --encrypted" | ||
| 135 | |||
| 136 | if self.passphrase != "": | ||
| 137 | retval += " --passphrase=\"%s\"" % self.passphrase | ||
| 138 | |||
| 139 | return retval | ||
| 140 | |||
| 141 | class F12_LogVolData(F9_LogVolData): | ||
| 142 | removedKeywords = F9_LogVolData.removedKeywords | ||
| 143 | removedAttrs = F9_LogVolData.removedAttrs | ||
| 144 | |||
| 145 | def __init__(self, *args, **kwargs): | ||
| 146 | F9_LogVolData.__init__(self, *args, **kwargs) | ||
| 147 | self.deleteRemovedAttrs() | ||
| 148 | |||
| 149 | self.escrowcert = kwargs.get("escrowcert", "") | ||
| 150 | self.backuppassphrase = kwargs.get("backuppassphrase", False) | ||
| 151 | |||
| 152 | def _getArgsAsStr(self): | ||
| 153 | retval = F9_LogVolData._getArgsAsStr(self) | ||
| 154 | |||
| 155 | if self.encrypted and self.escrowcert != "": | ||
| 156 | retval += " --escrowcert=\"%s\"" % self.escrowcert | ||
| 157 | |||
| 158 | if self.backuppassphrase: | ||
| 159 | retval += " --backuppassphrase" | ||
| 160 | |||
| 161 | return retval | ||
| 162 | |||
| 163 | F14_LogVolData = F12_LogVolData | ||
| 164 | |||
| 165 | class F15_LogVolData(F14_LogVolData): | ||
| 166 | removedKeywords = F14_LogVolData.removedKeywords | ||
| 167 | removedAttrs = F14_LogVolData.removedAttrs | ||
| 168 | |||
| 169 | def __init__(self, *args, **kwargs): | ||
| 170 | F14_LogVolData.__init__(self, *args, **kwargs) | ||
| 171 | self.label = kwargs.get("label", "") | ||
| 172 | |||
| 173 | def _getArgsAsStr(self): | ||
| 174 | retval = F14_LogVolData._getArgsAsStr(self) | ||
| 175 | |||
| 176 | if self.label != "": | ||
| 177 | retval += " --label=\"%s\"" % self.label | ||
| 178 | |||
| 179 | return retval | ||
| 180 | |||
| 181 | class FC3_LogVol(KickstartCommand): | ||
| 182 | removedKeywords = KickstartCommand.removedKeywords | ||
| 183 | removedAttrs = KickstartCommand.removedAttrs | ||
| 184 | |||
| 185 | def __init__(self, writePriority=133, *args, **kwargs): | ||
| 186 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 187 | self.op = self._getParser() | ||
| 188 | |||
| 189 | self.lvList = kwargs.get("lvList", []) | ||
| 190 | |||
| 191 | def __str__(self): | ||
| 192 | retval = "" | ||
| 193 | |||
| 194 | for part in self.lvList: | ||
| 195 | retval += part.__str__() | ||
| 196 | |||
| 197 | return retval | ||
| 198 | |||
| 199 | def _getParser(self): | ||
| 200 | def lv_cb (option, opt_str, value, parser): | ||
| 201 | parser.values.format = False | ||
| 202 | parser.values.preexist = True | ||
| 203 | |||
| 204 | op = KSOptionParser() | ||
| 205 | op.add_option("--fstype", dest="fstype") | ||
| 206 | op.add_option("--grow", dest="grow", action="store_true", | ||
| 207 | default=False) | ||
| 208 | op.add_option("--maxsize", dest="maxSizeMB", action="store", type="int", | ||
| 209 | nargs=1) | ||
| 210 | op.add_option("--name", dest="name", required=1) | ||
| 211 | op.add_option("--noformat", action="callback", callback=lv_cb, | ||
| 212 | dest="format", default=True, nargs=0) | ||
| 213 | op.add_option("--percent", dest="percent", action="store", type="int", | ||
| 214 | nargs=1) | ||
| 215 | op.add_option("--recommended", dest="recommended", action="store_true", | ||
| 216 | default=False) | ||
| 217 | op.add_option("--size", dest="size", action="store", type="int", | ||
| 218 | nargs=1) | ||
| 219 | op.add_option("--useexisting", dest="preexist", action="store_true", | ||
| 220 | default=False) | ||
| 221 | op.add_option("--vgname", dest="vgname", required=1) | ||
| 222 | return op | ||
| 223 | |||
| 224 | def parse(self, args): | ||
| 225 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 226 | |||
| 227 | if len(extra) == 0: | ||
| 228 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Mount point required for %s") % "logvol") | ||
| 229 | |||
| 230 | lvd = self.handler.LogVolData() | ||
| 231 | self._setToObj(self.op, opts, lvd) | ||
| 232 | lvd.lineno = self.lineno | ||
| 233 | lvd.mountpoint=extra[0] | ||
| 234 | |||
| 235 | # Check for duplicates in the data list. | ||
| 236 | if lvd in self.dataList(): | ||
| 237 | warnings.warn(_("A logical volume with the name %s has already been defined in volume group %s.") % (lvd.device, lvd.vgname)) | ||
| 238 | |||
| 239 | return lvd | ||
| 240 | |||
| 241 | def dataList(self): | ||
| 242 | return self.lvList | ||
| 243 | |||
| 244 | class FC4_LogVol(FC3_LogVol): | ||
| 245 | removedKeywords = FC3_LogVol.removedKeywords | ||
| 246 | removedAttrs = FC3_LogVol.removedAttrs | ||
| 247 | |||
| 248 | def _getParser(self): | ||
| 249 | op = FC3_LogVol._getParser(self) | ||
| 250 | op.add_option("--bytes-per-inode", dest="bytesPerInode", action="store", | ||
| 251 | type="int", nargs=1) | ||
| 252 | op.add_option("--fsoptions", dest="fsopts") | ||
| 253 | return op | ||
| 254 | |||
| 255 | class RHEL5_LogVol(FC4_LogVol): | ||
| 256 | removedKeywords = FC4_LogVol.removedKeywords | ||
| 257 | removedAttrs = FC4_LogVol.removedAttrs | ||
| 258 | |||
| 259 | def _getParser(self): | ||
| 260 | op = FC4_LogVol._getParser(self) | ||
| 261 | op.add_option("--encrypted", action="store_true", default=False) | ||
| 262 | op.add_option("--passphrase") | ||
| 263 | return op | ||
| 264 | |||
| 265 | class F9_LogVol(FC4_LogVol): | ||
| 266 | removedKeywords = FC4_LogVol.removedKeywords | ||
| 267 | removedAttrs = FC4_LogVol.removedAttrs | ||
| 268 | |||
| 269 | def _getParser(self): | ||
| 270 | op = FC4_LogVol._getParser(self) | ||
| 271 | op.add_option("--bytes-per-inode", deprecated=1) | ||
| 272 | op.add_option("--fsprofile", dest="fsprofile", action="store", | ||
| 273 | type="string", nargs=1) | ||
| 274 | op.add_option("--encrypted", action="store_true", default=False) | ||
| 275 | op.add_option("--passphrase") | ||
| 276 | return op | ||
| 277 | |||
| 278 | class F12_LogVol(F9_LogVol): | ||
| 279 | removedKeywords = F9_LogVol.removedKeywords | ||
| 280 | removedAttrs = F9_LogVol.removedAttrs | ||
| 281 | |||
| 282 | def _getParser(self): | ||
| 283 | op = F9_LogVol._getParser(self) | ||
| 284 | op.add_option("--escrowcert") | ||
| 285 | op.add_option("--backuppassphrase", action="store_true", default=False) | ||
| 286 | return op | ||
| 287 | |||
| 288 | class F14_LogVol(F12_LogVol): | ||
| 289 | removedKeywords = F12_LogVol.removedKeywords | ||
| 290 | removedAttrs = F12_LogVol.removedAttrs | ||
| 291 | |||
| 292 | def _getParser(self): | ||
| 293 | op = F12_LogVol._getParser(self) | ||
| 294 | op.remove_option("--bytes-per-inode") | ||
| 295 | return op | ||
| 296 | |||
| 297 | class F15_LogVol(F14_LogVol): | ||
| 298 | removedKeywords = F14_LogVol.removedKeywords | ||
| 299 | removedAttrs = F14_LogVol.removedAttrs | ||
| 300 | |||
| 301 | def _getParser(self): | ||
| 302 | op = F14_LogVol._getParser(self) | ||
| 303 | op.add_option("--label") | ||
| 304 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/mediacheck.py b/scripts/lib/mic/3rdparty/pykickstart/commands/mediacheck.py new file mode 100644 index 0000000000..388823a839 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/mediacheck.py | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC4_MediaCheck(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | self.mediacheck = kwargs.get("mediacheck", False) | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | if self.mediacheck: | ||
| 39 | retval += "mediacheck\n" | ||
| 40 | |||
| 41 | return retval | ||
| 42 | |||
| 43 | def _getParser(self): | ||
| 44 | op = KSOptionParser() | ||
| 45 | return op | ||
| 46 | |||
| 47 | def parse(self, args): | ||
| 48 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 49 | if len(extra) > 0: | ||
| 50 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "mediacheck") | ||
| 51 | |||
| 52 | self.mediacheck = True | ||
| 53 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/method.py b/scripts/lib/mic/3rdparty/pykickstart/commands/method.py new file mode 100644 index 0000000000..e21064acda --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/method.py | |||
| @@ -0,0 +1,186 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007, 2009 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_Method(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.method = kwargs.get("method", "") | ||
| 34 | |||
| 35 | # Set all these attributes so calls to this command's __call__ | ||
| 36 | # method can set them. However we don't want to provide them as | ||
| 37 | # arguments to __init__ because method is special. | ||
| 38 | self.biospart = None | ||
| 39 | self.partition = None | ||
| 40 | self.server = None | ||
| 41 | self.dir = None | ||
| 42 | self.url = None | ||
| 43 | |||
| 44 | def __str__(self): | ||
| 45 | retval = KickstartCommand.__str__(self) | ||
| 46 | |||
| 47 | if self.method == "cdrom": | ||
| 48 | retval += "# Use CDROM installation media\ncdrom\n" | ||
| 49 | elif self.method == "harddrive": | ||
| 50 | msg = "# Use hard drive installation media\nharddrive --dir=%s" % self.dir | ||
| 51 | |||
| 52 | if self.biospart is not None: | ||
| 53 | retval += msg + " --biospart=%s\n" % self.biospart | ||
| 54 | else: | ||
| 55 | retval += msg + " --partition=%s\n" % self.partition | ||
| 56 | elif self.method == "nfs": | ||
| 57 | retval += "# Use NFS installation media\nnfs --server=%s --dir=%s\n" % (self.server, self.dir) | ||
| 58 | elif self.method == "url": | ||
| 59 | retval += "# Use network installation\nurl --url=\"%s\"\n" % self.url | ||
| 60 | |||
| 61 | return retval | ||
| 62 | |||
| 63 | def _getParser(self): | ||
| 64 | op = KSOptionParser() | ||
| 65 | |||
| 66 | # method = "cdrom" falls through to the return | ||
| 67 | if self.currentCmd == "harddrive": | ||
| 68 | op.add_option("--biospart", dest="biospart") | ||
| 69 | op.add_option("--partition", dest="partition") | ||
| 70 | op.add_option("--dir", dest="dir", required=1) | ||
| 71 | elif self.currentCmd == "nfs": | ||
| 72 | op.add_option("--server", dest="server", required=1) | ||
| 73 | op.add_option("--dir", dest="dir", required=1) | ||
| 74 | elif self.currentCmd == "url": | ||
| 75 | op.add_option("--url", dest="url", required=1) | ||
| 76 | |||
| 77 | return op | ||
| 78 | |||
| 79 | def parse(self, args): | ||
| 80 | self.method = self.currentCmd | ||
| 81 | |||
| 82 | op = self._getParser() | ||
| 83 | (opts, extra) = op.parse_args(args=args, lineno=self.lineno) | ||
| 84 | self._setToSelf(op, opts) | ||
| 85 | |||
| 86 | if self.currentCmd == "harddrive": | ||
| 87 | if self.biospart is None and self.partition is None or \ | ||
| 88 | self.biospart is not None and self.partition is not None: | ||
| 89 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("One of biospart or partition options must be specified.")) | ||
| 90 | |||
| 91 | return self | ||
| 92 | |||
| 93 | class FC6_Method(FC3_Method): | ||
| 94 | removedKeywords = FC3_Method.removedKeywords | ||
| 95 | removedAttrs = FC3_Method.removedAttrs | ||
| 96 | |||
| 97 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 98 | FC3_Method.__init__(self, writePriority, *args, **kwargs) | ||
| 99 | |||
| 100 | # Same reason for this attribute as the comment in FC3_Method. | ||
| 101 | self.opts = None | ||
| 102 | |||
| 103 | def __str__(self): | ||
| 104 | retval = KickstartCommand.__str__(self) | ||
| 105 | |||
| 106 | if self.method == "cdrom": | ||
| 107 | retval += "# Use CDROM installation media\ncdrom\n" | ||
| 108 | elif self.method == "harddrive": | ||
| 109 | msg = "# Use hard drive installation media\nharddrive --dir=%s" % self.dir | ||
| 110 | |||
| 111 | if self.biospart is not None: | ||
| 112 | retval += msg + " --biospart=%s\n" % self.biospart | ||
| 113 | else: | ||
| 114 | retval += msg + " --partition=%s\n" % self.partition | ||
| 115 | elif self.method == "nfs": | ||
| 116 | retval += "# Use NFS installation media\nnfs --server=%s --dir=%s" % (self.server, self.dir) | ||
| 117 | if self.opts is not None: | ||
| 118 | retval += " --opts=\"%s\"" % self.opts | ||
| 119 | retval += "\n" | ||
| 120 | elif self.method == "url": | ||
| 121 | retval += "# Use network installation\nurl --url=\"%s\"\n" % self.url | ||
| 122 | |||
| 123 | return retval | ||
| 124 | |||
| 125 | def _getParser(self): | ||
| 126 | op = FC3_Method._getParser(self) | ||
| 127 | |||
| 128 | if self.currentCmd == "nfs": | ||
| 129 | op.add_option("--opts", dest="opts") | ||
| 130 | |||
| 131 | return op | ||
| 132 | |||
| 133 | class F13_Method(FC6_Method): | ||
| 134 | removedKeywords = FC6_Method.removedKeywords | ||
| 135 | removedAttrs = FC6_Method.removedAttrs | ||
| 136 | |||
| 137 | def __init__(self, *args, **kwargs): | ||
| 138 | FC6_Method.__init__(self, *args, **kwargs) | ||
| 139 | |||
| 140 | # And same as all the other __init__ methods. | ||
| 141 | self.proxy = "" | ||
| 142 | |||
| 143 | def __str__(self): | ||
| 144 | retval = FC6_Method.__str__(self) | ||
| 145 | |||
| 146 | if self.method == "url" and self.proxy: | ||
| 147 | retval = retval.strip() | ||
| 148 | retval += " --proxy=\"%s\"\n" % self.proxy | ||
| 149 | |||
| 150 | return retval | ||
| 151 | |||
| 152 | def _getParser(self): | ||
| 153 | op = FC6_Method._getParser(self) | ||
| 154 | |||
| 155 | if self.currentCmd == "url": | ||
| 156 | op.add_option("--proxy") | ||
| 157 | |||
| 158 | return op | ||
| 159 | |||
| 160 | class F14_Method(F13_Method): | ||
| 161 | removedKeywords = F13_Method.removedKeywords | ||
| 162 | removedAttrs = F13_Method.removedAttrs | ||
| 163 | |||
| 164 | def __init__(self, *args, **kwargs): | ||
| 165 | F13_Method.__init__(self, *args, **kwargs) | ||
| 166 | |||
| 167 | self.noverifyssl = False | ||
| 168 | |||
| 169 | def __str__(self): | ||
| 170 | retval = F13_Method.__str__(self) | ||
| 171 | |||
| 172 | if self.method == "url" and self.noverifyssl: | ||
| 173 | retval = retval.strip() | ||
| 174 | retval += " --noverifyssl\n" | ||
| 175 | |||
| 176 | return retval | ||
| 177 | |||
| 178 | def _getParser(self): | ||
| 179 | op = F13_Method._getParser(self) | ||
| 180 | |||
| 181 | if self.currentCmd == "url": | ||
| 182 | op.add_option("--noverifyssl", action="store_true", default=False) | ||
| 183 | |||
| 184 | return op | ||
| 185 | |||
| 186 | RHEL6_Method = F14_Method | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py b/scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py new file mode 100644 index 0000000000..8c8c2c4fc9 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_Monitor(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.hsync = kwargs.get("hsync", "") | ||
| 36 | self.monitor = kwargs.get("monitor", "") | ||
| 37 | self.vsync = kwargs.get("vsync", "") | ||
| 38 | |||
| 39 | def __str__(self): | ||
| 40 | retval = KickstartCommand.__str__(self) | ||
| 41 | retval += "monitor" | ||
| 42 | |||
| 43 | if self.hsync != "": | ||
| 44 | retval += " --hsync=%s" % self.hsync | ||
| 45 | if self.monitor != "": | ||
| 46 | retval += " --monitor=\"%s\"" % self.monitor | ||
| 47 | if self.vsync != "": | ||
| 48 | retval += " --vsync=%s" % self.vsync | ||
| 49 | |||
| 50 | if retval != "monitor": | ||
| 51 | return retval + "\n" | ||
| 52 | else: | ||
| 53 | return "" | ||
| 54 | |||
| 55 | def _getParser(self): | ||
| 56 | op = KSOptionParser() | ||
| 57 | op.add_option("--hsync") | ||
| 58 | op.add_option("--monitor") | ||
| 59 | op.add_option("--vsync") | ||
| 60 | return op | ||
| 61 | |||
| 62 | def parse(self, args): | ||
| 63 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 64 | |||
| 65 | if extra: | ||
| 66 | mapping = {"cmd": "monitor", "options": extra} | ||
| 67 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(cmd)s command: %(options)s") % mapping) | ||
| 68 | |||
| 69 | self._setToSelf(self.op, opts) | ||
| 70 | return self | ||
| 71 | |||
| 72 | class FC6_Monitor(FC3_Monitor): | ||
| 73 | removedKeywords = FC3_Monitor.removedKeywords | ||
| 74 | removedAttrs = FC3_Monitor.removedAttrs | ||
| 75 | |||
| 76 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 77 | FC3_Monitor.__init__(self, writePriority, *args, **kwargs) | ||
| 78 | self.probe = kwargs.get("probe", True) | ||
| 79 | |||
| 80 | def __str__(self): | ||
| 81 | retval = KickstartCommand.__str__(self) | ||
| 82 | retval += "monitor" | ||
| 83 | |||
| 84 | if self.hsync != "": | ||
| 85 | retval += " --hsync=%s" % self.hsync | ||
| 86 | if self.monitor != "": | ||
| 87 | retval += " --monitor=\"%s\"" % self.monitor | ||
| 88 | if not self.probe: | ||
| 89 | retval += " --noprobe" | ||
| 90 | if self.vsync != "": | ||
| 91 | retval += " --vsync=%s" % self.vsync | ||
| 92 | |||
| 93 | if retval != "monitor": | ||
| 94 | return retval + "\n" | ||
| 95 | else: | ||
| 96 | return "" | ||
| 97 | |||
| 98 | def _getParser(self): | ||
| 99 | op = FC3_Monitor._getParser(self) | ||
| 100 | op.add_option("--noprobe", dest="probe", action="store_false", | ||
| 101 | default=True) | ||
| 102 | return op | ||
| 103 | |||
| 104 | class F10_Monitor(DeprecatedCommand): | ||
| 105 | def __init__(self): | ||
| 106 | DeprecatedCommand.__init__(self) | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/mouse.py b/scripts/lib/mic/3rdparty/pykickstart/commands/mouse.py new file mode 100644 index 0000000000..c643bcedc3 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/mouse.py | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class RHEL3_Mouse(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.device = kwargs.get("device", "") | ||
| 36 | self.emulthree = kwargs.get("emulthree", False) | ||
| 37 | self.mouse = kwargs.get("mouse", "") | ||
| 38 | |||
| 39 | def __str__(self): | ||
| 40 | retval = KickstartCommand.__str__(self) | ||
| 41 | |||
| 42 | opts = "" | ||
| 43 | if self.device: | ||
| 44 | opts += "--device=%s " % self.device | ||
| 45 | if self.emulthree: | ||
| 46 | opts += "--emulthree " | ||
| 47 | |||
| 48 | if self.mouse: | ||
| 49 | retval += "# System mouse\nmouse %s%s\n" % (opts, self.mouse) | ||
| 50 | return retval | ||
| 51 | |||
| 52 | def _getParser(self): | ||
| 53 | op = KSOptionParser() | ||
| 54 | op.add_option("--device", dest="device", default="") | ||
| 55 | op.add_option("--emulthree", dest="emulthree", default=False, action="store_true") | ||
| 56 | return op | ||
| 57 | |||
| 58 | def parse(self, args): | ||
| 59 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 60 | self._setToSelf(self.op, opts) | ||
| 61 | |||
| 62 | if len(extra) != 1: | ||
| 63 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires one argument") % "mouse") | ||
| 64 | |||
| 65 | self.mouse = extra[0] | ||
| 66 | return self | ||
| 67 | |||
| 68 | class FC3_Mouse(DeprecatedCommand): | ||
| 69 | def __init__(self): | ||
| 70 | DeprecatedCommand.__init__(self) | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/multipath.py b/scripts/lib/mic/3rdparty/pykickstart/commands/multipath.py new file mode 100644 index 0000000000..84ba755e68 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/multipath.py | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # Peter Jones <pjones@redhat.com> | ||
| 4 | # | ||
| 5 | # Copyright 2006, 2007 Red Hat, Inc. | ||
| 6 | # | ||
| 7 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 8 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 9 | # General Public License v.2. This program is distributed in the hope that it | ||
| 10 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 11 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 12 | # See the GNU General Public License for more details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License along with | ||
| 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 17 | # trademarks that are incorporated in the source code or documentation are not | ||
| 18 | # subject to the GNU General Public License and may only be used or replicated | ||
| 19 | # with the express permission of Red Hat, Inc. | ||
| 20 | # | ||
| 21 | from pykickstart.base import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 27 | |||
| 28 | class FC6_MpPathData(BaseData): | ||
| 29 | removedKeywords = BaseData.removedKeywords | ||
| 30 | removedAttrs = BaseData.removedAttrs | ||
| 31 | |||
| 32 | def __init__(self, *args, **kwargs): | ||
| 33 | BaseData.__init__(self, *args, **kwargs) | ||
| 34 | self.mpdev = kwargs.get("mpdev", "") | ||
| 35 | self.device = kwargs.get("device", "") | ||
| 36 | self.rule = kwargs.get("rule", "") | ||
| 37 | |||
| 38 | def __str__(self): | ||
| 39 | return " --device=%s --rule=\"%s\"" % (self.device, self.rule) | ||
| 40 | |||
| 41 | class FC6_MultiPathData(BaseData): | ||
| 42 | removedKeywords = BaseData.removedKeywords | ||
| 43 | removedAttrs = BaseData.removedAttrs | ||
| 44 | |||
| 45 | def __init__(self, *args, **kwargs): | ||
| 46 | BaseData.__init__(self, *args, **kwargs) | ||
| 47 | self.name = kwargs.get("name", "") | ||
| 48 | self.paths = kwargs.get("paths", []) | ||
| 49 | |||
| 50 | def __str__(self): | ||
| 51 | retval = BaseData.__str__(self) | ||
| 52 | |||
| 53 | for path in self.paths: | ||
| 54 | retval += "multipath --mpdev=%s %s\n" % (self.name, path.__str__()) | ||
| 55 | |||
| 56 | return retval | ||
| 57 | |||
| 58 | class FC6_MultiPath(KickstartCommand): | ||
| 59 | removedKeywords = KickstartCommand.removedKeywords | ||
| 60 | removedAttrs = KickstartCommand.removedAttrs | ||
| 61 | |||
| 62 | def __init__(self, writePriority=50, *args, **kwargs): | ||
| 63 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 64 | self.op = self._getParser() | ||
| 65 | |||
| 66 | self.mpaths = kwargs.get("mpaths", []) | ||
| 67 | |||
| 68 | def __str__(self): | ||
| 69 | retval = "" | ||
| 70 | for mpath in self.mpaths: | ||
| 71 | retval += mpath.__str__() | ||
| 72 | |||
| 73 | return retval | ||
| 74 | |||
| 75 | def _getParser(self): | ||
| 76 | op = KSOptionParser() | ||
| 77 | op.add_option("--name", dest="name", action="store", type="string", | ||
| 78 | required=1) | ||
| 79 | op.add_option("--device", dest="device", action="store", type="string", | ||
| 80 | required=1) | ||
| 81 | op.add_option("--rule", dest="rule", action="store", type="string", | ||
| 82 | required=1) | ||
| 83 | return op | ||
| 84 | |||
| 85 | def parse(self, args): | ||
| 86 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 87 | dd = FC6_MpPathData() | ||
| 88 | self._setToObj(self.op, opts, dd) | ||
| 89 | dd.lineno = self.lineno | ||
| 90 | dd.mpdev = dd.mpdev.split('/')[-1] | ||
| 91 | |||
| 92 | parent = None | ||
| 93 | for x in range(0, len(self.mpaths)): | ||
| 94 | mpath = self.mpaths[x] | ||
| 95 | for path in mpath.paths: | ||
| 96 | if path.device == dd.device: | ||
| 97 | mapping = {"device": path.device, "multipathdev": path.mpdev} | ||
| 98 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Device '%(device)s' is already used in multipath '%(multipathdev)s'") % mapping) | ||
| 99 | if mpath.name == dd.mpdev: | ||
| 100 | parent = x | ||
| 101 | |||
| 102 | if parent is None: | ||
| 103 | mpath = FC6_MultiPathData() | ||
| 104 | return mpath | ||
| 105 | else: | ||
| 106 | mpath = self.mpaths[parent] | ||
| 107 | |||
| 108 | return dd | ||
| 109 | |||
| 110 | def dataList(self): | ||
| 111 | return self.mpaths | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/network.py b/scripts/lib/mic/3rdparty/pykickstart/commands/network.py new file mode 100644 index 0000000000..9b67f92831 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/network.py | |||
| @@ -0,0 +1,363 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | import warnings | ||
| 27 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 28 | |||
| 29 | class FC3_NetworkData(BaseData): | ||
| 30 | removedKeywords = BaseData.removedKeywords | ||
| 31 | removedAttrs = BaseData.removedAttrs | ||
| 32 | |||
| 33 | def __init__(self, *args, **kwargs): | ||
| 34 | BaseData.__init__(self, *args, **kwargs) | ||
| 35 | self.bootProto = kwargs.get("bootProto", BOOTPROTO_DHCP) | ||
| 36 | self.dhcpclass = kwargs.get("dhcpclass", "") | ||
| 37 | self.device = kwargs.get("device", "") | ||
| 38 | self.essid = kwargs.get("essid", "") | ||
| 39 | self.ethtool = kwargs.get("ethtool", "") | ||
| 40 | self.gateway = kwargs.get("gateway", "") | ||
| 41 | self.hostname = kwargs.get("hostname", "") | ||
| 42 | self.ip = kwargs.get("ip", "") | ||
| 43 | self.mtu = kwargs.get("mtu", "") | ||
| 44 | self.nameserver = kwargs.get("nameserver", "") | ||
| 45 | self.netmask = kwargs.get("netmask", "") | ||
| 46 | self.nodns = kwargs.get("nodns", False) | ||
| 47 | self.onboot = kwargs.get("onboot", True) | ||
| 48 | self.wepkey = kwargs.get("wepkey", "") | ||
| 49 | |||
| 50 | def __eq__(self, y): | ||
| 51 | return self.device and self.device == y.device | ||
| 52 | |||
| 53 | def _getArgsAsStr(self): | ||
| 54 | retval = "" | ||
| 55 | |||
| 56 | if self.bootProto != "": | ||
| 57 | retval += " --bootproto=%s" % self.bootProto | ||
| 58 | if self.dhcpclass != "": | ||
| 59 | retval += " --dhcpclass=%s" % self.dhcpclass | ||
| 60 | if self.device != "": | ||
| 61 | retval += " --device=%s" % self.device | ||
| 62 | if self.essid != "": | ||
| 63 | retval += " --essid=\"%s\"" % self.essid | ||
| 64 | if self.ethtool != "": | ||
| 65 | retval += " --ethtool=\"%s\"" % self.ethtool | ||
| 66 | if self.gateway != "": | ||
| 67 | retval += " --gateway=%s" % self.gateway | ||
| 68 | if self.hostname != "": | ||
| 69 | retval += " --hostname=%s" % self.hostname | ||
| 70 | if self.ip != "": | ||
| 71 | retval += " --ip=%s" % self.ip | ||
| 72 | if self.mtu != "": | ||
| 73 | retval += " --mtu=%s" % self.mtu | ||
| 74 | if self.nameserver != "": | ||
| 75 | retval += " --nameserver=%s" % self.nameserver | ||
| 76 | if self.netmask != "": | ||
| 77 | retval += " --netmask=%s" % self.netmask | ||
| 78 | if self.nodns: | ||
| 79 | retval += " --nodns" | ||
| 80 | if not self.onboot: | ||
| 81 | retval += " --onboot=off" | ||
| 82 | if self.wepkey != "": | ||
| 83 | retval += " --wepkey=%s" % self.wepkey | ||
| 84 | |||
| 85 | return retval | ||
| 86 | |||
| 87 | def __str__(self): | ||
| 88 | retval = BaseData.__str__(self) | ||
| 89 | retval += "network %s\n" % self._getArgsAsStr() | ||
| 90 | return retval | ||
| 91 | |||
| 92 | class FC4_NetworkData(FC3_NetworkData): | ||
| 93 | removedKeywords = FC3_NetworkData.removedKeywords | ||
| 94 | removedAttrs = FC3_NetworkData.removedAttrs | ||
| 95 | |||
| 96 | def __init__(self, *args, **kwargs): | ||
| 97 | FC3_NetworkData.__init__(self, *args, **kwargs) | ||
| 98 | self.notksdevice = kwargs.get("notksdevice", False) | ||
| 99 | |||
| 100 | def _getArgsAsStr(self): | ||
| 101 | retval = FC3_NetworkData._getArgsAsStr(self) | ||
| 102 | |||
| 103 | if self.notksdevice: | ||
| 104 | retval += " --notksdevice" | ||
| 105 | |||
| 106 | return retval | ||
| 107 | |||
| 108 | class FC6_NetworkData(FC4_NetworkData): | ||
| 109 | removedKeywords = FC4_NetworkData.removedKeywords | ||
| 110 | removedAttrs = FC4_NetworkData.removedAttrs | ||
| 111 | |||
| 112 | def __init__(self, *args, **kwargs): | ||
| 113 | FC4_NetworkData.__init__(self, *args, **kwargs) | ||
| 114 | self.noipv4 = kwargs.get("noipv4", False) | ||
| 115 | self.noipv6 = kwargs.get("noipv6", False) | ||
| 116 | |||
| 117 | def _getArgsAsStr(self): | ||
| 118 | retval = FC4_NetworkData._getArgsAsStr(self) | ||
| 119 | |||
| 120 | if self.noipv4: | ||
| 121 | retval += " --noipv4" | ||
| 122 | if self.noipv6: | ||
| 123 | retval += " --noipv6" | ||
| 124 | |||
| 125 | return retval | ||
| 126 | |||
| 127 | class F8_NetworkData(FC6_NetworkData): | ||
| 128 | removedKeywords = FC6_NetworkData.removedKeywords | ||
| 129 | removedAttrs = FC6_NetworkData.removedAttrs | ||
| 130 | |||
| 131 | def __init__(self, *args, **kwargs): | ||
| 132 | FC6_NetworkData.__init__(self, *args, **kwargs) | ||
| 133 | self.ipv6 = kwargs.get("ipv6", "") | ||
| 134 | |||
| 135 | def _getArgsAsStr(self): | ||
| 136 | retval = FC6_NetworkData._getArgsAsStr(self) | ||
| 137 | |||
| 138 | if self.ipv6 != "": | ||
| 139 | retval += " --ipv6" % self.ipv6 | ||
| 140 | |||
| 141 | return retval | ||
| 142 | |||
| 143 | class F16_NetworkData(F8_NetworkData): | ||
| 144 | removedKeywords = F8_NetworkData.removedKeywords | ||
| 145 | removedAttrs = F8_NetworkData.removedAttrs | ||
| 146 | |||
| 147 | def __init__(self, *args, **kwargs): | ||
| 148 | F8_NetworkData.__init__(self, *args, **kwargs) | ||
| 149 | self.activate = kwargs.get("activate", False) | ||
| 150 | self.nodefroute = kwargs.get("nodefroute", False) | ||
| 151 | self.wpakey = kwargs.get("wpakey", "") | ||
| 152 | |||
| 153 | def _getArgsAsStr(self): | ||
| 154 | retval = F8_NetworkData._getArgsAsStr(self) | ||
| 155 | |||
| 156 | if self.activate: | ||
| 157 | retval += " --activate" | ||
| 158 | if self.nodefroute: | ||
| 159 | retval += " --nodefroute" | ||
| 160 | if self.wpakey != "": | ||
| 161 | retval += "--wpakey=%s" % self.wpakey | ||
| 162 | |||
| 163 | return retval | ||
| 164 | |||
| 165 | class RHEL4_NetworkData(FC3_NetworkData): | ||
| 166 | removedKeywords = FC3_NetworkData.removedKeywords | ||
| 167 | removedAttrs = FC3_NetworkData.removedAttrs | ||
| 168 | |||
| 169 | def __init__(self, *args, **kwargs): | ||
| 170 | FC3_NetworkData.__init__(self, *args, **kwargs) | ||
| 171 | self.notksdevice = kwargs.get("notksdevice", False) | ||
| 172 | |||
| 173 | def _getArgsAsStr(self): | ||
| 174 | retval = FC3_NetworkData._getArgsAsStr(self) | ||
| 175 | |||
| 176 | if self.notksdevice: | ||
| 177 | retval += " --notksdevice" | ||
| 178 | |||
| 179 | return retval | ||
| 180 | |||
| 181 | class RHEL6_NetworkData(F8_NetworkData): | ||
| 182 | removedKeywords = F8_NetworkData.removedKeywords | ||
| 183 | removedAttrs = F8_NetworkData.removedAttrs | ||
| 184 | |||
| 185 | def __init__(self, *args, **kwargs): | ||
| 186 | F8_NetworkData.__init__(self, *args, **kwargs) | ||
| 187 | self.activate = kwargs.get("activate", False) | ||
| 188 | self.nodefroute = kwargs.get("nodefroute", False) | ||
| 189 | |||
| 190 | def _getArgsAsStr(self): | ||
| 191 | retval = F8_NetworkData._getArgsAsStr(self) | ||
| 192 | |||
| 193 | if self.activate: | ||
| 194 | retval += " --activate" | ||
| 195 | if self.nodefroute: | ||
| 196 | retval += " --nodefroute" | ||
| 197 | |||
| 198 | return retval | ||
| 199 | |||
| 200 | class FC3_Network(KickstartCommand): | ||
| 201 | removedKeywords = KickstartCommand.removedKeywords | ||
| 202 | removedAttrs = KickstartCommand.removedAttrs | ||
| 203 | |||
| 204 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 205 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 206 | self.bootprotoList = [BOOTPROTO_DHCP, BOOTPROTO_BOOTP, | ||
| 207 | BOOTPROTO_STATIC] | ||
| 208 | |||
| 209 | self.op = self._getParser() | ||
| 210 | |||
| 211 | self.network = kwargs.get("network", []) | ||
| 212 | |||
| 213 | def __str__(self): | ||
| 214 | retval = "" | ||
| 215 | |||
| 216 | for nic in self.network: | ||
| 217 | retval += nic.__str__() | ||
| 218 | |||
| 219 | if retval != "": | ||
| 220 | return "# Network information\n" + retval | ||
| 221 | else: | ||
| 222 | return "" | ||
| 223 | |||
| 224 | def _getParser(self): | ||
| 225 | op = KSOptionParser() | ||
| 226 | op.add_option("--bootproto", dest="bootProto", | ||
| 227 | default=BOOTPROTO_DHCP, | ||
| 228 | choices=self.bootprotoList) | ||
| 229 | op.add_option("--dhcpclass", dest="dhcpclass") | ||
| 230 | op.add_option("--device", dest="device") | ||
| 231 | op.add_option("--essid", dest="essid") | ||
| 232 | op.add_option("--ethtool", dest="ethtool") | ||
| 233 | op.add_option("--gateway", dest="gateway") | ||
| 234 | op.add_option("--hostname", dest="hostname") | ||
| 235 | op.add_option("--ip", dest="ip") | ||
| 236 | op.add_option("--mtu", dest="mtu") | ||
| 237 | op.add_option("--nameserver", dest="nameserver") | ||
| 238 | op.add_option("--netmask", dest="netmask") | ||
| 239 | op.add_option("--nodns", dest="nodns", action="store_true", | ||
| 240 | default=False) | ||
| 241 | op.add_option("--onboot", dest="onboot", action="store", | ||
| 242 | type="ksboolean") | ||
| 243 | op.add_option("--wepkey", dest="wepkey") | ||
| 244 | return op | ||
| 245 | |||
| 246 | def parse(self, args): | ||
| 247 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 248 | nd = self.handler.NetworkData() | ||
| 249 | self._setToObj(self.op, opts, nd) | ||
| 250 | nd.lineno = self.lineno | ||
| 251 | |||
| 252 | # Check for duplicates in the data list. | ||
| 253 | if nd in self.dataList(): | ||
| 254 | warnings.warn(_("A network device with the name %s has already been defined.") % nd.device) | ||
| 255 | |||
| 256 | return nd | ||
| 257 | |||
| 258 | def dataList(self): | ||
| 259 | return self.network | ||
| 260 | |||
| 261 | class FC4_Network(FC3_Network): | ||
| 262 | removedKeywords = FC3_Network.removedKeywords | ||
| 263 | removedAttrs = FC3_Network.removedAttrs | ||
| 264 | |||
| 265 | def _getParser(self): | ||
| 266 | op = FC3_Network._getParser(self) | ||
| 267 | op.add_option("--notksdevice", dest="notksdevice", action="store_true", | ||
| 268 | default=False) | ||
| 269 | return op | ||
| 270 | |||
| 271 | class FC6_Network(FC4_Network): | ||
| 272 | removedKeywords = FC4_Network.removedKeywords | ||
| 273 | removedAttrs = FC4_Network.removedAttrs | ||
| 274 | |||
| 275 | def _getParser(self): | ||
| 276 | op = FC4_Network._getParser(self) | ||
| 277 | op.add_option("--noipv4", dest="noipv4", action="store_true", | ||
| 278 | default=False) | ||
| 279 | op.add_option("--noipv6", dest="noipv6", action="store_true", | ||
| 280 | default=False) | ||
| 281 | return op | ||
| 282 | |||
| 283 | class F8_Network(FC6_Network): | ||
| 284 | removedKeywords = FC6_Network.removedKeywords | ||
| 285 | removedAttrs = FC6_Network.removedAttrs | ||
| 286 | |||
| 287 | def _getParser(self): | ||
| 288 | op = FC6_Network._getParser(self) | ||
| 289 | op.add_option("--ipv6", dest="ipv6") | ||
| 290 | return op | ||
| 291 | |||
| 292 | class F9_Network(F8_Network): | ||
| 293 | removedKeywords = F8_Network.removedKeywords | ||
| 294 | removedAttrs = F8_Network.removedAttrs | ||
| 295 | |||
| 296 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 297 | F8_Network.__init__(self, writePriority, *args, **kwargs) | ||
| 298 | self.bootprotoList.append(BOOTPROTO_QUERY) | ||
| 299 | |||
| 300 | def _getParser(self): | ||
| 301 | op = F8_Network._getParser(self) | ||
| 302 | op.add_option("--bootproto", dest="bootProto", | ||
| 303 | default=BOOTPROTO_DHCP, | ||
| 304 | choices=self.bootprotoList) | ||
| 305 | return op | ||
| 306 | |||
| 307 | class F16_Network(F9_Network): | ||
| 308 | removedKeywords = F9_Network.removedKeywords | ||
| 309 | removedAttrs = F9_Network.removedAttrs | ||
| 310 | |||
| 311 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 312 | F9_Network.__init__(self, writePriority, *args, **kwargs) | ||
| 313 | self.bootprotoList.append(BOOTPROTO_IBFT) | ||
| 314 | |||
| 315 | def _getParser(self): | ||
| 316 | op = F9_Network._getParser(self) | ||
| 317 | op.add_option("--activate", dest="activate", action="store_true", | ||
| 318 | default=False) | ||
| 319 | op.add_option("--nodefroute", dest="nodefroute", action="store_true", | ||
| 320 | default=False) | ||
| 321 | op.add_option("--wpakey", dest="wpakey", action="store", default="") | ||
| 322 | return op | ||
| 323 | |||
| 324 | class RHEL4_Network(FC3_Network): | ||
| 325 | removedKeywords = FC3_Network.removedKeywords | ||
| 326 | removedAttrs = FC3_Network.removedAttrs | ||
| 327 | |||
| 328 | def _getParser(self): | ||
| 329 | op = FC3_Network._getParser(self) | ||
| 330 | op.add_option("--notksdevice", dest="notksdevice", action="store_true", | ||
| 331 | default=False) | ||
| 332 | return op | ||
| 333 | |||
| 334 | class RHEL5_Network(FC6_Network): | ||
| 335 | removedKeywords = FC6_Network.removedKeywords | ||
| 336 | removedAttrs = FC6_Network.removedAttrs | ||
| 337 | |||
| 338 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 339 | FC6_Network.__init__(self, writePriority, *args, **kwargs) | ||
| 340 | self.bootprotoList.append(BOOTPROTO_QUERY) | ||
| 341 | |||
| 342 | def _getParser(self): | ||
| 343 | op = FC6_Network._getParser(self) | ||
| 344 | op.add_option("--bootproto", dest="bootProto", | ||
| 345 | default=BOOTPROTO_DHCP, | ||
| 346 | choices=self.bootprotoList) | ||
| 347 | return op | ||
| 348 | |||
| 349 | class RHEL6_Network(F9_Network): | ||
| 350 | removedKeywords = F9_Network.removedKeywords | ||
| 351 | removedAttrs = F9_Network.removedAttrs | ||
| 352 | |||
| 353 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 354 | F9_Network.__init__(self, writePriority, *args, **kwargs) | ||
| 355 | self.bootprotoList.append(BOOTPROTO_IBFT) | ||
| 356 | |||
| 357 | def _getParser(self): | ||
| 358 | op = F9_Network._getParser(self) | ||
| 359 | op.add_option("--activate", dest="activate", action="store_true", | ||
| 360 | default=False) | ||
| 361 | op.add_option("--nodefroute", dest="nodefroute", action="store_true", | ||
| 362 | default=False) | ||
| 363 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py b/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py new file mode 100644 index 0000000000..e65e012d02 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py | |||
| @@ -0,0 +1,353 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | import warnings | ||
| 26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 27 | |||
| 28 | class FC3_PartData(BaseData): | ||
| 29 | removedKeywords = BaseData.removedKeywords | ||
| 30 | removedAttrs = BaseData.removedAttrs | ||
| 31 | |||
| 32 | def __init__(self, *args, **kwargs): | ||
| 33 | BaseData.__init__(self, *args, **kwargs) | ||
| 34 | self.active = kwargs.get("active", False) | ||
| 35 | self.primOnly = kwargs.get("primOnly", False) | ||
| 36 | self.end = kwargs.get("end", 0) | ||
| 37 | self.fstype = kwargs.get("fstype", "") | ||
| 38 | self.grow = kwargs.get("grow", False) | ||
| 39 | self.maxSizeMB = kwargs.get("maxSizeMB", 0) | ||
| 40 | self.format = kwargs.get("format", True) | ||
| 41 | self.onbiosdisk = kwargs.get("onbiosdisk", "") | ||
| 42 | self.disk = kwargs.get("disk", "") | ||
| 43 | self.onPart = kwargs.get("onPart", "") | ||
| 44 | self.recommended = kwargs.get("recommended", False) | ||
| 45 | self.size = kwargs.get("size", None) | ||
| 46 | self.start = kwargs.get("start", 0) | ||
| 47 | self.mountpoint = kwargs.get("mountpoint", "") | ||
| 48 | |||
| 49 | def __eq__(self, y): | ||
| 50 | if self.mountpoint: | ||
| 51 | return self.mountpoint == y.mountpoint | ||
| 52 | else: | ||
| 53 | return False | ||
| 54 | |||
| 55 | def _getArgsAsStr(self): | ||
| 56 | retval = "" | ||
| 57 | |||
| 58 | if self.active: | ||
| 59 | retval += " --active" | ||
| 60 | if self.primOnly: | ||
| 61 | retval += " --asprimary" | ||
| 62 | if hasattr(self, "end") and self.end != 0: | ||
| 63 | retval += " --end=%s" % self.end | ||
| 64 | if self.fstype != "": | ||
| 65 | retval += " --fstype=\"%s\"" % self.fstype | ||
| 66 | if self.grow: | ||
| 67 | retval += " --grow" | ||
| 68 | if self.maxSizeMB > 0: | ||
| 69 | retval += " --maxsize=%d" % self.maxSizeMB | ||
| 70 | if not self.format: | ||
| 71 | retval += " --noformat" | ||
| 72 | if self.onbiosdisk != "": | ||
| 73 | retval += " --onbiosdisk=%s" % self.onbiosdisk | ||
| 74 | if self.disk != "": | ||
| 75 | retval += " --ondisk=%s" % self.disk | ||
| 76 | if self.onPart != "": | ||
| 77 | retval += " --onpart=%s" % self.onPart | ||
| 78 | if self.recommended: | ||
| 79 | retval += " --recommended" | ||
| 80 | if self.size and self.size != 0: | ||
| 81 | retval += " --size=%s" % self.size | ||
| 82 | if hasattr(self, "start") and self.start != 0: | ||
| 83 | retval += " --start=%s" % self.start | ||
| 84 | |||
| 85 | return retval | ||
| 86 | |||
| 87 | def __str__(self): | ||
| 88 | retval = BaseData.__str__(self) | ||
| 89 | if self.mountpoint: | ||
| 90 | mountpoint_str = "%s" % self.mountpoint | ||
| 91 | else: | ||
| 92 | mountpoint_str = "(No mount point)" | ||
| 93 | retval += "part %s%s\n" % (mountpoint_str, self._getArgsAsStr()) | ||
| 94 | return retval | ||
| 95 | |||
| 96 | class FC4_PartData(FC3_PartData): | ||
| 97 | removedKeywords = FC3_PartData.removedKeywords | ||
| 98 | removedAttrs = FC3_PartData.removedAttrs | ||
| 99 | |||
| 100 | def __init__(self, *args, **kwargs): | ||
| 101 | FC3_PartData.__init__(self, *args, **kwargs) | ||
| 102 | self.bytesPerInode = kwargs.get("bytesPerInode", 4096) | ||
| 103 | self.fsopts = kwargs.get("fsopts", "") | ||
| 104 | self.label = kwargs.get("label", "") | ||
| 105 | |||
| 106 | def _getArgsAsStr(self): | ||
| 107 | retval = FC3_PartData._getArgsAsStr(self) | ||
| 108 | |||
| 109 | if hasattr(self, "bytesPerInode") and self.bytesPerInode != 0: | ||
| 110 | retval += " --bytes-per-inode=%d" % self.bytesPerInode | ||
| 111 | if self.fsopts != "": | ||
| 112 | retval += " --fsoptions=\"%s\"" % self.fsopts | ||
| 113 | if self.label != "": | ||
| 114 | retval += " --label=%s" % self.label | ||
| 115 | |||
| 116 | return retval | ||
| 117 | |||
| 118 | class RHEL5_PartData(FC4_PartData): | ||
| 119 | removedKeywords = FC4_PartData.removedKeywords | ||
| 120 | removedAttrs = FC4_PartData.removedAttrs | ||
| 121 | |||
| 122 | def __init__(self, *args, **kwargs): | ||
| 123 | FC4_PartData.__init__(self, *args, **kwargs) | ||
| 124 | self.encrypted = kwargs.get("encrypted", False) | ||
| 125 | self.passphrase = kwargs.get("passphrase", "") | ||
| 126 | |||
| 127 | def _getArgsAsStr(self): | ||
| 128 | retval = FC4_PartData._getArgsAsStr(self) | ||
| 129 | |||
| 130 | if self.encrypted: | ||
| 131 | retval += " --encrypted" | ||
| 132 | |||
| 133 | if self.passphrase != "": | ||
| 134 | retval += " --passphrase=\"%s\"" % self.passphrase | ||
| 135 | |||
| 136 | return retval | ||
| 137 | |||
| 138 | class F9_PartData(FC4_PartData): | ||
| 139 | removedKeywords = FC4_PartData.removedKeywords + ["bytesPerInode"] | ||
| 140 | removedAttrs = FC4_PartData.removedAttrs + ["bytesPerInode"] | ||
| 141 | |||
| 142 | def __init__(self, *args, **kwargs): | ||
| 143 | FC4_PartData.__init__(self, *args, **kwargs) | ||
| 144 | self.deleteRemovedAttrs() | ||
| 145 | |||
| 146 | self.fsopts = kwargs.get("fsopts", "") | ||
| 147 | self.label = kwargs.get("label", "") | ||
| 148 | self.fsprofile = kwargs.get("fsprofile", "") | ||
| 149 | self.encrypted = kwargs.get("encrypted", False) | ||
| 150 | self.passphrase = kwargs.get("passphrase", "") | ||
| 151 | |||
| 152 | def _getArgsAsStr(self): | ||
| 153 | retval = FC4_PartData._getArgsAsStr(self) | ||
| 154 | |||
| 155 | if self.fsprofile != "": | ||
| 156 | retval += " --fsprofile=\"%s\"" % self.fsprofile | ||
| 157 | if self.encrypted: | ||
| 158 | retval += " --encrypted" | ||
| 159 | |||
| 160 | if self.passphrase != "": | ||
| 161 | retval += " --passphrase=\"%s\"" % self.passphrase | ||
| 162 | |||
| 163 | return retval | ||
| 164 | |||
| 165 | class F11_PartData(F9_PartData): | ||
| 166 | removedKeywords = F9_PartData.removedKeywords + ["start", "end"] | ||
| 167 | removedAttrs = F9_PartData.removedAttrs + ["start", "end"] | ||
| 168 | |||
| 169 | class F12_PartData(F11_PartData): | ||
| 170 | removedKeywords = F11_PartData.removedKeywords | ||
| 171 | removedAttrs = F11_PartData.removedAttrs | ||
| 172 | |||
| 173 | def __init__(self, *args, **kwargs): | ||
| 174 | F11_PartData.__init__(self, *args, **kwargs) | ||
| 175 | |||
| 176 | self.escrowcert = kwargs.get("escrowcert", "") | ||
| 177 | self.backuppassphrase = kwargs.get("backuppassphrase", False) | ||
| 178 | |||
| 179 | def _getArgsAsStr(self): | ||
| 180 | retval = F11_PartData._getArgsAsStr(self) | ||
| 181 | |||
| 182 | if self.encrypted and self.escrowcert != "": | ||
| 183 | retval += " --escrowcert=\"%s\"" % self.escrowcert | ||
| 184 | |||
| 185 | if self.backuppassphrase: | ||
| 186 | retval += " --backuppassphrase" | ||
| 187 | |||
| 188 | return retval | ||
| 189 | |||
| 190 | F14_PartData = F12_PartData | ||
| 191 | |||
| 192 | class FC3_Partition(KickstartCommand): | ||
| 193 | removedKeywords = KickstartCommand.removedKeywords | ||
| 194 | removedAttrs = KickstartCommand.removedAttrs | ||
| 195 | |||
| 196 | def __init__(self, writePriority=130, *args, **kwargs): | ||
| 197 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 198 | self.op = self._getParser() | ||
| 199 | |||
| 200 | self.partitions = kwargs.get("partitions", []) | ||
| 201 | |||
| 202 | def __str__(self): | ||
| 203 | retval = "" | ||
| 204 | |||
| 205 | for part in self.partitions: | ||
| 206 | retval += part.__str__() | ||
| 207 | |||
| 208 | if retval != "": | ||
| 209 | return "# Disk partitioning information\n" + retval | ||
| 210 | else: | ||
| 211 | return "" | ||
| 212 | |||
| 213 | def _getParser(self): | ||
| 214 | def part_cb (option, opt_str, value, parser): | ||
| 215 | if value.startswith("/dev/"): | ||
| 216 | parser.values.ensure_value(option.dest, value[5:]) | ||
| 217 | else: | ||
| 218 | parser.values.ensure_value(option.dest, value) | ||
| 219 | |||
| 220 | op = KSOptionParser() | ||
| 221 | op.add_option("--active", dest="active", action="store_true", | ||
| 222 | default=False) | ||
| 223 | op.add_option("--asprimary", dest="primOnly", action="store_true", | ||
| 224 | default=False) | ||
| 225 | op.add_option("--end", dest="end", action="store", type="int", | ||
| 226 | nargs=1) | ||
| 227 | op.add_option("--fstype", "--type", dest="fstype") | ||
| 228 | op.add_option("--grow", dest="grow", action="store_true", default=False) | ||
| 229 | op.add_option("--maxsize", dest="maxSizeMB", action="store", type="int", | ||
| 230 | nargs=1) | ||
| 231 | op.add_option("--noformat", dest="format", action="store_false", | ||
| 232 | default=True) | ||
| 233 | op.add_option("--onbiosdisk", dest="onbiosdisk") | ||
| 234 | op.add_option("--ondisk", "--ondrive", dest="disk") | ||
| 235 | op.add_option("--onpart", "--usepart", dest="onPart", action="callback", | ||
| 236 | callback=part_cb, nargs=1, type="string") | ||
| 237 | op.add_option("--recommended", dest="recommended", action="store_true", | ||
| 238 | default=False) | ||
| 239 | op.add_option("--size", dest="size", action="store", type="int", | ||
| 240 | nargs=1) | ||
| 241 | op.add_option("--start", dest="start", action="store", type="int", | ||
| 242 | nargs=1) | ||
| 243 | return op | ||
| 244 | |||
| 245 | def parse(self, args): | ||
| 246 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 247 | |||
| 248 | pd = self.handler.PartData() | ||
| 249 | self._setToObj(self.op, opts, pd) | ||
| 250 | pd.lineno = self.lineno | ||
| 251 | if extra: | ||
| 252 | pd.mountpoint = extra[0] | ||
| 253 | if pd in self.dataList(): | ||
| 254 | warnings.warn(_("A partition with the mountpoint %s has already been defined.") % pd.mountpoint) | ||
| 255 | else: | ||
| 256 | pd.mountpoint = None | ||
| 257 | |||
| 258 | return pd | ||
| 259 | |||
| 260 | def dataList(self): | ||
| 261 | return self.partitions | ||
| 262 | |||
| 263 | class FC4_Partition(FC3_Partition): | ||
| 264 | removedKeywords = FC3_Partition.removedKeywords | ||
| 265 | removedAttrs = FC3_Partition.removedAttrs | ||
| 266 | |||
| 267 | def __init__(self, writePriority=130, *args, **kwargs): | ||
| 268 | FC3_Partition.__init__(self, writePriority, *args, **kwargs) | ||
| 269 | |||
| 270 | def part_cb (option, opt_str, value, parser): | ||
| 271 | if value.startswith("/dev/"): | ||
| 272 | parser.values.ensure_value(option.dest, value[5:]) | ||
| 273 | else: | ||
| 274 | parser.values.ensure_value(option.dest, value) | ||
| 275 | |||
| 276 | def _getParser(self): | ||
| 277 | op = FC3_Partition._getParser(self) | ||
| 278 | op.add_option("--bytes-per-inode", dest="bytesPerInode", action="store", | ||
| 279 | type="int", nargs=1) | ||
| 280 | op.add_option("--fsoptions", dest="fsopts") | ||
| 281 | op.add_option("--label", dest="label") | ||
| 282 | return op | ||
| 283 | |||
| 284 | class RHEL5_Partition(FC4_Partition): | ||
| 285 | removedKeywords = FC4_Partition.removedKeywords | ||
| 286 | removedAttrs = FC4_Partition.removedAttrs | ||
| 287 | |||
| 288 | def __init__(self, writePriority=130, *args, **kwargs): | ||
| 289 | FC4_Partition.__init__(self, writePriority, *args, **kwargs) | ||
| 290 | |||
| 291 | def part_cb (option, opt_str, value, parser): | ||
| 292 | if value.startswith("/dev/"): | ||
| 293 | parser.values.ensure_value(option.dest, value[5:]) | ||
| 294 | else: | ||
| 295 | parser.values.ensure_value(option.dest, value) | ||
| 296 | |||
| 297 | def _getParser(self): | ||
| 298 | op = FC4_Partition._getParser(self) | ||
| 299 | op.add_option("--encrypted", action="store_true", default=False) | ||
| 300 | op.add_option("--passphrase") | ||
| 301 | return op | ||
| 302 | |||
| 303 | class F9_Partition(FC4_Partition): | ||
| 304 | removedKeywords = FC4_Partition.removedKeywords | ||
| 305 | removedAttrs = FC4_Partition.removedAttrs | ||
| 306 | |||
| 307 | def __init__(self, writePriority=130, *args, **kwargs): | ||
| 308 | FC4_Partition.__init__(self, writePriority, *args, **kwargs) | ||
| 309 | |||
| 310 | def part_cb (option, opt_str, value, parser): | ||
| 311 | if value.startswith("/dev/"): | ||
| 312 | parser.values.ensure_value(option.dest, value[5:]) | ||
| 313 | else: | ||
| 314 | parser.values.ensure_value(option.dest, value) | ||
| 315 | |||
| 316 | def _getParser(self): | ||
| 317 | op = FC4_Partition._getParser(self) | ||
| 318 | op.add_option("--bytes-per-inode", deprecated=1) | ||
| 319 | op.add_option("--fsprofile") | ||
| 320 | op.add_option("--encrypted", action="store_true", default=False) | ||
| 321 | op.add_option("--passphrase") | ||
| 322 | return op | ||
| 323 | |||
| 324 | class F11_Partition(F9_Partition): | ||
| 325 | removedKeywords = F9_Partition.removedKeywords | ||
| 326 | removedAttrs = F9_Partition.removedAttrs | ||
| 327 | |||
| 328 | def _getParser(self): | ||
| 329 | op = F9_Partition._getParser(self) | ||
| 330 | op.add_option("--start", deprecated=1) | ||
| 331 | op.add_option("--end", deprecated=1) | ||
| 332 | return op | ||
| 333 | |||
| 334 | class F12_Partition(F11_Partition): | ||
| 335 | removedKeywords = F11_Partition.removedKeywords | ||
| 336 | removedAttrs = F11_Partition.removedAttrs | ||
| 337 | |||
| 338 | def _getParser(self): | ||
| 339 | op = F11_Partition._getParser(self) | ||
| 340 | op.add_option("--escrowcert") | ||
| 341 | op.add_option("--backuppassphrase", action="store_true", default=False) | ||
| 342 | return op | ||
| 343 | |||
| 344 | class F14_Partition(F12_Partition): | ||
| 345 | removedKeywords = F12_Partition.removedKeywords | ||
| 346 | removedAttrs = F12_Partition.removedAttrs | ||
| 347 | |||
| 348 | def _getParser(self): | ||
| 349 | op = F12_Partition._getParser(self) | ||
| 350 | op.remove_option("--bytes-per-inode") | ||
| 351 | op.remove_option("--start") | ||
| 352 | op.remove_option("--end") | ||
| 353 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/raid.py b/scripts/lib/mic/3rdparty/pykickstart/commands/raid.py new file mode 100644 index 0000000000..0f4c92a107 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/raid.py | |||
| @@ -0,0 +1,365 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008, 2011 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | import warnings | ||
| 26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 27 | |||
| 28 | class FC3_RaidData(BaseData): | ||
| 29 | removedKeywords = BaseData.removedKeywords | ||
| 30 | removedAttrs = BaseData.removedAttrs | ||
| 31 | |||
| 32 | def __init__(self, *args, **kwargs): | ||
| 33 | BaseData.__init__(self, *args, **kwargs) | ||
| 34 | self.device = kwargs.get("device", None) | ||
| 35 | self.fstype = kwargs.get("fstype", "") | ||
| 36 | self.level = kwargs.get("level", "") | ||
| 37 | self.format = kwargs.get("format", True) | ||
| 38 | self.spares = kwargs.get("spares", 0) | ||
| 39 | self.preexist = kwargs.get("preexist", False) | ||
| 40 | self.mountpoint = kwargs.get("mountpoint", "") | ||
| 41 | self.members = kwargs.get("members", []) | ||
| 42 | |||
| 43 | def __eq__(self, y): | ||
| 44 | return self.device == y.device | ||
| 45 | |||
| 46 | def _getArgsAsStr(self): | ||
| 47 | retval = "" | ||
| 48 | |||
| 49 | if self.device != "": | ||
| 50 | retval += " --device=%s" % self.device | ||
| 51 | if self.fstype != "": | ||
| 52 | retval += " --fstype=\"%s\"" % self.fstype | ||
| 53 | if self.level != "": | ||
| 54 | retval += " --level=%s" % self.level | ||
| 55 | if not self.format: | ||
| 56 | retval += " --noformat" | ||
| 57 | if self.spares != 0: | ||
| 58 | retval += " --spares=%d" % self.spares | ||
| 59 | if self.preexist: | ||
| 60 | retval += " --useexisting" | ||
| 61 | |||
| 62 | return retval | ||
| 63 | |||
| 64 | def __str__(self): | ||
| 65 | retval = BaseData.__str__(self) | ||
| 66 | retval += "raid %s%s %s\n" % (self.mountpoint, self._getArgsAsStr(), | ||
| 67 | " ".join(self.members)) | ||
| 68 | return retval | ||
| 69 | |||
| 70 | class FC4_RaidData(FC3_RaidData): | ||
| 71 | removedKeywords = FC3_RaidData.removedKeywords | ||
| 72 | removedAttrs = FC3_RaidData.removedAttrs | ||
| 73 | |||
| 74 | def __init__(self, *args, **kwargs): | ||
| 75 | FC3_RaidData.__init__(self, *args, **kwargs) | ||
| 76 | self.fsopts = kwargs.get("fsopts", "") | ||
| 77 | |||
| 78 | def _getArgsAsStr(self): | ||
| 79 | retval = FC3_RaidData._getArgsAsStr(self) | ||
| 80 | |||
| 81 | if self.fsopts != "": | ||
| 82 | retval += " --fsoptions=\"%s\"" % self.fsopts | ||
| 83 | |||
| 84 | return retval | ||
| 85 | |||
| 86 | class FC5_RaidData(FC4_RaidData): | ||
| 87 | removedKeywords = FC4_RaidData.removedKeywords | ||
| 88 | removedAttrs = FC4_RaidData.removedAttrs | ||
| 89 | |||
| 90 | def __init__(self, *args, **kwargs): | ||
| 91 | FC4_RaidData.__init__(self, *args, **kwargs) | ||
| 92 | self.bytesPerInode = kwargs.get("bytesPerInode", 4096) | ||
| 93 | |||
| 94 | def _getArgsAsStr(self): | ||
| 95 | retval = FC4_RaidData._getArgsAsStr(self) | ||
| 96 | |||
| 97 | if hasattr(self, "bytesPerInode") and self.bytesPerInode != 0: | ||
| 98 | retval += " --bytes-per-inode=%d" % self.bytesPerInode | ||
| 99 | |||
| 100 | return retval | ||
| 101 | |||
| 102 | class RHEL5_RaidData(FC5_RaidData): | ||
| 103 | removedKeywords = FC5_RaidData.removedKeywords | ||
| 104 | removedAttrs = FC5_RaidData.removedAttrs | ||
| 105 | |||
| 106 | def __init__(self, *args, **kwargs): | ||
| 107 | FC5_RaidData.__init__(self, *args, **kwargs) | ||
| 108 | self.encrypted = kwargs.get("encrypted", False) | ||
| 109 | self.passphrase = kwargs.get("passphrase", "") | ||
| 110 | |||
| 111 | def _getArgsAsStr(self): | ||
| 112 | retval = FC5_RaidData._getArgsAsStr(self) | ||
| 113 | |||
| 114 | if self.encrypted: | ||
| 115 | retval += " --encrypted" | ||
| 116 | |||
| 117 | if self.passphrase != "": | ||
| 118 | retval += " --passphrase=\"%s\"" % self.passphrase | ||
| 119 | |||
| 120 | return retval | ||
| 121 | |||
| 122 | F7_RaidData = FC5_RaidData | ||
| 123 | |||
| 124 | class F9_RaidData(FC5_RaidData): | ||
| 125 | removedKeywords = FC5_RaidData.removedKeywords + ["bytesPerInode"] | ||
| 126 | removedAttrs = FC5_RaidData.removedAttrs + ["bytesPerInode"] | ||
| 127 | |||
| 128 | def __init__(self, *args, **kwargs): | ||
| 129 | FC5_RaidData.__init__(self, *args, **kwargs) | ||
| 130 | self.deleteRemovedAttrs() | ||
| 131 | |||
| 132 | self.fsprofile = kwargs.get("fsprofile", "") | ||
| 133 | self.encrypted = kwargs.get("encrypted", False) | ||
| 134 | self.passphrase = kwargs.get("passphrase", "") | ||
| 135 | |||
| 136 | def _getArgsAsStr(self): | ||
| 137 | retval = FC5_RaidData._getArgsAsStr(self) | ||
| 138 | |||
| 139 | if self.fsprofile != "": | ||
| 140 | retval += " --fsprofile=\"%s\"" % self.fsprofile | ||
| 141 | if self.encrypted: | ||
| 142 | retval += " --encrypted" | ||
| 143 | |||
| 144 | if self.passphrase != "": | ||
| 145 | retval += " --passphrase=\"%s\"" % self.passphrase | ||
| 146 | |||
| 147 | return retval | ||
| 148 | |||
| 149 | class F12_RaidData(F9_RaidData): | ||
| 150 | removedKeywords = F9_RaidData.removedKeywords | ||
| 151 | removedAttrs = F9_RaidData.removedAttrs | ||
| 152 | |||
| 153 | def __init__(self, *args, **kwargs): | ||
| 154 | F9_RaidData.__init__(self, *args, **kwargs) | ||
| 155 | self.deleteRemovedAttrs() | ||
| 156 | |||
| 157 | self.escrowcert = kwargs.get("escrowcert", "") | ||
| 158 | self.backuppassphrase = kwargs.get("backuppassphrase", False) | ||
| 159 | |||
| 160 | def _getArgsAsStr(self): | ||
| 161 | retval = F9_RaidData._getArgsAsStr(self) | ||
| 162 | |||
| 163 | if self.encrypted and self.escrowcert != "": | ||
| 164 | retval += " --escrowcert=\"%s\"" % self.escrowcert | ||
| 165 | |||
| 166 | if self.backuppassphrase: | ||
| 167 | retval += " --backuppassphrase" | ||
| 168 | return retval | ||
| 169 | |||
| 170 | F13_RaidData = F12_RaidData | ||
| 171 | |||
| 172 | F14_RaidData = F13_RaidData | ||
| 173 | |||
| 174 | class F15_RaidData(F14_RaidData): | ||
| 175 | removedKeywords = F14_RaidData.removedKeywords | ||
| 176 | removedAttrs = F14_RaidData.removedAttrs | ||
| 177 | |||
| 178 | def __init__(self, *args, **kwargs): | ||
| 179 | F14_RaidData.__init__(self, *args, **kwargs) | ||
| 180 | self.deleteRemovedAttrs() | ||
| 181 | |||
| 182 | self.label = kwargs.get("label", "") | ||
| 183 | |||
| 184 | def _getArgsAsStr(self): | ||
| 185 | retval = F14_RaidData._getArgsAsStr(self) | ||
| 186 | |||
| 187 | if self.label != "": | ||
| 188 | retval += " --label=%s" % self.label | ||
| 189 | |||
| 190 | return retval | ||
| 191 | |||
| 192 | class FC3_Raid(KickstartCommand): | ||
| 193 | removedKeywords = KickstartCommand.removedKeywords | ||
| 194 | removedAttrs = KickstartCommand.removedAttrs | ||
| 195 | |||
| 196 | def __init__(self, writePriority=131, *args, **kwargs): | ||
| 197 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 198 | self.op = self._getParser() | ||
| 199 | |||
| 200 | # A dict of all the RAID levels we support. This means that if we | ||
| 201 | # support more levels in the future, subclasses don't have to | ||
| 202 | # duplicate too much. | ||
| 203 | self.levelMap = { "RAID0": "RAID0", "0": "RAID0", | ||
| 204 | "RAID1": "RAID1", "1": "RAID1", | ||
| 205 | "RAID5": "RAID5", "5": "RAID5", | ||
| 206 | "RAID6": "RAID6", "6": "RAID6" } | ||
| 207 | |||
| 208 | self.raidList = kwargs.get("raidList", []) | ||
| 209 | |||
| 210 | def __str__(self): | ||
| 211 | retval = "" | ||
| 212 | |||
| 213 | for raid in self.raidList: | ||
| 214 | retval += raid.__str__() | ||
| 215 | |||
| 216 | return retval | ||
| 217 | |||
| 218 | def _getParser(self): | ||
| 219 | def raid_cb (option, opt_str, value, parser): | ||
| 220 | parser.values.format = False | ||
| 221 | parser.values.preexist = True | ||
| 222 | |||
| 223 | def device_cb (option, opt_str, value, parser): | ||
| 224 | if value[0:2] == "md": | ||
| 225 | parser.values.ensure_value(option.dest, value[2:]) | ||
| 226 | else: | ||
| 227 | parser.values.ensure_value(option.dest, value) | ||
| 228 | |||
| 229 | def level_cb (option, opt_str, value, parser): | ||
| 230 | if self.levelMap.has_key(value): | ||
| 231 | parser.values.ensure_value(option.dest, self.levelMap[value]) | ||
| 232 | |||
| 233 | op = KSOptionParser() | ||
| 234 | op.add_option("--device", action="callback", callback=device_cb, | ||
| 235 | dest="device", type="string", nargs=1, required=1) | ||
| 236 | op.add_option("--fstype", dest="fstype") | ||
| 237 | op.add_option("--level", dest="level", action="callback", | ||
| 238 | callback=level_cb, type="string", nargs=1) | ||
| 239 | op.add_option("--noformat", action="callback", callback=raid_cb, | ||
| 240 | dest="format", default=True, nargs=0) | ||
| 241 | op.add_option("--spares", dest="spares", action="store", type="int", | ||
| 242 | nargs=1, default=0) | ||
| 243 | op.add_option("--useexisting", dest="preexist", action="store_true", | ||
| 244 | default=False) | ||
| 245 | return op | ||
| 246 | |||
| 247 | def parse(self, args): | ||
| 248 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 249 | |||
| 250 | if len(extra) == 0: | ||
| 251 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Mount point required for %s") % "raid") | ||
| 252 | if len(extra) == 1: | ||
| 253 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Partitions required for %s") % "raid") | ||
| 254 | |||
| 255 | rd = self.handler.RaidData() | ||
| 256 | self._setToObj(self.op, opts, rd) | ||
| 257 | rd.lineno = self.lineno | ||
| 258 | |||
| 259 | # --device can't just take an int in the callback above, because it | ||
| 260 | # could be specificed as "mdX", which causes optparse to error when | ||
| 261 | # it runs int(). | ||
| 262 | rd.device = int(rd.device) | ||
| 263 | rd.mountpoint = extra[0] | ||
| 264 | rd.members = extra[1:] | ||
| 265 | |||
| 266 | # Check for duplicates in the data list. | ||
| 267 | if rd in self.dataList(): | ||
| 268 | warnings.warn(_("A RAID device with the name %s has already been defined.") % rd.device) | ||
| 269 | |||
| 270 | return rd | ||
| 271 | |||
| 272 | def dataList(self): | ||
| 273 | return self.raidList | ||
| 274 | |||
| 275 | class FC4_Raid(FC3_Raid): | ||
| 276 | removedKeywords = FC3_Raid.removedKeywords | ||
| 277 | removedAttrs = FC3_Raid.removedAttrs | ||
| 278 | |||
| 279 | def _getParser(self): | ||
| 280 | op = FC3_Raid._getParser(self) | ||
| 281 | op.add_option("--fsoptions", dest="fsopts") | ||
| 282 | return op | ||
| 283 | |||
| 284 | class FC5_Raid(FC4_Raid): | ||
| 285 | removedKeywords = FC4_Raid.removedKeywords | ||
| 286 | removedAttrs = FC4_Raid.removedAttrs | ||
| 287 | |||
| 288 | def _getParser(self): | ||
| 289 | op = FC4_Raid._getParser(self) | ||
| 290 | op.add_option("--bytes-per-inode", dest="bytesPerInode", action="store", | ||
| 291 | type="int", nargs=1) | ||
| 292 | return op | ||
| 293 | |||
| 294 | class RHEL5_Raid(FC5_Raid): | ||
| 295 | removedKeywords = FC5_Raid.removedKeywords | ||
| 296 | removedAttrs = FC5_Raid.removedAttrs | ||
| 297 | |||
| 298 | def __init__(self, writePriority=131, *args, **kwargs): | ||
| 299 | FC5_Raid.__init__(self, writePriority, *args, **kwargs) | ||
| 300 | |||
| 301 | self.levelMap.update({"RAID10": "RAID10", "10": "RAID10"}) | ||
| 302 | |||
| 303 | def _getParser(self): | ||
| 304 | op = FC5_Raid._getParser(self) | ||
| 305 | op.add_option("--encrypted", action="store_true", default=False) | ||
| 306 | op.add_option("--passphrase") | ||
| 307 | return op | ||
| 308 | |||
| 309 | class F7_Raid(FC5_Raid): | ||
| 310 | removedKeywords = FC5_Raid.removedKeywords | ||
| 311 | removedAttrs = FC5_Raid.removedAttrs | ||
| 312 | |||
| 313 | def __init__(self, writePriority=131, *args, **kwargs): | ||
| 314 | FC5_Raid.__init__(self, writePriority, *args, **kwargs) | ||
| 315 | |||
| 316 | self.levelMap.update({"RAID10": "RAID10", "10": "RAID10"}) | ||
| 317 | |||
| 318 | class F9_Raid(F7_Raid): | ||
| 319 | removedKeywords = F7_Raid.removedKeywords | ||
| 320 | removedAttrs = F7_Raid.removedAttrs | ||
| 321 | |||
| 322 | def _getParser(self): | ||
| 323 | op = F7_Raid._getParser(self) | ||
| 324 | op.add_option("--bytes-per-inode", deprecated=1) | ||
| 325 | op.add_option("--fsprofile") | ||
| 326 | op.add_option("--encrypted", action="store_true", default=False) | ||
| 327 | op.add_option("--passphrase") | ||
| 328 | return op | ||
| 329 | |||
| 330 | class F12_Raid(F9_Raid): | ||
| 331 | removedKeywords = F9_Raid.removedKeywords | ||
| 332 | removedAttrs = F9_Raid.removedAttrs | ||
| 333 | |||
| 334 | def _getParser(self): | ||
| 335 | op = F9_Raid._getParser(self) | ||
| 336 | op.add_option("--escrowcert") | ||
| 337 | op.add_option("--backuppassphrase", action="store_true", default=False) | ||
| 338 | return op | ||
| 339 | |||
| 340 | class F13_Raid(F12_Raid): | ||
| 341 | removedKeywords = F12_Raid.removedKeywords | ||
| 342 | removedAttrs = F12_Raid.removedAttrs | ||
| 343 | |||
| 344 | def __init__(self, writePriority=131, *args, **kwargs): | ||
| 345 | F12_Raid.__init__(self, writePriority, *args, **kwargs) | ||
| 346 | |||
| 347 | self.levelMap.update({"RAID4": "RAID4", "4": "RAID4"}) | ||
| 348 | |||
| 349 | class F14_Raid(F13_Raid): | ||
| 350 | removedKeywords = F13_Raid.removedKeywords | ||
| 351 | removedAttrs = F13_Raid.removedAttrs | ||
| 352 | |||
| 353 | def _getParser(self): | ||
| 354 | op = F13_Raid._getParser(self) | ||
| 355 | op.remove_option("--bytes-per-inode") | ||
| 356 | return op | ||
| 357 | |||
| 358 | class F15_Raid(F14_Raid): | ||
| 359 | removedKeywords = F14_Raid.removedKeywords | ||
| 360 | removedAttrs = F14_Raid.removedAttrs | ||
| 361 | |||
| 362 | def _getParser(self): | ||
| 363 | op = F14_Raid._getParser(self) | ||
| 364 | op.add_option("--label") | ||
| 365 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py b/scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py new file mode 100644 index 0000000000..391af14c22 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | class FC3_Reboot(KickstartCommand): | ||
| 26 | removedKeywords = KickstartCommand.removedKeywords | ||
| 27 | removedAttrs = KickstartCommand.removedAttrs | ||
| 28 | |||
| 29 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 30 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 31 | self.action = kwargs.get("action", None) | ||
| 32 | |||
| 33 | def __str__(self): | ||
| 34 | retval = KickstartCommand.__str__(self) | ||
| 35 | |||
| 36 | if self.action == KS_REBOOT: | ||
| 37 | retval += "# Reboot after installation\nreboot\n" | ||
| 38 | elif self.action == KS_SHUTDOWN: | ||
| 39 | retval += "# Shutdown after installation\nshutdown\n" | ||
| 40 | |||
| 41 | return retval | ||
| 42 | |||
| 43 | def parse(self, args): | ||
| 44 | if self.currentCmd == "reboot": | ||
| 45 | self.action = KS_REBOOT | ||
| 46 | else: | ||
| 47 | self.action = KS_SHUTDOWN | ||
| 48 | |||
| 49 | return self | ||
| 50 | |||
| 51 | class FC6_Reboot(FC3_Reboot): | ||
| 52 | removedKeywords = FC3_Reboot.removedKeywords | ||
| 53 | removedAttrs = FC3_Reboot.removedAttrs | ||
| 54 | |||
| 55 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 56 | FC3_Reboot.__init__(self, writePriority, *args, **kwargs) | ||
| 57 | self.op = self._getParser() | ||
| 58 | |||
| 59 | self.eject = kwargs.get("eject", False) | ||
| 60 | |||
| 61 | def __str__(self): | ||
| 62 | retval = FC3_Reboot.__str__(self).rstrip() | ||
| 63 | |||
| 64 | if self.eject: | ||
| 65 | retval += " --eject" | ||
| 66 | |||
| 67 | return retval + "\n" | ||
| 68 | |||
| 69 | def _getParser(self): | ||
| 70 | op = KSOptionParser() | ||
| 71 | op.add_option("--eject", dest="eject", action="store_true", | ||
| 72 | default=False) | ||
| 73 | return op | ||
| 74 | |||
| 75 | def parse(self, args): | ||
| 76 | FC3_Reboot.parse(self, args) | ||
| 77 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 78 | self._setToSelf(self.op, opts) | ||
| 79 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/repo.py b/scripts/lib/mic/3rdparty/pykickstart/commands/repo.py new file mode 100644 index 0000000000..543ef947c1 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/repo.py | |||
| @@ -0,0 +1,249 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007, 2008, 2009 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | import warnings | ||
| 27 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 28 | |||
| 29 | class FC6_RepoData(BaseData): | ||
| 30 | removedKeywords = BaseData.removedKeywords | ||
| 31 | removedAttrs = BaseData.removedAttrs | ||
| 32 | |||
| 33 | def __init__(self, *args, **kwargs): | ||
| 34 | BaseData.__init__(self, *args, **kwargs) | ||
| 35 | self.baseurl = kwargs.get("baseurl", "") | ||
| 36 | self.mirrorlist = kwargs.get("mirrorlist", None) | ||
| 37 | self.name = kwargs.get("name", "") | ||
| 38 | |||
| 39 | def __eq__(self, y): | ||
| 40 | return self.name == y.name | ||
| 41 | |||
| 42 | def _getArgsAsStr(self): | ||
| 43 | retval = "" | ||
| 44 | |||
| 45 | if self.baseurl: | ||
| 46 | retval += "--baseurl=%s" % self.baseurl | ||
| 47 | elif self.mirrorlist: | ||
| 48 | retval += "--mirrorlist=%s" % self.mirrorlist | ||
| 49 | |||
| 50 | return retval | ||
| 51 | |||
| 52 | def __str__(self): | ||
| 53 | retval = BaseData.__str__(self) | ||
| 54 | retval += "repo --name=\"%s\" %s\n" % (self.name, self._getArgsAsStr()) | ||
| 55 | return retval | ||
| 56 | |||
| 57 | class F8_RepoData(FC6_RepoData): | ||
| 58 | removedKeywords = FC6_RepoData.removedKeywords | ||
| 59 | removedAttrs = FC6_RepoData.removedAttrs | ||
| 60 | |||
| 61 | def __init__(self, *args, **kwargs): | ||
| 62 | FC6_RepoData.__init__(self, *args, **kwargs) | ||
| 63 | self.cost = kwargs.get("cost", None) | ||
| 64 | self.includepkgs = kwargs.get("includepkgs", []) | ||
| 65 | self.excludepkgs = kwargs.get("excludepkgs", []) | ||
| 66 | |||
| 67 | def _getArgsAsStr(self): | ||
| 68 | retval = FC6_RepoData._getArgsAsStr(self) | ||
| 69 | |||
| 70 | if self.cost: | ||
| 71 | retval += " --cost=%s" % self.cost | ||
| 72 | if self.includepkgs: | ||
| 73 | retval += " --includepkgs=\"%s\"" % ",".join(self.includepkgs) | ||
| 74 | if self.excludepkgs: | ||
| 75 | retval += " --excludepkgs=\"%s\"" % ",".join(self.excludepkgs) | ||
| 76 | |||
| 77 | return retval | ||
| 78 | |||
| 79 | class F11_RepoData(F8_RepoData): | ||
| 80 | removedKeywords = F8_RepoData.removedKeywords | ||
| 81 | removedAttrs = F8_RepoData.removedAttrs | ||
| 82 | |||
| 83 | def __init__(self, *args, **kwargs): | ||
| 84 | F8_RepoData.__init__(self, *args, **kwargs) | ||
| 85 | self.ignoregroups = kwargs.get("ignoregroups", None) | ||
| 86 | |||
| 87 | def _getArgsAsStr(self): | ||
| 88 | retval = F8_RepoData._getArgsAsStr(self) | ||
| 89 | |||
| 90 | if self.ignoregroups: | ||
| 91 | retval += " --ignoregroups=true" | ||
| 92 | return retval | ||
| 93 | |||
| 94 | class F13_RepoData(F11_RepoData): | ||
| 95 | removedKeywords = F11_RepoData.removedKeywords | ||
| 96 | removedAttrs = F11_RepoData.removedAttrs | ||
| 97 | |||
| 98 | def __init__(self, *args, **kwargs): | ||
| 99 | F11_RepoData.__init__(self, *args, **kwargs) | ||
| 100 | self.proxy = kwargs.get("proxy", "") | ||
| 101 | |||
| 102 | def _getArgsAsStr(self): | ||
| 103 | retval = F11_RepoData._getArgsAsStr(self) | ||
| 104 | |||
| 105 | if self.proxy: | ||
| 106 | retval += " --proxy=\"%s\"" % self.proxy | ||
| 107 | |||
| 108 | return retval | ||
| 109 | |||
| 110 | class F14_RepoData(F13_RepoData): | ||
| 111 | removedKeywords = F13_RepoData.removedKeywords | ||
| 112 | removedAttrs = F13_RepoData.removedAttrs | ||
| 113 | |||
| 114 | def __init__(self, *args, **kwargs): | ||
| 115 | F13_RepoData.__init__(self, *args, **kwargs) | ||
| 116 | self.noverifyssl = kwargs.get("noverifyssl", False) | ||
| 117 | |||
| 118 | def _getArgsAsStr(self): | ||
| 119 | retval = F13_RepoData._getArgsAsStr(self) | ||
| 120 | |||
| 121 | if self.noverifyssl: | ||
| 122 | retval += " --noverifyssl" | ||
| 123 | |||
| 124 | return retval | ||
| 125 | |||
| 126 | RHEL6_RepoData = F14_RepoData | ||
| 127 | |||
| 128 | F15_RepoData = F14_RepoData | ||
| 129 | |||
| 130 | class FC6_Repo(KickstartCommand): | ||
| 131 | removedKeywords = KickstartCommand.removedKeywords | ||
| 132 | removedAttrs = KickstartCommand.removedAttrs | ||
| 133 | |||
| 134 | urlRequired = True | ||
| 135 | |||
| 136 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 137 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 138 | self.op = self._getParser() | ||
| 139 | |||
| 140 | self.repoList = kwargs.get("repoList", []) | ||
| 141 | |||
| 142 | def __str__(self): | ||
| 143 | retval = "" | ||
| 144 | for repo in self.repoList: | ||
| 145 | retval += repo.__str__() | ||
| 146 | |||
| 147 | return retval | ||
| 148 | |||
| 149 | def _getParser(self): | ||
| 150 | op = KSOptionParser() | ||
| 151 | op.add_option("--name", dest="name", required=1) | ||
| 152 | op.add_option("--baseurl") | ||
| 153 | op.add_option("--mirrorlist") | ||
| 154 | return op | ||
| 155 | |||
| 156 | def parse(self, args): | ||
| 157 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 158 | |||
| 159 | if len(extra) != 0: | ||
| 160 | mapping = {"command": "repo", "options": extra} | ||
| 161 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping) | ||
| 162 | |||
| 163 | # This is lame, but I can't think of a better way to make sure only | ||
| 164 | # one of these two is specified. | ||
| 165 | if opts.baseurl and opts.mirrorlist: | ||
| 166 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Only one of --baseurl and --mirrorlist may be specified for repo command.")) | ||
| 167 | |||
| 168 | if self.urlRequired and not opts.baseurl and not opts.mirrorlist: | ||
| 169 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("One of --baseurl or --mirrorlist must be specified for repo command.")) | ||
| 170 | |||
| 171 | rd = self.handler.RepoData() | ||
| 172 | self._setToObj(self.op, opts, rd) | ||
| 173 | rd.lineno = self.lineno | ||
| 174 | |||
| 175 | # Check for duplicates in the data list. | ||
| 176 | if rd in self.dataList(): | ||
| 177 | warnings.warn(_("A repo with the name %s has already been defined.") % rd.name) | ||
| 178 | |||
| 179 | return rd | ||
| 180 | |||
| 181 | def dataList(self): | ||
| 182 | return self.repoList | ||
| 183 | |||
| 184 | class F8_Repo(FC6_Repo): | ||
| 185 | removedKeywords = FC6_Repo.removedKeywords | ||
| 186 | removedAttrs = FC6_Repo.removedAttrs | ||
| 187 | |||
| 188 | def __str__(self): | ||
| 189 | retval = "" | ||
| 190 | for repo in self.repoList: | ||
| 191 | retval += repo.__str__() | ||
| 192 | |||
| 193 | return retval | ||
| 194 | |||
| 195 | def _getParser(self): | ||
| 196 | def list_cb (option, opt_str, value, parser): | ||
| 197 | for d in value.split(','): | ||
| 198 | parser.values.ensure_value(option.dest, []).append(d) | ||
| 199 | |||
| 200 | op = FC6_Repo._getParser(self) | ||
| 201 | op.add_option("--cost", action="store", type="int") | ||
| 202 | op.add_option("--excludepkgs", action="callback", callback=list_cb, | ||
| 203 | nargs=1, type="string") | ||
| 204 | op.add_option("--includepkgs", action="callback", callback=list_cb, | ||
| 205 | nargs=1, type="string") | ||
| 206 | return op | ||
| 207 | |||
| 208 | def methodToRepo(self): | ||
| 209 | if not self.handler.method.url: | ||
| 210 | raise KickstartError, formatErrorMsg(self.handler.method.lineno, msg=_("Method must be a url to be added to the repo list.")) | ||
| 211 | reponame = "ks-method-url" | ||
| 212 | repourl = self.handler.method.url | ||
| 213 | rd = self.handler.RepoData(name=reponame, baseurl=repourl) | ||
| 214 | return rd | ||
| 215 | |||
| 216 | class F11_Repo(F8_Repo): | ||
| 217 | removedKeywords = F8_Repo.removedKeywords | ||
| 218 | removedAttrs = F8_Repo.removedAttrs | ||
| 219 | |||
| 220 | def _getParser(self): | ||
| 221 | op = F8_Repo._getParser(self) | ||
| 222 | op.add_option("--ignoregroups", action="store", type="ksboolean") | ||
| 223 | return op | ||
| 224 | |||
| 225 | class F13_Repo(F11_Repo): | ||
| 226 | removedKeywords = F11_Repo.removedKeywords | ||
| 227 | removedAttrs = F11_Repo.removedAttrs | ||
| 228 | |||
| 229 | def _getParser(self): | ||
| 230 | op = F11_Repo._getParser(self) | ||
| 231 | op.add_option("--proxy") | ||
| 232 | return op | ||
| 233 | |||
| 234 | class F14_Repo(F13_Repo): | ||
| 235 | removedKeywords = F13_Repo.removedKeywords | ||
| 236 | removedAttrs = F13_Repo.removedAttrs | ||
| 237 | |||
| 238 | def _getParser(self): | ||
| 239 | op = F13_Repo._getParser(self) | ||
| 240 | op.add_option("--noverifyssl", action="store_true", default=False) | ||
| 241 | return op | ||
| 242 | |||
| 243 | RHEL6_Repo = F14_Repo | ||
| 244 | |||
| 245 | class F15_Repo(F14_Repo): | ||
| 246 | removedKeywords = F14_Repo.removedKeywords | ||
| 247 | removedAttrs = F14_Repo.removedAttrs | ||
| 248 | |||
| 249 | urlRequired = False | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/rescue.py b/scripts/lib/mic/3rdparty/pykickstart/commands/rescue.py new file mode 100644 index 0000000000..1893d4ea49 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/rescue.py | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | # | ||
| 2 | # Alexander Todorov <atodorov@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class F10_Rescue(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.rescue = False | ||
| 36 | self.nomount = kwargs.get("nomount", False) | ||
| 37 | self.romount = kwargs.get("romount", False) | ||
| 38 | |||
| 39 | def __str__(self): | ||
| 40 | retval = KickstartCommand.__str__(self) | ||
| 41 | |||
| 42 | if self.rescue: | ||
| 43 | retval += "rescue" | ||
| 44 | |||
| 45 | if self.nomount: | ||
| 46 | retval += " --nomount" | ||
| 47 | if self.romount: | ||
| 48 | retval += " --romount" | ||
| 49 | |||
| 50 | retval = "# Start rescue mode\n%s\n" % retval | ||
| 51 | |||
| 52 | return retval | ||
| 53 | |||
| 54 | def _getParser(self): | ||
| 55 | op = KSOptionParser() | ||
| 56 | op.add_option("--nomount", dest="nomount", action="store_true", default=False) | ||
| 57 | op.add_option("--romount", dest="romount", action="store_true", default=False) | ||
| 58 | return op | ||
| 59 | |||
| 60 | def parse(self, args): | ||
| 61 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 62 | |||
| 63 | if opts.nomount and opts.romount: | ||
| 64 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Only one of --nomount and --romount may be specified for rescue command.")) | ||
| 65 | |||
| 66 | self._setToSelf(self.op, opts) | ||
| 67 | self.rescue = True | ||
| 68 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/rootpw.py b/scripts/lib/mic/3rdparty/pykickstart/commands/rootpw.py new file mode 100644 index 0000000000..e038b4525d --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/rootpw.py | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_RootPw(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.isCrypted = kwargs.get("isCrypted", False) | ||
| 36 | self.password = kwargs.get("password", "") | ||
| 37 | |||
| 38 | def _getArgsAsStr(self): | ||
| 39 | retval = "" | ||
| 40 | |||
| 41 | if self.isCrypted: | ||
| 42 | retval += " --iscrypted" | ||
| 43 | |||
| 44 | return retval | ||
| 45 | |||
| 46 | def __str__(self): | ||
| 47 | retval = KickstartCommand.__str__(self) | ||
| 48 | |||
| 49 | if self.password != "": | ||
| 50 | retval += "# Root password\nrootpw%s %s\n" % (self._getArgsAsStr(), self.password) | ||
| 51 | |||
| 52 | return retval | ||
| 53 | |||
| 54 | def _getParser(self): | ||
| 55 | op = KSOptionParser() | ||
| 56 | op.add_option("--iscrypted", dest="isCrypted", action="store_true", | ||
| 57 | default=False) | ||
| 58 | return op | ||
| 59 | |||
| 60 | def parse(self, args): | ||
| 61 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 62 | self._setToSelf(self.op, opts) | ||
| 63 | |||
| 64 | if len(extra) != 1: | ||
| 65 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("A single argument is expected for the %s command") % "rootpw") | ||
| 66 | |||
| 67 | self.password = extra[0] | ||
| 68 | return self | ||
| 69 | |||
| 70 | class F8_RootPw(FC3_RootPw): | ||
| 71 | removedKeywords = FC3_RootPw.removedKeywords | ||
| 72 | removedAttrs = FC3_RootPw.removedAttrs | ||
| 73 | |||
| 74 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 75 | FC3_RootPw.__init__(self, writePriority, *args, **kwargs) | ||
| 76 | self.lock = kwargs.get("lock", False) | ||
| 77 | |||
| 78 | def _getArgsAsStr(self): | ||
| 79 | retval = FC3_RootPw._getArgsAsStr(self) | ||
| 80 | |||
| 81 | if self.lock: | ||
| 82 | retval += " --lock" | ||
| 83 | |||
| 84 | if not self.isCrypted: | ||
| 85 | retval += " --plaintext" | ||
| 86 | |||
| 87 | return retval | ||
| 88 | |||
| 89 | def _getParser(self): | ||
| 90 | op = FC3_RootPw._getParser(self) | ||
| 91 | op.add_option("--lock", dest="lock", action="store_true", default=False) | ||
| 92 | op.add_option("--plaintext", dest="isCrypted", action="store_false") | ||
| 93 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/selinux.py b/scripts/lib/mic/3rdparty/pykickstart/commands/selinux.py new file mode 100644 index 0000000000..9f8059c76b --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/selinux.py | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | class FC3_SELinux(KickstartCommand): | ||
| 25 | removedKeywords = KickstartCommand.removedKeywords | ||
| 26 | removedAttrs = KickstartCommand.removedAttrs | ||
| 27 | |||
| 28 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 29 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 30 | self.op = self._getParser() | ||
| 31 | |||
| 32 | self.selinux = kwargs.get("selinux", None) | ||
| 33 | |||
| 34 | def __str__(self): | ||
| 35 | retval = KickstartCommand.__str__(self) | ||
| 36 | |||
| 37 | if not retval and self.selinux is None: | ||
| 38 | return "" | ||
| 39 | |||
| 40 | retval += "# SELinux configuration\n" | ||
| 41 | |||
| 42 | if self.selinux == SELINUX_DISABLED: | ||
| 43 | retval += "selinux --disabled\n" | ||
| 44 | elif self.selinux == SELINUX_ENFORCING: | ||
| 45 | retval += "selinux --enforcing\n" | ||
| 46 | elif self.selinux == SELINUX_PERMISSIVE: | ||
| 47 | retval += "selinux --permissive\n" | ||
| 48 | |||
| 49 | return retval | ||
| 50 | |||
| 51 | def _getParser(self): | ||
| 52 | op = KSOptionParser() | ||
| 53 | op.add_option("--disabled", dest="selinux", action="store_const", | ||
| 54 | const=SELINUX_DISABLED) | ||
| 55 | op.add_option("--enforcing", dest="selinux", action="store_const", | ||
| 56 | const=SELINUX_ENFORCING) | ||
| 57 | op.add_option("--permissive", dest="selinux", action="store_const", | ||
| 58 | const=SELINUX_PERMISSIVE) | ||
| 59 | return op | ||
| 60 | |||
| 61 | def parse(self, args): | ||
| 62 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 63 | self._setToSelf(self.op, opts) | ||
| 64 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/services.py b/scripts/lib/mic/3rdparty/pykickstart/commands/services.py new file mode 100644 index 0000000000..2e0eab8007 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/services.py | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC6_Services(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.disabled = kwargs.get("disabled", []) | ||
| 36 | self.enabled = kwargs.get("enabled", []) | ||
| 37 | |||
| 38 | def __str__(self): | ||
| 39 | retval = KickstartCommand.__str__(self) | ||
| 40 | args = "" | ||
| 41 | |||
| 42 | if len(self.disabled) > 0: | ||
| 43 | args += " --disabled=\"%s\"" % ",".join(self.disabled) | ||
| 44 | if len(self.enabled) > 0: | ||
| 45 | args += " --enabled=\"%s\"" % ",".join(self.enabled) | ||
| 46 | |||
| 47 | if args != "": | ||
| 48 | retval += "# System services\nservices%s\n" % args | ||
| 49 | |||
| 50 | return retval | ||
| 51 | |||
| 52 | def _getParser(self): | ||
| 53 | def services_cb (option, opt_str, value, parser): | ||
| 54 | for d in value.split(','): | ||
| 55 | parser.values.ensure_value(option.dest, []).append(d.strip()) | ||
| 56 | |||
| 57 | op = KSOptionParser() | ||
| 58 | op.add_option("--disabled", dest="disabled", action="callback", | ||
| 59 | callback=services_cb, nargs=1, type="string") | ||
| 60 | op.add_option("--enabled", dest="enabled", action="callback", | ||
| 61 | callback=services_cb, nargs=1, type="string") | ||
| 62 | return op | ||
| 63 | |||
| 64 | def parse(self, args): | ||
| 65 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 66 | self._setToSelf(self.op, opts) | ||
| 67 | |||
| 68 | if len(self.disabled) == 0 and len(self.enabled) == 0: | ||
| 69 | raise KickstartParseError, formatErrorMsg(self.lineno, msg=_("One of --disabled or --enabled must be provided.")) | ||
| 70 | |||
| 71 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/skipx.py b/scripts/lib/mic/3rdparty/pykickstart/commands/skipx.py new file mode 100644 index 0000000000..36d1a8d5ba --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/skipx.py | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_SkipX(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | self.skipx = kwargs.get("skipx", False) | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if self.skipx: | ||
| 40 | retval += "# Do not configure the X Window System\nskipx\n" | ||
| 41 | |||
| 42 | return retval | ||
| 43 | |||
| 44 | def _getParser(self): | ||
| 45 | op = KSOptionParser() | ||
| 46 | return op | ||
| 47 | |||
| 48 | def parse(self, args): | ||
| 49 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 50 | if len(extra) > 0: | ||
| 51 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "skipx") | ||
| 52 | |||
| 53 | self.skipx = True | ||
| 54 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/sshpw.py b/scripts/lib/mic/3rdparty/pykickstart/commands/sshpw.py new file mode 100644 index 0000000000..e7867ebfb2 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/sshpw.py | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | # | ||
| 2 | # Peter Jones <pjones@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2009 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class F13_SshPwData(BaseData): | ||
| 28 | removedKeywords = BaseData.removedKeywords | ||
| 29 | removedAttrs = BaseData.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, *args, **kwargs): | ||
| 32 | BaseData.__init__(self, *args, **kwargs) | ||
| 33 | self.username = kwargs.get("username", None) | ||
| 34 | self.isCrypted = kwargs.get("isCrypted", False) | ||
| 35 | self.password = kwargs.get("password", "") | ||
| 36 | self.lock = kwargs.get("lock", False) | ||
| 37 | |||
| 38 | def __eq__(self, y): | ||
| 39 | return self.username == y.username | ||
| 40 | |||
| 41 | def __str__(self): | ||
| 42 | retval = BaseData.__str__(self) | ||
| 43 | |||
| 44 | retval += "sshpw" | ||
| 45 | retval += self._getArgsAsStr() + '\n' | ||
| 46 | |||
| 47 | return retval | ||
| 48 | |||
| 49 | def _getArgsAsStr(self): | ||
| 50 | retval = "" | ||
| 51 | |||
| 52 | retval += " --username=%s" % self.username | ||
| 53 | if self.lock: | ||
| 54 | retval += " --lock" | ||
| 55 | if self.isCrypted: | ||
| 56 | retval += " --iscrypted" | ||
| 57 | else: | ||
| 58 | retval += " --plaintext" | ||
| 59 | |||
| 60 | retval += " %s" % self.password | ||
| 61 | return retval | ||
| 62 | |||
| 63 | class F13_SshPw(KickstartCommand): | ||
| 64 | removedKeywords = KickstartCommand.removedKeywords | ||
| 65 | removedAttrs = KickstartCommand.removedAttrs | ||
| 66 | |||
| 67 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 68 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 69 | self.op = self._getParser() | ||
| 70 | |||
| 71 | self.sshUserList = kwargs.get("sshUserList", []) | ||
| 72 | |||
| 73 | def __str__(self): | ||
| 74 | retval = "" | ||
| 75 | for user in self.sshUserList: | ||
| 76 | retval += user.__str__() | ||
| 77 | |||
| 78 | return retval | ||
| 79 | |||
| 80 | def _getParser(self): | ||
| 81 | op = KSOptionParser() | ||
| 82 | op.add_option("--username", dest="username", required=True) | ||
| 83 | op.add_option("--iscrypted", dest="isCrypted", action="store_true", | ||
| 84 | default=False) | ||
| 85 | op.add_option("--plaintext", dest="isCrypted", action="store_false") | ||
| 86 | op.add_option("--lock", dest="lock", action="store_true", default=False) | ||
| 87 | return op | ||
| 88 | |||
| 89 | def parse(self, args): | ||
| 90 | ud = self.handler.SshPwData() | ||
| 91 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 92 | self._setToObj(self.op, opts, ud) | ||
| 93 | ud.lineno = self.lineno | ||
| 94 | |||
| 95 | if len(extra) != 1: | ||
| 96 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("A single argument is expected for the %s command") % "sshpw") | ||
| 97 | ud.password = extra[0] | ||
| 98 | |||
| 99 | if ud in self.dataList(): | ||
| 100 | warnings.warn(_("An ssh user with the name %s has already been defined.") % ud.name) | ||
| 101 | |||
| 102 | return ud | ||
| 103 | |||
| 104 | def dataList(self): | ||
| 105 | return self.sshUserList | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/timezone.py b/scripts/lib/mic/3rdparty/pykickstart/commands/timezone.py new file mode 100644 index 0000000000..f5441de593 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/timezone.py | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_Timezone(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.isUtc = kwargs.get("isUtc", False) | ||
| 36 | self.timezone = kwargs.get("timezone", "") | ||
| 37 | |||
| 38 | def __str__(self): | ||
| 39 | retval = KickstartCommand.__str__(self) | ||
| 40 | |||
| 41 | if self.timezone != "": | ||
| 42 | if self.isUtc: | ||
| 43 | utc = "--utc" | ||
| 44 | else: | ||
| 45 | utc = "" | ||
| 46 | |||
| 47 | retval += "# System timezone\ntimezone %s %s\n" %(utc, self.timezone) | ||
| 48 | |||
| 49 | return retval | ||
| 50 | |||
| 51 | def _getParser(self): | ||
| 52 | op = KSOptionParser() | ||
| 53 | op.add_option("--utc", dest="isUtc", action="store_true", default=False) | ||
| 54 | return op | ||
| 55 | |||
| 56 | def parse(self, args): | ||
| 57 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 58 | self._setToSelf(self.op, opts) | ||
| 59 | |||
| 60 | if len(extra) != 1: | ||
| 61 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("A single argument is expected for the %s command") % "timezone") | ||
| 62 | |||
| 63 | self.timezone = extra[0] | ||
| 64 | return self | ||
| 65 | |||
| 66 | class FC6_Timezone(FC3_Timezone): | ||
| 67 | removedKeywords = FC3_Timezone.removedKeywords | ||
| 68 | removedAttrs = FC3_Timezone.removedAttrs | ||
| 69 | |||
| 70 | def __str__(self): | ||
| 71 | retval = KickstartCommand.__str__(self) | ||
| 72 | |||
| 73 | if self.timezone != "": | ||
| 74 | if self.isUtc: | ||
| 75 | utc = "--isUtc" | ||
| 76 | else: | ||
| 77 | utc = "" | ||
| 78 | |||
| 79 | retval += "# System timezone\ntimezone %s %s\n" %(utc, self.timezone) | ||
| 80 | |||
| 81 | return retval | ||
| 82 | |||
| 83 | def _getParser(self): | ||
| 84 | op = FC3_Timezone._getParser(self) | ||
| 85 | op.add_option("--utc", "--isUtc", dest="isUtc", action="store_true", default=False) | ||
| 86 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/updates.py b/scripts/lib/mic/3rdparty/pykickstart/commands/updates.py new file mode 100644 index 0000000000..53ec49f7b8 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/updates.py | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class F7_Updates(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | self.url = kwargs.get("url", "") | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if self.url == "floppy": | ||
| 40 | retval += "updates\n" | ||
| 41 | elif self.url != "": | ||
| 42 | retval += "updates %s\n" % self.url | ||
| 43 | |||
| 44 | return retval | ||
| 45 | |||
| 46 | def _getParser(self): | ||
| 47 | op = KSOptionParser() | ||
| 48 | return op | ||
| 49 | |||
| 50 | def parse(self, args): | ||
| 51 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 52 | |||
| 53 | if len(extra) > 1: | ||
| 54 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s only takes one argument") % "updates") | ||
| 55 | elif len(extra) == 0: | ||
| 56 | self.url = "floppy" | ||
| 57 | else: | ||
| 58 | self.url = extra[0] | ||
| 59 | |||
| 60 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/upgrade.py b/scripts/lib/mic/3rdparty/pykickstart/commands/upgrade.py new file mode 100644 index 0000000000..a68a82d378 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/upgrade.py | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_Upgrade(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.upgrade = kwargs.get("upgrade", None) | ||
| 34 | self.op = self._getParser() | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if self.upgrade is None: | ||
| 40 | return retval | ||
| 41 | |||
| 42 | if self.upgrade: | ||
| 43 | retval += "# Upgrade existing installation\nupgrade\n" | ||
| 44 | else: | ||
| 45 | retval += "# Install OS instead of upgrade\ninstall\n" | ||
| 46 | |||
| 47 | return retval | ||
| 48 | |||
| 49 | def _getParser(self): | ||
| 50 | op = KSOptionParser() | ||
| 51 | return op | ||
| 52 | |||
| 53 | def parse(self, args): | ||
| 54 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 55 | |||
| 56 | if len(extra) > 0: | ||
| 57 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "upgrade") | ||
| 58 | |||
| 59 | if self.currentCmd == "upgrade": | ||
| 60 | self.upgrade = True | ||
| 61 | else: | ||
| 62 | self.upgrade = False | ||
| 63 | |||
| 64 | return self | ||
| 65 | |||
| 66 | class F11_Upgrade(FC3_Upgrade): | ||
| 67 | removedKeywords = FC3_Upgrade.removedKeywords | ||
| 68 | removedAttrs = FC3_Upgrade.removedAttrs | ||
| 69 | |||
| 70 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 71 | FC3_Upgrade.__init__(self, writePriority, *args, **kwargs) | ||
| 72 | |||
| 73 | self.op = self._getParser() | ||
| 74 | self.root_device = kwargs.get("root_device", None) | ||
| 75 | |||
| 76 | def __str__(self): | ||
| 77 | if self.upgrade and (self.root_device is not None): | ||
| 78 | retval = KickstartCommand.__str__(self) | ||
| 79 | retval += "# Upgrade existing installation\nupgrade --root-device=%s\n" % self.root_device | ||
| 80 | else: | ||
| 81 | retval = FC3_Upgrade.__str__(self) | ||
| 82 | |||
| 83 | return retval | ||
| 84 | |||
| 85 | def _getParser(self): | ||
| 86 | op = KSOptionParser() | ||
| 87 | op.add_option("--root-device", dest="root_device") | ||
| 88 | return op | ||
| 89 | |||
| 90 | def parse(self, args): | ||
| 91 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 92 | |||
| 93 | if len(extra) > 0: | ||
| 94 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "upgrade") | ||
| 95 | |||
| 96 | if (opts.root_device is not None) and (opts.root_device == ""): | ||
| 97 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not accept empty parameter %s") % ("upgrade", "--root-device")) | ||
| 98 | else: | ||
| 99 | self.root_device = opts.root_device | ||
| 100 | |||
| 101 | if self.currentCmd == "upgrade": | ||
| 102 | self.upgrade = True | ||
| 103 | else: | ||
| 104 | self.upgrade = False | ||
| 105 | |||
| 106 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/user.py b/scripts/lib/mic/3rdparty/pykickstart/commands/user.py new file mode 100644 index 0000000000..189dc7585f --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/user.py | |||
| @@ -0,0 +1,173 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.constants import * | ||
| 22 | from pykickstart.errors import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | import warnings | ||
| 27 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 28 | |||
| 29 | class FC6_UserData(BaseData): | ||
| 30 | removedKeywords = BaseData.removedKeywords | ||
| 31 | removedAttrs = BaseData.removedAttrs | ||
| 32 | |||
| 33 | def __init__(self, *args, **kwargs): | ||
| 34 | BaseData.__init__(self, *args, **kwargs) | ||
| 35 | self.groups = kwargs.get("groups", []) | ||
| 36 | self.homedir = kwargs.get("homedir", "") | ||
| 37 | self.isCrypted = kwargs.get("isCrypted", False) | ||
| 38 | self.name = kwargs.get("name", "") | ||
| 39 | self.password = kwargs.get("password", "") | ||
| 40 | self.shell = kwargs.get("shell", "") | ||
| 41 | self.uid = kwargs.get("uid", None) | ||
| 42 | |||
| 43 | def __eq__(self, y): | ||
| 44 | return self.name == y.name | ||
| 45 | |||
| 46 | def __str__(self): | ||
| 47 | retval = BaseData.__str__(self) | ||
| 48 | |||
| 49 | if self.uid != "": | ||
| 50 | retval += "user" | ||
| 51 | retval += self._getArgsAsStr() + "\n" | ||
| 52 | |||
| 53 | return retval | ||
| 54 | |||
| 55 | def _getArgsAsStr(self): | ||
| 56 | retval = "" | ||
| 57 | |||
| 58 | if len(self.groups) > 0: | ||
| 59 | retval += " --groups=%s" % ",".join(self.groups) | ||
| 60 | if self.homedir: | ||
| 61 | retval += " --homedir=%s" % self.homedir | ||
| 62 | if self.name: | ||
| 63 | retval += " --name=%s" % self.name | ||
| 64 | if self.password: | ||
| 65 | retval += " --password=%s" % self.password | ||
| 66 | if self.isCrypted: | ||
| 67 | retval += " --iscrypted" | ||
| 68 | if self.shell: | ||
| 69 | retval += " --shell=%s" % self.shell | ||
| 70 | if self.uid: | ||
| 71 | retval += " --uid=%s" % self.uid | ||
| 72 | |||
| 73 | return retval | ||
| 74 | |||
| 75 | class F8_UserData(FC6_UserData): | ||
| 76 | removedKeywords = FC6_UserData.removedKeywords | ||
| 77 | removedAttrs = FC6_UserData.removedAttrs | ||
| 78 | |||
| 79 | def __init__(self, *args, **kwargs): | ||
| 80 | FC6_UserData.__init__(self, *args, **kwargs) | ||
| 81 | self.lock = kwargs.get("lock", False) | ||
| 82 | |||
| 83 | def _getArgsAsStr(self): | ||
| 84 | retval = FC6_UserData._getArgsAsStr(self) | ||
| 85 | |||
| 86 | if self.lock: | ||
| 87 | retval += " --lock" | ||
| 88 | |||
| 89 | return retval | ||
| 90 | |||
| 91 | class F12_UserData(F8_UserData): | ||
| 92 | removedKeywords = F8_UserData.removedKeywords | ||
| 93 | removedAttrs = F8_UserData.removedAttrs | ||
| 94 | |||
| 95 | def __init__(self, *args, **kwargs): | ||
| 96 | F8_UserData.__init__(self, *args, **kwargs) | ||
| 97 | self.gecos = kwargs.get("gecos", "") | ||
| 98 | |||
| 99 | def _getArgsAsStr(self): | ||
| 100 | retval = F8_UserData._getArgsAsStr(self) | ||
| 101 | |||
| 102 | if self.gecos: | ||
| 103 | retval += " --gecos=\"%s\"" % (self.gecos,) | ||
| 104 | |||
| 105 | return retval | ||
| 106 | |||
| 107 | class FC6_User(KickstartCommand): | ||
| 108 | removedKeywords = KickstartCommand.removedKeywords | ||
| 109 | removedAttrs = KickstartCommand.removedAttrs | ||
| 110 | |||
| 111 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 112 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 113 | self.op = self._getParser() | ||
| 114 | |||
| 115 | self.userList = kwargs.get("userList", []) | ||
| 116 | |||
| 117 | def __str__(self): | ||
| 118 | retval = "" | ||
| 119 | for user in self.userList: | ||
| 120 | retval += user.__str__() | ||
| 121 | |||
| 122 | return retval | ||
| 123 | |||
| 124 | def _getParser(self): | ||
| 125 | def groups_cb (option, opt_str, value, parser): | ||
| 126 | for d in value.split(','): | ||
| 127 | parser.values.ensure_value(option.dest, []).append(d) | ||
| 128 | |||
| 129 | op = KSOptionParser() | ||
| 130 | op.add_option("--groups", dest="groups", action="callback", | ||
| 131 | callback=groups_cb, nargs=1, type="string") | ||
| 132 | op.add_option("--homedir") | ||
| 133 | op.add_option("--iscrypted", dest="isCrypted", action="store_true", | ||
| 134 | default=False) | ||
| 135 | op.add_option("--name", required=1) | ||
| 136 | op.add_option("--password") | ||
| 137 | op.add_option("--shell") | ||
| 138 | op.add_option("--uid", type="int") | ||
| 139 | return op | ||
| 140 | |||
| 141 | def parse(self, args): | ||
| 142 | ud = self.handler.UserData() | ||
| 143 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 144 | self._setToObj(self.op, opts, ud) | ||
| 145 | ud.lineno = self.lineno | ||
| 146 | |||
| 147 | # Check for duplicates in the data list. | ||
| 148 | if ud in self.dataList(): | ||
| 149 | warnings.warn(_("A user with the name %s has already been defined.") % ud.name) | ||
| 150 | |||
| 151 | return ud | ||
| 152 | |||
| 153 | def dataList(self): | ||
| 154 | return self.userList | ||
| 155 | |||
| 156 | class F8_User(FC6_User): | ||
| 157 | removedKeywords = FC6_User.removedKeywords | ||
| 158 | removedAttrs = FC6_User.removedAttrs | ||
| 159 | |||
| 160 | def _getParser(self): | ||
| 161 | op = FC6_User._getParser(self) | ||
| 162 | op.add_option("--lock", action="store_true", default=False) | ||
| 163 | op.add_option("--plaintext", dest="isCrypted", action="store_false") | ||
| 164 | return op | ||
| 165 | |||
| 166 | class F12_User(F8_User): | ||
| 167 | removedKeywords = F8_User.removedKeywords | ||
| 168 | removedAttrs = F8_User.removedAttrs | ||
| 169 | |||
| 170 | def _getParser(self): | ||
| 171 | op = F8_User._getParser(self) | ||
| 172 | op.add_option("--gecos", type="string") | ||
| 173 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/vnc.py b/scripts/lib/mic/3rdparty/pykickstart/commands/vnc.py new file mode 100644 index 0000000000..200ccfba2e --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/vnc.py | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | class FC3_Vnc(KickstartCommand): | ||
| 25 | removedKeywords = KickstartCommand.removedKeywords | ||
| 26 | removedAttrs = KickstartCommand.removedAttrs | ||
| 27 | |||
| 28 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 29 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 30 | self.op = self._getParser() | ||
| 31 | |||
| 32 | self.enabled = kwargs.get("enabled", False) | ||
| 33 | self.password = kwargs.get("password", "") | ||
| 34 | self.connect = kwargs.get("connect", "") | ||
| 35 | |||
| 36 | def __str__(self): | ||
| 37 | retval = KickstartCommand.__str__(self) | ||
| 38 | |||
| 39 | if not self.enabled: | ||
| 40 | return retval | ||
| 41 | |||
| 42 | retval += "vnc" | ||
| 43 | |||
| 44 | if self.connect != "": | ||
| 45 | retval += " --connect=%s" % self.connect | ||
| 46 | if self.password != "": | ||
| 47 | retval += " --password=%s" % self.password | ||
| 48 | |||
| 49 | return retval + "\n" | ||
| 50 | |||
| 51 | def _getParser(self): | ||
| 52 | op = KSOptionParser() | ||
| 53 | op.add_option("--connect") | ||
| 54 | op.add_option("--password", dest="password") | ||
| 55 | return op | ||
| 56 | |||
| 57 | def parse(self, args): | ||
| 58 | self.enabled = True | ||
| 59 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 60 | self._setToSelf(self.op, opts) | ||
| 61 | return self | ||
| 62 | |||
| 63 | class FC6_Vnc(FC3_Vnc): | ||
| 64 | removedKeywords = FC3_Vnc.removedKeywords + ["connect"] | ||
| 65 | removedAttrs = FC3_Vnc.removedAttrs + ["connect"] | ||
| 66 | |||
| 67 | def __init__(self, writePriority=0, host="", port="", *args, **kwargs): | ||
| 68 | FC3_Vnc.__init__(self, writePriority, *args, **kwargs) | ||
| 69 | self.deleteRemovedAttrs() | ||
| 70 | |||
| 71 | self.host = kwargs.get("host", "") | ||
| 72 | self.port = kwargs.get("port", "") | ||
| 73 | |||
| 74 | def __str__(self): | ||
| 75 | retval = KickstartCommand.__str__(self) | ||
| 76 | |||
| 77 | if not self.enabled: | ||
| 78 | return retval | ||
| 79 | |||
| 80 | retval += "vnc" | ||
| 81 | |||
| 82 | if self.host != "": | ||
| 83 | retval += " --host=%s" % self.host | ||
| 84 | |||
| 85 | if self.port != "": | ||
| 86 | retval += " --port=%s" % self.port | ||
| 87 | if self.password != "": | ||
| 88 | retval += " --password=%s" % self.password | ||
| 89 | |||
| 90 | return retval + "\n" | ||
| 91 | |||
| 92 | def _getParser(self): | ||
| 93 | def connect_cb (option, opt_str, value, parser): | ||
| 94 | cargs = value.split(":") | ||
| 95 | parser.values.ensure_value("host", cargs[0]) | ||
| 96 | |||
| 97 | if len(cargs) > 1: | ||
| 98 | parser.values.ensure_value("port", cargs[1]) | ||
| 99 | |||
| 100 | op = FC3_Vnc._getParser(self) | ||
| 101 | op.add_option("--connect", action="callback", callback=connect_cb, | ||
| 102 | nargs=1, type="string") | ||
| 103 | op.add_option("--host", dest="host") | ||
| 104 | op.add_option("--port", dest="port") | ||
| 105 | return op | ||
| 106 | |||
| 107 | class F9_Vnc(FC6_Vnc): | ||
| 108 | removedKeywords = FC6_Vnc.removedKeywords | ||
| 109 | removedAttrs = FC6_Vnc.removedAttrs | ||
| 110 | |||
| 111 | def _getParser(self): | ||
| 112 | op = FC6_Vnc._getParser(self) | ||
| 113 | op.remove_option("--connect") | ||
| 114 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/volgroup.py b/scripts/lib/mic/3rdparty/pykickstart/commands/volgroup.py new file mode 100644 index 0000000000..255c47f0ae --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/volgroup.py | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | import gettext | ||
| 24 | import warnings | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_VolGroupData(BaseData): | ||
| 28 | removedKeywords = BaseData.removedKeywords | ||
| 29 | removedAttrs = BaseData.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, *args, **kwargs): | ||
| 32 | BaseData.__init__(self, *args, **kwargs) | ||
| 33 | self.format = kwargs.get("format", True) | ||
| 34 | self.pesize = kwargs.get("pesize", 32768) | ||
| 35 | self.preexist = kwargs.get("preexist", False) | ||
| 36 | self.vgname = kwargs.get("vgname", "") | ||
| 37 | self.physvols = kwargs.get("physvols", []) | ||
| 38 | |||
| 39 | def __eq__(self, y): | ||
| 40 | return self.vgname == y.vgname | ||
| 41 | |||
| 42 | def __str__(self): | ||
| 43 | retval = BaseData.__str__(self) | ||
| 44 | retval += "volgroup %s" % self.vgname | ||
| 45 | |||
| 46 | if not self.format: | ||
| 47 | retval += " --noformat" | ||
| 48 | if self.pesize != 0: | ||
| 49 | retval += " --pesize=%d" % self.pesize | ||
| 50 | if self.preexist: | ||
| 51 | retval += " --useexisting" | ||
| 52 | |||
| 53 | return retval + " " + " ".join(self.physvols) + "\n" | ||
| 54 | |||
| 55 | class FC3_VolGroup(KickstartCommand): | ||
| 56 | removedKeywords = KickstartCommand.removedKeywords | ||
| 57 | removedAttrs = KickstartCommand.removedAttrs | ||
| 58 | |||
| 59 | def __init__(self, writePriority=132, *args, **kwargs): | ||
| 60 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 61 | self.op = self._getParser() | ||
| 62 | |||
| 63 | self.vgList = kwargs.get("vgList", []) | ||
| 64 | |||
| 65 | def __str__(self): | ||
| 66 | retval = "" | ||
| 67 | for vg in self.vgList: | ||
| 68 | retval += vg.__str__() | ||
| 69 | |||
| 70 | return retval | ||
| 71 | |||
| 72 | def _getParser(self): | ||
| 73 | # Have to be a little more complicated to set two values. | ||
| 74 | def vg_cb (option, opt_str, value, parser): | ||
| 75 | parser.values.format = False | ||
| 76 | parser.values.preexist = True | ||
| 77 | |||
| 78 | op = KSOptionParser() | ||
| 79 | op.add_option("--noformat", action="callback", callback=vg_cb, | ||
| 80 | dest="format", default=True, nargs=0) | ||
| 81 | op.add_option("--pesize", dest="pesize", type="int", nargs=1, | ||
| 82 | default=32768) | ||
| 83 | op.add_option("--useexisting", dest="preexist", action="store_true", | ||
| 84 | default=False) | ||
| 85 | return op | ||
| 86 | |||
| 87 | def parse(self, args): | ||
| 88 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 89 | vg = self.handler.VolGroupData() | ||
| 90 | self._setToObj(self.op, opts, vg) | ||
| 91 | vg.lineno = self.lineno | ||
| 92 | vg.vgname = extra[0] | ||
| 93 | vg.physvols = extra[1:] | ||
| 94 | |||
| 95 | # Check for duplicates in the data list. | ||
| 96 | if vg in self.dataList(): | ||
| 97 | warnings.warn(_("A volgroup with the name %s has already been defined.") % vg.vgname) | ||
| 98 | |||
| 99 | return vg | ||
| 100 | |||
| 101 | def dataList(self): | ||
| 102 | return self.vgList | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py b/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py new file mode 100644 index 0000000000..644ee86743 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/xconfig.py | |||
| @@ -0,0 +1,184 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_XConfig(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.card = kwargs.get("card", "") | ||
| 36 | self.defaultdesktop = kwargs.get("defaultdesktop", "") | ||
| 37 | self.depth = kwargs.get("depth", 0) | ||
| 38 | self.hsync = kwargs.get("hsync", "") | ||
| 39 | self.monitor = kwargs.get("monitor", "") | ||
| 40 | self.noProbe = kwargs.get("noProbe", False) | ||
| 41 | self.resolution = kwargs.get("resolution", "") | ||
| 42 | self.server = kwargs.get("server", "") | ||
| 43 | self.startX = kwargs.get("startX", False) | ||
| 44 | self.videoRam = kwargs.get("videoRam", "") | ||
| 45 | self.vsync = kwargs.get("vsync", "") | ||
| 46 | |||
| 47 | def __str__(self): | ||
| 48 | retval = KickstartCommand.__str__(self) | ||
| 49 | |||
| 50 | if self.card != "": | ||
| 51 | retval += " --card=%s" % self.card | ||
| 52 | if self.defaultdesktop != "": | ||
| 53 | retval += " --defaultdesktop=%s" % self.defaultdesktop | ||
| 54 | if self.depth != 0: | ||
| 55 | retval += " --depth=%d" % self.depth | ||
| 56 | if self.hsync != "": | ||
| 57 | retval += " --hsync=%s" % self.hsync | ||
| 58 | if self.monitor != "": | ||
| 59 | retval += " --monitor=%s" % self.monitor | ||
| 60 | if self.noProbe: | ||
| 61 | retval += " --noprobe" | ||
| 62 | if self.resolution != "": | ||
| 63 | retval += " --resolution=%s" % self.resolution | ||
| 64 | if self.server != "": | ||
| 65 | retval += " --server=%s" % self.server | ||
| 66 | if self.startX: | ||
| 67 | retval += " --startxonboot" | ||
| 68 | if self.videoRam != "": | ||
| 69 | retval += " --videoram=%s" % self.videoRam | ||
| 70 | if self.vsync != "": | ||
| 71 | retval += " --vsync=%s" % self.vsync | ||
| 72 | |||
| 73 | if retval != "": | ||
| 74 | retval = "# X Window System configuration information\nxconfig %s\n" % retval | ||
| 75 | |||
| 76 | return retval | ||
| 77 | |||
| 78 | def _getParser(self): | ||
| 79 | op = KSOptionParser() | ||
| 80 | op.add_option("--card") | ||
| 81 | op.add_option("--defaultdesktop") | ||
| 82 | op.add_option("--depth", action="store", type="int", nargs=1) | ||
| 83 | op.add_option("--hsync") | ||
| 84 | op.add_option("--monitor") | ||
| 85 | op.add_option("--noprobe", dest="noProbe", action="store_true", | ||
| 86 | default=False) | ||
| 87 | op.add_option("--resolution") | ||
| 88 | op.add_option("--server") | ||
| 89 | op.add_option("--startxonboot", dest="startX", action="store_true", | ||
| 90 | default=False) | ||
| 91 | op.add_option("--videoram", dest="videoRam") | ||
| 92 | op.add_option("--vsync") | ||
| 93 | return op | ||
| 94 | |||
| 95 | def parse(self, args): | ||
| 96 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 97 | if extra: | ||
| 98 | mapping = {"command": "xconfig", "options": extra} | ||
| 99 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping) | ||
| 100 | |||
| 101 | self._setToSelf(self.op, opts) | ||
| 102 | return self | ||
| 103 | |||
| 104 | class FC6_XConfig(FC3_XConfig): | ||
| 105 | removedKeywords = FC3_XConfig.removedKeywords + ["card", "hsync", "monitor", "noProbe", "vsync"] | ||
| 106 | removedAttrs = FC3_XConfig.removedAttrs + ["card", "hsync", "monitor", "noProbe", "vsync"] | ||
| 107 | |||
| 108 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 109 | FC3_XConfig.__init__(self, writePriority, *args, **kwargs) | ||
| 110 | self.deleteRemovedAttrs() | ||
| 111 | |||
| 112 | self.driver = kwargs.get("driver", "") | ||
| 113 | |||
| 114 | def __str__(self): | ||
| 115 | retval = KickstartCommand.__str__(self) | ||
| 116 | |||
| 117 | if hasattr(self, "driver") and self.driver != "": | ||
| 118 | retval += " --driver=%s" % self.driver | ||
| 119 | if self.defaultdesktop != "": | ||
| 120 | retval += " --defaultdesktop=%s" % self.defaultdesktop | ||
| 121 | if self.depth != 0: | ||
| 122 | retval += " --depth=%d" % self.depth | ||
| 123 | if hasattr(self, "resolution") and self.resolution != "": | ||
| 124 | retval += " --resolution=%s" % self.resolution | ||
| 125 | if self.startX: | ||
| 126 | retval += " --startxonboot" | ||
| 127 | if hasattr(self, "videoRam") and self.videoRam != "": | ||
| 128 | retval += " --videoram=%s" % self.videoRam | ||
| 129 | |||
| 130 | if retval != "": | ||
| 131 | retval = "# X Window System configuration information\nxconfig %s\n" % retval | ||
| 132 | |||
| 133 | return retval | ||
| 134 | |||
| 135 | def _getParser(self): | ||
| 136 | op = FC3_XConfig._getParser(self) | ||
| 137 | op.add_option("--card", deprecated=1) | ||
| 138 | op.add_option("--driver", dest="driver") | ||
| 139 | op.add_option("--hsync", deprecated=1) | ||
| 140 | op.add_option("--monitor", deprecated=1) | ||
| 141 | op.add_option("--noprobe", deprecated=1) | ||
| 142 | op.add_option("--vsync", deprecated=1) | ||
| 143 | return op | ||
| 144 | |||
| 145 | class F9_XConfig(FC6_XConfig): | ||
| 146 | removedKeywords = FC6_XConfig.removedKeywords | ||
| 147 | removedAttrs = FC6_XConfig.removedAttrs | ||
| 148 | |||
| 149 | def _getParser(self): | ||
| 150 | op = FC6_XConfig._getParser(self) | ||
| 151 | op.remove_option("--card") | ||
| 152 | op.remove_option("--hsync") | ||
| 153 | op.remove_option("--monitor") | ||
| 154 | op.remove_option("--noprobe") | ||
| 155 | op.remove_option("--vsync") | ||
| 156 | return op | ||
| 157 | |||
| 158 | class F10_XConfig(F9_XConfig): | ||
| 159 | removedKeywords = F9_XConfig.removedKeywords + ["driver", "resolution", "videoRam"] | ||
| 160 | removedAttrs = F9_XConfig.removedAttrs + ["driver", "resolution", "videoRam"] | ||
| 161 | |||
| 162 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 163 | F9_XConfig.__init__(self, writePriority, *args, **kwargs) | ||
| 164 | self.deleteRemovedAttrs() | ||
| 165 | |||
| 166 | def _getParser(self): | ||
| 167 | op = F9_XConfig._getParser(self) | ||
| 168 | op.add_option("--driver", deprecated=1) | ||
| 169 | op.add_option("--depth", deprecated=1) | ||
| 170 | op.add_option("--resolution", deprecated=1) | ||
| 171 | op.add_option("--videoram", deprecated=1) | ||
| 172 | return op | ||
| 173 | |||
| 174 | class F14_XConfig(F10_XConfig): | ||
| 175 | removedKeywords = F10_XConfig.removedKeywords | ||
| 176 | removedAttrs = F10_XConfig.removedAttrs | ||
| 177 | |||
| 178 | def _getParser(self): | ||
| 179 | op = F10_XConfig._getParser(self) | ||
| 180 | op.remove_option("--driver") | ||
| 181 | op.remove_option("--depth") | ||
| 182 | op.remove_option("--resolution") | ||
| 183 | op.remove_option("--videoram") | ||
| 184 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/zerombr.py b/scripts/lib/mic/3rdparty/pykickstart/commands/zerombr.py new file mode 100644 index 0000000000..79555a9b27 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/zerombr.py | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | import warnings | ||
| 21 | |||
| 22 | from pykickstart.base import * | ||
| 23 | from pykickstart.options import * | ||
| 24 | |||
| 25 | import gettext | ||
| 26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 27 | |||
| 28 | class FC3_ZeroMbr(KickstartCommand): | ||
| 29 | removedKeywords = KickstartCommand.removedKeywords | ||
| 30 | removedAttrs = KickstartCommand.removedAttrs | ||
| 31 | |||
| 32 | def __init__(self, writePriority=110, *args, **kwargs): | ||
| 33 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 34 | self.op = self._getParser() | ||
| 35 | self.zerombr = kwargs.get("zerombr", False) | ||
| 36 | |||
| 37 | def __str__(self): | ||
| 38 | retval = KickstartCommand.__str__(self) | ||
| 39 | |||
| 40 | if self.zerombr: | ||
| 41 | retval += "# Clear the Master Boot Record\nzerombr\n" | ||
| 42 | |||
| 43 | return retval | ||
| 44 | |||
| 45 | def _getParser(self): | ||
| 46 | op = KSOptionParser() | ||
| 47 | return op | ||
| 48 | |||
| 49 | def parse(self, args): | ||
| 50 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 51 | |||
| 52 | if len(extra) > 0: | ||
| 53 | warnings.warn(_("Ignoring deprecated option on line %s: The zerombr command no longer takes any options. In future releases, this will result in a fatal error from kickstart. Please modify your kickstart file to remove any options.") % self.lineno, DeprecationWarning) | ||
| 54 | |||
| 55 | self.zerombr = True | ||
| 56 | return self | ||
| 57 | |||
| 58 | class F9_ZeroMbr(FC3_ZeroMbr): | ||
| 59 | removedKeywords = FC3_ZeroMbr.removedKeywords | ||
| 60 | removedAttrs = FC3_ZeroMbr.removedAttrs | ||
| 61 | |||
| 62 | def parse(self, args): | ||
| 63 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 64 | |||
| 65 | if len(extra) > 0: | ||
| 66 | raise KickstartParseError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % "zerombr") | ||
| 67 | |||
| 68 | self.zerombr = True | ||
| 69 | return self | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py b/scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py new file mode 100644 index 0000000000..1ed2694c89 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | import gettext | ||
| 24 | import warnings | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_ZFCPData(BaseData): | ||
| 28 | removedKeywords = BaseData.removedKeywords | ||
| 29 | removedAttrs = BaseData.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, *args, **kwargs): | ||
| 32 | BaseData.__init__(self, *args, **kwargs) | ||
| 33 | self.devnum = kwargs.get("devnum", "") | ||
| 34 | self.wwpn = kwargs.get("wwpn", "") | ||
| 35 | self.fcplun = kwargs.get("fcplun", "") | ||
| 36 | self.scsiid = kwargs.get("scsiid", "") | ||
| 37 | self.scsilun = kwargs.get("scsilun", "") | ||
| 38 | |||
| 39 | def __eq__(self, y): | ||
| 40 | return self.devnum == y.devnum and self.wwpn == y.wwpn and \ | ||
| 41 | self.fcplun == y.fcplun and self.scsiid == y.scsiid and \ | ||
| 42 | self.scsilun == y.scsilun | ||
| 43 | |||
| 44 | def __str__(self): | ||
| 45 | retval = BaseData.__str__(self) | ||
| 46 | retval += "zfcp" | ||
| 47 | |||
| 48 | if self.devnum != "": | ||
| 49 | retval += " --devnum=%s" % self.devnum | ||
| 50 | if self.wwpn != "": | ||
| 51 | retval += " --wwpn=%s" % self.wwpn | ||
| 52 | if self.fcplun != "": | ||
| 53 | retval += " --fcplun=%s" % self.fcplun | ||
| 54 | if hasattr(self, "scsiid") and self.scsiid != "": | ||
| 55 | retval += " --scsiid=%s" % self.scsiid | ||
| 56 | if hasattr(self, "scsilun") and self.scsilun != "": | ||
| 57 | retval += " --scsilun=%s" % self.scsilun | ||
| 58 | |||
| 59 | return retval + "\n" | ||
| 60 | |||
| 61 | class F12_ZFCPData(FC3_ZFCPData): | ||
| 62 | removedKeywords = FC3_ZFCPData.removedKeywords + ["scsiid", "scsilun"] | ||
| 63 | removedAttrs = FC3_ZFCPData.removedAttrs + ["scsiid", "scsilun"] | ||
| 64 | |||
| 65 | def __init__(self, *args, **kwargs): | ||
| 66 | FC3_ZFCPData.__init__(self, *args, **kwargs) | ||
| 67 | self.deleteRemovedAttrs() | ||
| 68 | |||
| 69 | F14_ZFCPData = F12_ZFCPData | ||
| 70 | |||
| 71 | class FC3_ZFCP(KickstartCommand): | ||
| 72 | removedKeywords = KickstartCommand.removedKeywords | ||
| 73 | removedAttrs = KickstartCommand.removedAttrs | ||
| 74 | |||
| 75 | def __init__(self, writePriority=71, *args, **kwargs): | ||
| 76 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 77 | self.op = self._getParser() | ||
| 78 | |||
| 79 | self.zfcp = kwargs.get("zfcp", []) | ||
| 80 | |||
| 81 | def __str__(self): | ||
| 82 | retval = "" | ||
| 83 | for zfcp in self.zfcp: | ||
| 84 | retval += zfcp.__str__() | ||
| 85 | |||
| 86 | return retval | ||
| 87 | |||
| 88 | def _getParser(self): | ||
| 89 | op = KSOptionParser() | ||
| 90 | op.add_option("--devnum", dest="devnum", required=1) | ||
| 91 | op.add_option("--fcplun", dest="fcplun", required=1) | ||
| 92 | op.add_option("--scsiid", dest="scsiid", required=1) | ||
| 93 | op.add_option("--scsilun", dest="scsilun", required=1) | ||
| 94 | op.add_option("--wwpn", dest="wwpn", required=1) | ||
| 95 | return op | ||
| 96 | |||
| 97 | def parse(self, args): | ||
| 98 | zd = self.handler.ZFCPData() | ||
| 99 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 100 | self._setToObj(self.op, opts, zd) | ||
| 101 | zd.lineno = self.lineno | ||
| 102 | |||
| 103 | # Check for duplicates in the data list. | ||
| 104 | if zd in self.dataList(): | ||
| 105 | warnings.warn(_("A zfcp with this information has already been defined.")) | ||
| 106 | |||
| 107 | return zd | ||
| 108 | |||
| 109 | def dataList(self): | ||
| 110 | return self.zfcp | ||
| 111 | |||
| 112 | class F12_ZFCP(FC3_ZFCP): | ||
| 113 | removedKeywords = FC3_ZFCP.removedKeywords | ||
| 114 | removedAttrs = FC3_ZFCP.removedAttrs + ["scsiid", "scsilun"] | ||
| 115 | |||
| 116 | def __init__(self, *args, **kwargs): | ||
| 117 | FC3_ZFCP.__init__(self, *args, **kwargs) | ||
| 118 | self.deleteRemovedAttrs() | ||
| 119 | |||
| 120 | def _getParser(self): | ||
| 121 | op = FC3_ZFCP._getParser(self) | ||
| 122 | op.add_option("--scsiid", deprecated=1) | ||
| 123 | op.add_option("--scsilun", deprecated=1) | ||
| 124 | return op | ||
| 125 | |||
| 126 | class F14_ZFCP(F12_ZFCP): | ||
| 127 | removedKeywords = F12_ZFCP.removedKeywords | ||
| 128 | removedAttrs = F12_ZFCP.removedAttrs | ||
| 129 | |||
| 130 | def _getParser(self): | ||
| 131 | op = F12_ZFCP._getParser(self) | ||
| 132 | op.remove_option("--scsiid") | ||
| 133 | op.remove_option("--scsilun") | ||
| 134 | return op | ||
