Add new RHEL7 logvol objects to master
[pykickstart.git] / pykickstart / commands / monitor.py
blob45f54487916bd2f400b4008a7d2052bea32bbde8
2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc.
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.
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.
20 from pykickstart.base import DeprecatedCommand, KickstartCommand
21 from pykickstart.errors import KickstartValueError, formatErrorMsg
22 from pykickstart.options import KSOptionParser
24 import gettext
25 _ = lambda x: gettext.ldgettext("pykickstart", x)
27 class FC3_Monitor(KickstartCommand):
28 removedKeywords = KickstartCommand.removedKeywords
29 removedAttrs = KickstartCommand.removedAttrs
31 def __init__(self, writePriority=0, *args, **kwargs):
32 KickstartCommand.__init__(self, writePriority, *args, **kwargs)
33 self.op = self._getParser()
35 self.hsync = kwargs.get("hsync", "")
36 self.monitor = kwargs.get("monitor", "")
37 self.vsync = kwargs.get("vsync", "")
39 def __str__(self):
40 retval = KickstartCommand.__str__(self)
41 retval += "monitor"
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
50 if retval != "monitor":
51 return retval + "\n"
52 else:
53 return ""
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
62 def parse(self, args):
63 (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
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))
69 self._setToSelf(self.op, opts)
70 return self
72 class FC6_Monitor(FC3_Monitor):
73 removedKeywords = FC3_Monitor.removedKeywords
74 removedAttrs = FC3_Monitor.removedAttrs
76 def __init__(self, writePriority=0, *args, **kwargs):
77 FC3_Monitor.__init__(self, writePriority, *args, **kwargs)
78 self.probe = kwargs.get("probe", True)
80 def __str__(self):
81 retval = KickstartCommand.__str__(self)
82 retval += "monitor"
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
93 if retval != "monitor":
94 return retval + "\n"
95 else:
96 return ""
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
104 class F10_Monitor(DeprecatedCommand):
105 def __init__(self):
106 DeprecatedCommand.__init__(self)