2 # Copyright (c) 2008, 2009, 2010 Intel, Inc.
4 # Yi Yang <yi.y.yang@intel.com>
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the Free
8 # Software Foundation; version 2 of the License
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc., 59
17 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 from pykickstart.commands.repo import F14_RepoData, F14_Repo
22 class Mic_RepoData(F14_RepoData):
23 "Mic customized repo data"
25 def __init__(self, *args, **kw):
26 F14_RepoData.__init__(self, *args, **kw)
27 for field in ('save', 'proxyuser', 'proxypasswd', 'debuginfo',
28 'disable', 'source', 'gpgkey', 'ssl_verify', 'priority',
29 'nocache', 'user', 'passwd'):
30 setattr(self, field, kw.get(field))
32 if hasattr(self, 'proxy') and not self.proxy:
33 # TODO: remove this code, since it only for back-compatible.
34 # Some code behind only accept None but not empty string
38 def _getArgsAsStr(self):
39 retval = F14_RepoData._getArgsAsStr(self)
41 for field in ('proxyuser', 'proxypasswd', 'user', 'passwd',
42 'gpgkey', 'ssl_verify', 'priority',
44 if hasattr(self, field) and getattr(self, field):
45 retval += ' --%s="%s"' % (field, getattr(self, field))
47 for field in ('save', 'diable', 'nocache', 'source', 'debuginfo'):
48 if hasattr(self, field) and getattr(self, field):
49 retval += ' --%s' % field
54 class Mic_Repo(F14_Repo):
55 "Mic customized repo command"
58 op = F14_Repo._getParser(self)
59 op.add_option('--user')
60 op.add_option('--passwd')
61 op.add_option("--proxyuser")
62 op.add_option("--proxypasswd")
64 op.add_option("--save", action="store_true", default=False)
65 op.add_option("--debuginfo", action="store_true", default=False)
66 op.add_option("--source", action="store_true", default=False)
67 op.add_option("--disable", action="store_true", default=False)
68 op.add_option("--nocache", action="store_true", default=False)
70 op.add_option("--gpgkey")
71 op.add_option("--priority", type="int")
72 op.add_option("--ssl_verify", default=None)