def __set_ksconf(self, ksconf):
if not os.path.isfile(ksconf):
- msger.error('Cannot find ks file: %s' % ksconf)
+ raise errors.KsError('Cannot find ks file: %s' % ksconf)
self.__ksconf = ksconf
self._parse_kickstart(ksconf)
if m:
scheme = m.group(1)
if scheme not in ('http', 'https', 'ftp', 'socks'):
- msger.error("%s: proxy scheme is incorrect" % siteconf)
+ raise errors.ConfigError("%s: proxy scheme is incorrect" % siteconf)
else:
msger.warning("%s: proxy url w/o scheme, use http as default"
% siteconf)
def set_runtime(self, runtime):
if runtime not in ("bootstrap", "native"):
- msger.error("Invalid runtime mode: %s" % runtime)
+ raise errors.CreatorError("Invalid runtime mode: %s" % runtime)
if misc.get_distro()[0] in ("tizen", "Tizen"):
runtime = "native"
for cdir in ('outdir', 'cachedir'):
if os.path.exists(configmgr.create[cdir]) \
and not os.path.isdir(configmgr.create[cdir]):
- msger.error('Invalid directory specified: %s' \
- % configmgr.create[cdir])
+ raise errors.Usage('Invalid directory specified: %s' \
+ % configmgr.create[cdir])
if not os.path.exists(configmgr.create[cdir]):
os.makedirs(configmgr.create[cdir])
if os.getenv('SUDO_UID', '') and os.getenv('SUDO_GID', ''):
if self.options.local_pkgs_path is not None:
if not os.path.exists(self.options.local_pkgs_path):
- msger.error('Local pkgs directory: \'%s\' not exist' \
+ raise errors.Usage('Local pkgs directory: \'%s\' not exist' \
% self.options.local_pkgs_path)
configmgr.create['local_pkgs_path'] = self.options.local_pkgs_path
except cmdln.CmdlnUserError, ex:
msg = "%s: %s\nTry '%s help' for info.\n"\
% (self.name, ex, self.name)
- msger.error(msg)
+ raise errors.Usage(msg)
except cmdln.StopOptionProcessing, ex:
return 0
elif fstype in ("vfat", "msdos"):
MyDiskMount = fs.VfatDiskMount
else:
- msger.error('Cannot support fstype: %s' % fstype)
+ raise MountError('Cannot support fstype: %s' % fstype)
loop['loop'] = MyDiskMount(fs.SparseLoopbackDisk(
os.path.join(self.__imgdir, imgname),
self.cleanup()
self.device = None
except MountError, e:
- msger.error("%s" % e)
+ raise CreatorError("%s" % e)
def cleanup(self):
except OSError, e:
if e.errno == 2:
# [Errno 2] No such file or directory
- msger.error('Cannot run command: %s, lost dependency?' % cmd)
+ raise errors.CreatorError('Cannot run command: %s, lost dependency?' % cmd)
else:
raise # relay
finally:
elif fstype in ("vfat", "msdos"):
myDiskMount = fs_related.VfatDiskMount
else:
- msger.error("Cannot support fstype: %s" % fstype)
+ raise errors.CreatorError("Cannot support fstype: %s" % fstype)
name = os.path.join(tmpdir, name)
size = size * 1024L * 1024L