Add new RHEL7 logvol objects to master
[pykickstart.git] / pykickstart / commands / liveimg.py
blob2274bfac761048ac467746baa4557a0a8d7ecb47
2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 2007, 2009, 2013 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 KickstartCommand
21 from pykickstart.options import KSOptionParser
23 import gettext
24 _ = lambda x: gettext.ldgettext("pykickstart", x)
26 class F19_Liveimg(KickstartCommand):
27 removedKeywords = KickstartCommand.removedKeywords
28 removedAttrs = KickstartCommand.removedAttrs
30 def __init__(self, *args, **kwargs):
31 KickstartCommand.__init__(self, *args, **kwargs)
32 self.checksum = kwargs.get("checksum", "")
33 self.noverifyssl = kwargs.get("noverifyssl", None)
34 self.proxy = kwargs.get("proxy", None)
35 self.url = kwargs.get("url", None)
37 self.op = self._getParser()
39 def __eq__(self, other):
40 return self.url == other.url and self.proxy == other.proxy and \
41 self.noverifyssl == other.noverifyssl and \
42 self.checksum == other.checksum
44 def __str__(self):
45 retval = KickstartCommand.__str__(self)
46 if not self.seen:
47 return retval
49 retval += "# Use live disk image installation\n"
51 retval += "liveimg --url=\"%s\"" % self.url
53 if self.proxy:
54 retval += " --proxy=\"%s\"" % self.proxy
56 if self.noverifyssl:
57 retval += " --noverifyssl"
59 if self.checksum:
60 retval += " --checksum=\"%s\"" % self.checksum
62 return retval + "\n"
64 def _getParser(self):
65 op = KSOptionParser()
66 op.add_option("--url", required=1)
67 op.add_option("--proxy")
68 op.add_option("--noverifyssl", action="store_true", default=False)
69 op.add_option("--checksum")
70 return op
72 def parse(self, args):
73 (opts, _extra) = self.op.parse_args(args=args, lineno=self.lineno)
74 self._setToSelf(self.op, opts)
76 return self