import subprocess
import rpm
import glob
+import errno
from mic import msger
from mic.utils import errors, proxy, misc
# list means some errors happened in the transaction and non-empty
# list that there were errors preventing the ts from starting...
if errs is not None:
- raise errors.BootstrapError("Transaction couldn't start: %s" % '\n'.join(errs))
+ raise errors.BootstrapError("Transaction couldn't start: %s" % errs)
def run_pkg_script(self, pkg, prog, script, arg):
mychroot = lambda: os.chroot(self.rootdir)
script = script.replace('\r', '')
os.write(tmpfd, script)
os.close(tmpfd)
- os.chmod(tmpfp, 0700)
+ os.chmod(tmpfp, 0o700)
try:
script_fp = os.path.join('/tmp', os.path.basename(tmpfp))
subprocess.call([prog, script_fp, arg], preexec_fn=mychroot)
- except (OSError, IOError), err:
+ except (OSError, IOError) as err:
msger.warning(str(err))
finally:
os.unlink(tmpfp)
pkgmgr.optionals = list(optlist)
map(pkgmgr.selectPackage, pkglist + list(optlist))
pkgmgr.runInstall()
- except (OSError, IOError, errors.CreatorError), err:
+ except (OSError, IOError, errors.CreatorError) as err:
raise errors.BootstrapError("%s" % err)
def run(self, cmd, chdir, rootdir=None, bindmounts=None):
gloablmounts = None
try:
proxy.set_proxy_environ()
- gloablmounts = setup_chrootenv(rootdir, bindmounts)
+ #globalmounts is no useless, remove it, currently function always return none.
+ setup_chrootenv(rootdir, bindmounts)
sync_timesetting(rootdir)
sync_passwdfile(rootdir)
sync_hostfile(rootdir)
# add additional information to original exception
value, tb = sys.exc_info()[1:]
value = '%s: %s' % (value, ' '.join(cmd))
- raise RuntimeError, value, tb
+ raise RuntimeError (value, tb)
finally:
#if self.logfile and os.path.isfile(self.logfile):
# msger.log(file(self.logfile).read())