def _get_parts(self):
if not self.ks:
- raise CreatorError("Failed to get partition info," \
- "please check your kickstart setting")
- #Set a default partition if no partition is given out
+ raise CreatorError("Failed to get partition info, "
+ "please check your kickstart setting.")
+
+ # Set a default partition if no partition is given out
if not self.ks.handler.partition.partitions:
partstr = "part / --size 1900 --ondisk sda --fstype=ext3"
args = partstr.split()
if pd not in self.ks.handler.partition.partitions:
self.ks.handler.partition.partitions.append(pd)
- #list of partitions from kickstart file
- parts = kickstart.get_partitions(self.ks)
-
- return parts
+ # partitions list from kickstart file
+ return kickstart.get_partitions(self.ks)
def get_diskinfo(self):
break
else:
found = False
+
if not found:
self._diskinfo.append({ 'name': disk, 'size': size })
+
return self._diskinfo
#
meter = progress.TextMeter()
meter.start(size=disk_size,
text="Generating disk signature for %s-%s.%s" \
- % (self.name,name,self.__disk_format))
+ % (self.name,
+ name,
+ self.__disk_format))
xml += " <disk file='%s-%s.%s' use='system' format='%s'>\n" \
- % (self.name,name, self.__disk_format, self.__disk_format)
+ % (self.name,
+ name,
+ self.__disk_format,
+ self.__disk_format)
try:
import hashlib
else:
for name in self.__disks.keys():
xml += " <disk file='%s-%s.%s' use='system' format='%s'/>\n"\
- %(self.name,name, self.__disk_format, self.__disk_format)
+ %(self.name,
+ name,
+ self.__disk_format,
+ self.__disk_format)
xml += " </storage>\n"
xml += "</image>\n"
try:
shutil.copyfile(tz_source, tz_dest)
except (IOError, OSError), (errno, msg):
- raise errors.KickstartError("Error copying timezone info from '%s' to '%s': %s" %(tz_source, tz_dest, msg))
+ raise errors.KickstartError("Error copying timezone info from "
+ "'%s' to '%s': %s" \
+ % (tz_source, tz_dest, msg))
class AuthConfig(KickstartConfig):
def set_unencrypted(self, password):
for p in ("/bin/echo", "/usr/sbin/chpasswd"):
if not os.path.exists("%s/%s" %(self.instroot, p)):
- raise errors.KsError("Unable to set unencrypted password due to lack of %s" % p)
+ raise errors.KsError("Unable to set unencrypted password due "
+ "to lack of %s" % p)
p1 = subprocess.Popen(["/bin/echo", "root:%s" %password],
stdout = subprocess.PIPE,
def set_unencrypted_passwd(self, user, password):
for p in ("/bin/echo", "/usr/sbin/chpasswd"):
if not os.path.exists("%s/%s" %(self.instroot, p)):
- raise errors.KsError("Unable to set unencrypted password due to lack of %s" % p)
+ raise errors.KsError("Unable to set unencrypted password due "
+ "to lack of %s" % p)
p1 = subprocess.Popen(["/bin/echo", "%s:%s" %(user, password)],
stdout = subprocess.PIPE,
os.close(dev_null)
if userconfig.password not in (None, ""):
if userconfig.isCrypted:
- self.set_encrypted_passwd(userconfig.name, userconfig.password)
+ self.set_encrypted_passwd(userconfig.name,
+ userconfig.password)
else:
- self.set_unencrypted_passwd(userconfig.name, userconfig.password)
+ self.set_unencrypted_passwd(userconfig.name,
+ userconfig.password)
else:
self.set_empty_passwd(userconfig.name)
else:
- raise errors.KsError("Invalid kickstart command: %s" % userconfig.__str__())
+ raise errors.KsError("Invalid kickstart command: %s" \
+ % userconfig.__str__())
def apply(self, user):
for userconfig in user.userList:
baseurl = repo.baseurl
if repo.mirrorlist:
mirrorlist = repo.mirrorlist
+
elif type == "debuginfo":
if repo.baseurl:
if repo.baseurl.endswith("/"):
else:
baseurl = os.path.dirname(repo.baseurl)
baseurl += "/debug"
+
if repo.mirrorlist:
variant = repo.mirrorlist[repo.mirrorlist.find("$"):]
mirrorlist = repo.mirrorlist[0:repo.mirrorlist.find("$")]
mirrorlist += "debug" + "-" + variant
+
elif type == "source":
if repo.baseurl:
if repo.baseurl.endswith("/"):
- baseurl = os.path.dirname(os.path.dirname(os.path.dirname(repo.baseurl)))
+ baseurl = os.path.dirname(
+ os.path.dirname(
+ os.path.dirname(repo.baseurl)))
else:
baseurl = os.path.dirname(os.path.dirname(repo.baseurl))
baseurl += "/source"
+
if repo.mirrorlist:
variant = repo.mirrorlist[repo.mirrorlist.find("$"):]
mirrorlist = repo.mirrorlist[0:repo.mirrorlist.find("$")]
if repodata:
for repo in repodata:
if repo['repokey']:
- runner.quiet(['rpm', "--root=%s" % self.instroot, "--import", repo['repokey']])
+ runner.quiet(['rpm',
+ "--root=%s" % self.instroot,
+ "--import",
+ repo['repokey']])
class RPMMacroConfig(KickstartConfig):
"""A class to apply the specified rpm macros to the filesystem"""
ks = creatoropts['ks']
for repo in repometadata:
- """ Mustn't replace group with package list if repo is ready for the corresponding package manager """
+ """ Mustn't replace group with package list if repo is ready for the
+ corresponding package manager.
+ """
+
if iszypp and repo["patterns"]:
continue
if not iszypp and repo["comps"]:
continue
- """
- But we also must handle such cases, use zypp but repo only has comps,
- use yum but repo only has patterns, use zypp but use_comps is true,
- use yum but use_comps is false.
- """
+ # But we also must handle such cases, use zypp but repo only has comps,
+ # use yum but repo only has patterns, use zypp but use_comps is true,
+ # use yum but use_comps is false.
groupfile = None
if iszypp and repo["comps"]:
groupfile = repo["comps"]
while True:
if i >= len(ks.handler.packages.groupList):
break
- pkglist = get_pkglist_handler(ks.handler.packages.groupList[i].name, groupfile)
+ pkglist = get_pkglist_handler(
+ ks.handler.packages.groupList[i].name,
+ groupfile)
if pkglist:
del ks.handler.packages.groupList[i]
for pkg in pkglist:
from pykickstart.options import *
class Moblin_Desktop(KickstartCommand):
- def __init__(self, writePriority=0, defaultdesktop=None, defaultdm=None, autologinuser="meego", session=None):
+ def __init__(self, writePriority=0,
+ defaultdesktop=None,
+ defaultdm=None,
+ autologinuser="meego",
+ session=None):
+
KickstartCommand.__init__(self, writePriority)
self.__new_version = False
op = KSOptionParser()
self.__new_version = True
- op.add_option("--defaultdesktop", dest="defaultdesktop", action="store", type="string", nargs=1)
- op.add_option("--autologinuser", dest="autologinuser", action="store", type="string", nargs=1)
- op.add_option("--defaultdm", dest="defaultdm", action="store", type="string", nargs=1)
- op.add_option("--session", dest="session", action="store", type="string", nargs=1)
+ op.add_option("--defaultdesktop", dest="defaultdesktop",
+ action="store",
+ type="string",
+ nargs=1)
+ op.add_option("--autologinuser", dest="autologinuser",
+ action="store",
+ type="string",
+ nargs=1)
+ op.add_option("--defaultdm", dest="defaultdm",
+ action="store",
+ type="string",
+ nargs=1)
+ op.add_option("--session", dest="session",
+ action="store",
+ type="string",
+ nargs=1)
return op
def parse(self, args):
(opts, extra) = self.op.parse_args(args=args)
if extra:
- mapping = {"command": "desktop", "options": extra}
- raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping)
+ m = _("Unexpected arguments to %(command)s command: %(options)s") \
+ % {"command": "desktop", "options": extra}
+ raise KickstartValueError, formatErrorMsg(self.lineno, msg=m)
self._setToSelf(self.op, opts)
default=False)
op.add_option("--proxy", type="string", action="store", dest="proxy",
default=None, nargs=1)
- op.add_option("--proxyuser", type="string", action="store", dest="proxy_username",
- default=None, nargs=1)
- op.add_option("--proxypasswd", type="string", action="store", dest="proxy_password",
- default=None, nargs=1)
+ op.add_option("--proxyuser", type="string", action="store",
+ dest="proxy_username", default=None, nargs=1)
+ op.add_option("--proxypasswd", type="string", action="store",
+ dest="proxy_password", default=None, nargs=1)
op.add_option("--debuginfo", action="store_true", dest="debuginfo",
default=False)
op.add_option("--source", action="store_true", dest="source",
default=False)
op.add_option("--gpgkey", type="string", action="store", dest="gpgkey",
default=None, nargs=1)
- op.add_option("--ssl_verify", type="string", action="store", dest="ssl_verify",
- default="yes")
+ op.add_option("--ssl_verify", type="string", action="store",
+ dest="ssl_verify", default="yes")
op.add_option("--priority", type="int", action="store", dest="priority",
default=None)
return op