From: Gui Chen Date: Mon, 19 May 2014 05:41:14 +0000 (-0400) Subject: put logfile setting up prior to other error output X-Git-Tag: upstream/0.27.1~5^2~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b8bdbd2a624e21e3bb8cb05203a86e36b3b62d4;p=platform%2Fupstream%2Fmic.git put logfile setting up prior to other error output except release optioin applied Change-Id: I10eaac322424460694566a79eda5e53642d798fe Signed-off-by: Gui Chen --- diff --git a/mic/conf.py b/mic/conf.py index a945f6a..b4aa235 100644 --- a/mic/conf.py +++ b/mic/conf.py @@ -219,17 +219,7 @@ class ConfigMgr(object): self.create['logfile'] = os.path.join(self.create['outdir'], self.create['name'] + ".log") self.create['releaselog'] = True - - if self.create['logfile']: - logfile_dir = os.path.dirname(self.create['logfile']) - if not os.path.exists(logfile_dir): - os.makedirs(logfile_dir) - msger.set_interactive(False) - if inbootstrap(): - mode = 'a' - else: - mode = 'w' - msger.set_logfile(self.create['logfile'], mode) + self.set_logfile() msger.info("Retrieving repo metadata:") ksrepos = kickstart.get_repos(ks, @@ -270,6 +260,20 @@ class ConfigMgr(object): misc.selinux_check(self.create['arch'], [p.fstype for p in ks.handler.partition.partitions]) + def set_logfile(self, logfile = None): + if not logfile: + logfile = self.create['logfile'] + + logfile_dir = os.path.dirname(self.create['logfile']) + if not os.path.exists(logfile_dir): + os.makedirs(logfile_dir) + msger.set_interactive(False) + if inbootstrap(): + mode = 'a' + else: + mode = 'w' + msger.set_logfile(self.create['logfile'], mode) + def set_runtime(self, runtime): if runtime not in ("bootstrap", "native"): raise errors.CreatorError("Invalid runtime mode: %s" % runtime) diff --git a/mic/creator.py b/mic/creator.py index b21ebda..dde1013 100644 --- a/mic/creator.py +++ b/mic/creator.py @@ -183,6 +183,7 @@ class Creator(cmdln.Cmdln): raise errors.Usage("logfile's path %s should be file" % self.options.logfile) configmgr.create['logfile'] = logfile_abs_path + configmgr.set_logfile() if self.options.config: configmgr.reset()