Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/
Date: Sun, 11 Oct 2015 17:26:54
Message-Id: 1444542976.05ff22304f888a04af694279ddecf395dce38e89.vapier@gentoo
1 commit: 05ff22304f888a04af694279ddecf395dce38e89
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 10 05:31:21 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 11 05:56:16 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=05ff2230
7
8 netboot: convert to log module
9
10 catalyst/targets/netboot.py | 6 +++---
11 catalyst/targets/netboot2.py | 19 ++++++++++---------
12 2 files changed, 13 insertions(+), 12 deletions(-)
13
14 diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
15 index 46ec4eb..333a230 100644
16 --- a/catalyst/targets/netboot.py
17 +++ b/catalyst/targets/netboot.py
18 @@ -6,7 +6,7 @@ netboot target, version 1
19 import os
20 import types
21
22 -
23 +from catalyst import log
24 from catalyst.support import (CatalystError, normpath,
25 cmd, list_bashify, file_locate)
26
27 @@ -58,7 +58,7 @@ class netboot(StageBase):
28 def set_root_path(self):
29 # ROOT= variable for emerges
30 self.settings["root_path"]=normpath("/tmp/image")
31 - print "netboot root path is "+self.settings["root_path"]
32 + log.info('netboot root path is %s', self.settings['root_path'])
33
34 # def build_packages(self):
35 # # build packages
36 @@ -123,7 +123,7 @@ class netboot(StageBase):
37 raise CatalystError("netboot build aborting due to error.",
38 print_traceback=True)
39 # end
40 - print "netboot: build finished !"
41 + log.notice('netboot: build finished !')
42
43 def set_action_sequence(self):
44 self.settings["action_sequence"]=["unpack","unpack_snapshot",
45
46 diff --git a/catalyst/targets/netboot2.py b/catalyst/targets/netboot2.py
47 index 5508367..d882a06 100644
48 --- a/catalyst/targets/netboot2.py
49 +++ b/catalyst/targets/netboot2.py
50 @@ -8,6 +8,7 @@ import types
51 import shutil
52 from stat import ST_UID, ST_GID, ST_MODE
53
54 +from catalyst import log
55 from catalyst.support import (CatalystError, normpath, cmd, list_bashify)
56 from catalyst.fileops import ensure_dirs
57
58 @@ -53,7 +54,7 @@ class netboot2(StageBase):
59 self.settings["target_subpath"])
60 if "autoresume" in self.settings["options"] \
61 and self.resume.is_enabled("setup_target_path"):
62 - print "Resume point detected, skipping target path setup operation..."
63 + log.notice('Resume point detected, skipping target path setup operation...')
64 else:
65 # first clean up any existing target stuff
66 if os.path.isfile(self.settings["target_path"]):
67 @@ -69,7 +70,7 @@ class netboot2(StageBase):
68 # check for autoresume point
69 if "autoresume" in self.settings["options"] \
70 and self.resume.is_enabled("copy_files_to_image"):
71 - print "Resume point detected, skipping target path setup operation..."
72 + log.notice('Resume point detected, skipping target path setup operation...')
73 else:
74 if "netboot2/packages" in self.settings:
75 if type(self.settings["netboot2/packages"]) == types.StringType:
76 @@ -103,7 +104,7 @@ class netboot2(StageBase):
77 def setup_overlay(self):
78 if "autoresume" in self.settings["options"] \
79 and self.resume.is_enabled("setup_overlay"):
80 - print "Resume point detected, skipping setup_overlay operation..."
81 + log.notice('Resume point detected, skipping setup_overlay operation...')
82 else:
83 if "netboot2/overlay" in self.settings:
84 for x in self.settings["netboot2/overlay"]:
85 @@ -119,7 +120,7 @@ class netboot2(StageBase):
86 try:
87 cmd(self.settings["controller_file"]+\
88 " final",env=self.env)
89 - print ">>> Netboot Build Finished!"
90 + log.notice('Netboot Build Finished!')
91 except CatalystError:
92 self.unbind()
93 raise CatalystError("Failed to move kernel images!",
94 @@ -128,20 +129,20 @@ class netboot2(StageBase):
95 def remove(self):
96 if "autoresume" in self.settings["options"] \
97 and self.resume.is_enabled("remove"):
98 - print "Resume point detected, skipping remove operation..."
99 + log.notice('Resume point detected, skipping remove operation...')
100 else:
101 if self.settings["spec_prefix"]+"/rm" in self.settings:
102 for x in self.settings[self.settings["spec_prefix"]+"/rm"]:
103 # we're going to shell out for all these cleaning operations,
104 # so we get easy glob handling
105 - print "netboot2: removing " + x
106 + log.notice('netboot2: removing %s', x)
107 os.system("rm -rf " + self.settings["chroot_path"] +
108 self.settings["merge_path"] + x)
109
110 def empty(self):
111 if "autoresume" in self.settings["options"] \
112 and self.resume.is_enabled("empty"):
113 - print "Resume point detected, skipping empty operation..."
114 + log.notice('Resume point detected, skipping empty operation...')
115 else:
116 if "netboot2/empty" in self.settings:
117 if type(self.settings["netboot2/empty"])==types.StringType:
118 @@ -149,9 +150,9 @@ class netboot2(StageBase):
119 for x in self.settings["netboot2/empty"]:
120 myemp=self.settings["chroot_path"] + self.settings["merge_path"] + x
121 if not os.path.isdir(myemp):
122 - print x,"not a directory or does not exist, skipping 'empty' operation."
123 + log.warning('not a directory or does not exist, skipping "empty" operation: %s', x)
124 continue
125 - print "Emptying directory", x
126 + log.info('Emptying directory %s', x)
127 # stat the dir, delete the dir, recreate the dir and set
128 # the proper perms and ownership
129 mystat=os.stat(myemp)