Add new RHEL7 logvol objects to master
[pykickstart.git] / pykickstart / commands / nfs.py
bloba128f8367e2d38ddfe86ce51af7d879f4f81609b
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 FC3_NFS(KickstartCommand):
27 removedKeywords = KickstartCommand.removedKeywords
28 removedAttrs = KickstartCommand.removedAttrs
30 def __init__(self, writePriority=0, *args, **kwargs):
31 KickstartCommand.__init__(self, writePriority, *args, **kwargs)
32 self.server = kwargs.get("server", None)
33 self.dir = kwargs.get("dir", None)
35 self.op = self._getParser()
37 def __eq__(self, other):
38 if not other:
39 return False
41 return self.server == other.server and self.dir == other.dir
43 def __ne__(self, other):
44 return not self == other
46 def __str__(self):
47 retval = KickstartCommand.__str__(self)
48 if not self.seen:
49 return retval
51 retval += "# Use NFS installation media\nnfs --server=%s --dir=%s\n" % (self.server, self.dir)
52 return retval
54 def _getParser(self):
55 op = KSOptionParser()
56 op.add_option("--server", dest="server", required=1)
57 op.add_option("--dir", dest="dir", required=1)
59 return op
61 def parse(self, args):
62 (opts, _extra) = self.op.parse_args(args=args, lineno=self.lineno)
63 self._setToSelf(self.op, opts)
65 return self
67 class FC6_NFS(FC3_NFS):
68 removedKeywords = FC3_NFS.removedKeywords
69 removedAttrs = FC3_NFS.removedAttrs
71 def __init__(self, writePriority=0, *args, **kwargs):
72 FC3_NFS.__init__(self, writePriority, *args, **kwargs)
73 self.opts = kwargs.get("opts", None)
75 def __eq__(self, other):
76 if not FC3_NFS.__eq__(self, other):
77 return False
79 return self.opts == other.opts
81 def __str__(self):
82 retval = FC3_NFS.__str__(self)
84 if self.seen and self.opts:
85 retval = retval.rstrip()
86 retval += " --opts=\"%s\"\n" % self.opts
88 return retval
90 def _getParser(self):
91 op = FC3_NFS._getParser(self)
92 op.add_option("--opts", dest="opts")
93 return op