2 # Copyright (C) 2014 Red Hat, Inc.
4 # This copyrighted material is made available to anyone wishing to use,
5 # modify, copy, or redistribute it subject to the terms and conditions of
6 # the GNU General Public License v.2, or (at your option) any later version.
7 # This program is distributed in the hope that it will be useful, but WITHOUT
8 # ANY WARRANTY expressed or implied, including the implied warranties of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10 # Public License for more details. You should have received a copy of the
11 # GNU General Public License along with this program; if not, write to the
12 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
13 # 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
14 # source code or documentation are not subject to the GNU General Public
15 # License and may only be used or replicated with the express permission of
19 from pykickstart
.base
import KickstartCommand
20 from pykickstart
.options
import KSOptionParser
23 _
= lambda x
: gettext
.ldgettext("pykickstart", x
)
25 class F21_OSTreeSetup(KickstartCommand
):
26 removedKeywords
= KickstartCommand
.removedKeywords
27 removedAttrs
= KickstartCommand
.removedAttrs
29 def __init__(self
, *args
, **kwargs
):
30 KickstartCommand
.__init
__(self
, *args
, **kwargs
)
31 self
.op
= self
._getParser
()
32 self
.osname
= kwargs
.get('osname', None)
33 self
.remote
= kwargs
.get("remote", self
.osname
)
34 self
.url
= kwargs
.get('url', None)
35 self
.ref
= kwargs
.get('ref', None)
36 self
.nogpg
= kwargs
.get('nogpg', False)
39 retval
= KickstartCommand
.__str
__(self
)
42 retval
+= "# OSTree setup\n"
43 retval
+= "ostreesetup %s\n" % self
._getArgsAsStr
()
47 def _getArgsAsStr(self
):
50 retcmd
.append('--osname="%s"' % self
.osname
)
52 retcmd
.append('--remote="%s"' % self
.remote
)
54 retcmd
.append('--url="%s"' % self
.url
)
56 retcmd
.append('--ref="%s"' % self
.ref
)
58 retcmd
.append('--nogpg')
59 return ' '.join(retcmd
)
63 op
.add_option("--osname", dest
="osname", required
=1)
64 op
.add_option("--remote", dest
="remote")
65 op
.add_option("--url", dest
="url", required
=1)
66 op
.add_option("--ref", dest
="ref", required
=1)
67 op
.add_option("--nogpg", action
="store_true")
70 def parse(self
, args
):
71 (opts
, _extra
) = self
.op
.parse_args(args
=args
, lineno
=self
.lineno
)
72 self
._setToSelf
(self
.op
, opts
)
73 if self
.remote
is None:
74 self
.remote
= self
.osname