1 |
diff -Nur smeserver-yum-2.6.0.bz8705.old/root/usr/lib/yum-plugins/smeserver.py smeserver-yum-2.6.0.bz8705.new/root/usr/lib/yum-plugins/smeserver.py |
diff -Nur smeserver-yum-2.6.0.bz8705.old/root/usr/lib/yum-plugins/smeserver.py smeserver-yum-2.6.0.bz8705.new/root/usr/lib/yum-plugins/smeserver.py |
2 |
--- smeserver-yum-2.6.0.bz8705.old/root/usr/lib/yum-plugins/smeserver.py 2013-01-31 17:35:08.000000000 +0100 |
--- smeserver-yum-2.6.0.bz8705.old/root/usr/lib/yum-plugins/smeserver.py 2013-01-31 17:35:08.000000000 +0100 |
3 |
+++ smeserver-yum-2.6.0.bz8705.new/root/usr/lib/yum-plugins/smeserver.py 2017-02-18 17:59:40.293143635 +0100 |
+++ smeserver-yum-2.6.0.bz8705.new/root/usr/lib/yum-plugins/smeserver.py 2017-02-19 22:03:21.922929438 +0100 |
4 |
@@ -14,72 +14,250 @@ |
@@ -14,72 +14,278 @@ |
5 |
signal_event = '/sbin/e-smith/signal-event' |
signal_event = '/sbin/e-smith/signal-event' |
6 |
config_set = '/sbin/e-smith/config' |
config_set = '/sbin/e-smith/config' |
7 |
status_file = '/var/run/yum.status' |
status_file = '/var/run/yum.status' |
33 |
+servicenames['proftp']='proftpd', |
+servicenames['proftp']='proftpd', |
34 |
+servicenames['samba']='smbd', |
+servicenames['samba']='smbd', |
35 |
+servicenames['spamassassin']='spamd', |
+servicenames['spamassassin']='spamd', |
36 |
|
+servicenames['squid']='squid', |
37 |
+servicenames['dovecot']='dovecot','pop3','pop3s' |
+servicenames['dovecot']='dovecot','pop3','pop3s' |
38 |
+ |
+ |
39 |
|
|
40 |
smechange = False |
smechange = False |
41 |
ourfile = False |
ourfile = False |
42 |
|
+erasing = False |
43 |
|
|
44 |
def report_yum_status(status): |
def report_yum_status(status): |
45 |
- fileHandle = open(status_file, 'w') |
- fileHandle = open(status_file, 'w') |
62 |
- ourfile = True |
- ourfile = True |
63 |
- report_yum_status('prereposetup') |
- report_yum_status('prereposetup') |
64 |
+ global ourfile |
+ global ourfile |
|
+ global eventlist |
|
|
+ global actionlist |
|
|
+ global templateslist |
|
|
+ global serviceslist |
|
65 |
+ |
+ |
66 |
+ ourfile = True |
+ ourfile = True |
67 |
+ report_yum_status('prereposetup') |
+ report_yum_status('prereposetup') |
90 |
+ # otherwise for updated packages headers will not be available |
+ # otherwise for updated packages headers will not be available |
91 |
+ ts = conduit.getTsInfo() |
+ ts = conduit.getTsInfo() |
92 |
+ removes = ts.getMembersWithState(output_states=TS_REMOVE_STATES) |
+ removes = ts.getMembersWithState(output_states=TS_REMOVE_STATES) |
93 |
+ |
+ global smechange |
94 |
+ global eventlist |
+ global eventlist |
95 |
+ global actionlist |
+ global actionlist |
96 |
+ global templateslist |
+ global templateslist |
97 |
+ global serviceslist |
+ global serviceslist |
98 |
+ |
+ global erasing |
99 |
|
+ |
100 |
+ for tsmem in removes: |
+ for tsmem in removes: |
101 |
|
+ erasing = True |
102 |
+ (n, a, e, v, r) = tsmem.po.pkgtup |
+ (n, a, e, v, r) = tsmem.po.pkgtup |
103 |
+ print 'Package: ' + tsmem.name + ' remove' |
+ #only for debug |
104 |
|
+ #print 'Package: ' + tsmem.name + ' remove' |
105 |
+ smeevent = tsmem.name + '-update' |
+ smeevent = tsmem.name + '-update' |
106 |
|
+ #only for debug |
107 |
|
+ #print smeevent |
108 |
+ if os.path.isdir(events_path + os.sep + smeevent): |
+ if os.path.isdir(events_path + os.sep + smeevent): |
109 |
+ tmppath = events_path + os.sep + smeevent + os.sep |
+ tmppath = events_path + os.sep + smeevent + os.sep |
110 |
+ eventlist[tsmem.name] = smeevent |
+ eventlist[tsmem.name] = smeevent |
129 |
+ if not serviceslist.has_key(f): |
+ if not serviceslist.has_key(f): |
130 |
+ serviceslist[f]=mytmpserv |
+ serviceslist[f]=mytmpserv |
131 |
+ else: |
+ else: |
132 |
+ print "old value: " + serviceslist[f] |
+ #only for debug |
133 |
+ print "new value: " + mytmpserv |
+ #print "old value: " + serviceslist[f] |
134 |
|
+ #print "new value: " + mytmpserv |
135 |
+ |
+ |
136 |
+ if mytmpserv == "restart": |
+ if mytmpserv == "restart": |
137 |
+ print "overriding all signals, forcing restart" |
+ print "overriding all signals, forcing restart" |
140 |
+ else: |
+ else: |
141 |
+ if n.startswith('smeserver') or n.startswith('e-smith'): |
+ if n.startswith('smeserver') or n.startswith('e-smith'): |
142 |
+ smechange = True |
+ smechange = True |
143 |
|
+ |
144 |
|
+ #only for debug |
145 |
|
+ #print 'smechange: '+str(smechange) |
146 |
|
+ #print 'eventlist: '+ str(eventlist) |
147 |
|
+ #print 'templateslist: '+str(templateslist) |
148 |
|
+ #print 'serviceslist: '+str(serviceslist) |
149 |
|
|
150 |
def posttrans_hook(conduit): |
def posttrans_hook(conduit): |
151 |
- global smechange |
- global smechange |
174 |
+ global actionlist |
+ global actionlist |
175 |
+ global templateslist |
+ global templateslist |
176 |
+ global serviceslist |
+ global serviceslist |
177 |
|
+ global erasing |
178 |
+ |
+ |
179 |
|
+ |
180 |
+ for tsmem in ts.getMembers(): |
+ for tsmem in ts.getMembers(): |
181 |
+ (n, a, e, v, r) = tsmem.po.pkgtup |
+ (n, a, e, v, r) = tsmem.po.pkgtup |
182 |
+ |
+ |
183 |
|
+ #print 'smechange: '+str(smechange) |
184 |
|
+ |
185 |
+ # we're upgrading/installing/removing a rebootpkgs package.. a reboot is required |
+ # we're upgrading/installing/removing a rebootpkgs package.. a reboot is required |
186 |
+ for pkg in rebootpkgs: |
+ for pkg in rebootpkgs: |
187 |
+ if n.startswith(pkg): |
+ if n.startswith(pkg): |
200 |
+ if not serviceslist.has_key(name): |
+ if not serviceslist.has_key(name): |
201 |
+ serviceslist[name] = 'restart' |
+ serviceslist[name] = 'restart' |
202 |
+ else: |
+ else: |
203 |
+ print pkg |
+ #only for debug |
204 |
|
+ #print pkg |
205 |
+ if not serviceslist.has_key(pkg): |
+ if not serviceslist.has_key(pkg): |
206 |
+ serviceslist[pkg] = 'restart' |
+ serviceslist[pkg] = 'restart' |
207 |
+ |
+ |
|
+ #print serviceslist |
|
208 |
+ |
+ |
209 |
+ #if smechange is true we can ignore the following part |
+ #if smechange is true we can ignore the following part |
210 |
+ if not smechange: |
+ if not smechange and not erasing: |
211 |
+ |
+ |
212 |
|
+ #smeevent = 'yum-reconfigure-' + tsmem.name |
213 |
+ smeevent = tsmem.name + '-update' |
+ smeevent = tsmem.name + '-update' |
214 |
+ if os.path.isdir(events_path + os.sep + smeevent): |
+ if os.path.isdir(events_path + os.sep + smeevent): |
215 |
+ tmppath = events_path + os.sep + smeevent + os.sep |
+ tmppath = events_path + os.sep + smeevent + os.sep |
245 |
+ if not serviceslist.has_key(f): |
+ if not serviceslist.has_key(f): |
246 |
+ serviceslist[f]=mytmpserv |
+ serviceslist[f]=mytmpserv |
247 |
+ else: |
+ else: |
248 |
+ print "old value: " + serviceslist[f] |
+ #only for debug |
249 |
+ print "new value: " + mytmpserv |
+ #print "old value: " + serviceslist[f] |
250 |
|
+ #print "new value: " + mytmpserv |
251 |
+ |
+ |
252 |
+ if mytmpserv == "restart": |
+ if mytmpserv == "restart": |
253 |
|
+ #only for debug |
254 |
+ print "overriding all signals, forcing restart" |
+ print "overriding all signals, forcing restart" |
255 |
+ serviceslist[f]="restart" |
+ serviceslist[f]="restart" |
256 |
+ |
+ |
258 |
+ if n.startswith('smeserver') or n.startswith('e-smith'): |
+ if n.startswith('smeserver') or n.startswith('e-smith'): |
259 |
+ smechange = True |
+ smechange = True |
260 |
+ |
+ |
261 |
|
+ |
262 |
|
+ #only for debug |
263 |
|
+ #print 'smechange: '+str(smechange) |
264 |
|
+ #print 'post-trans' |
265 |
|
+ #print 'eventlist: '+ str(eventlist) |
266 |
|
+ #print 'templateslist: '+str(templateslist) |
267 |
|
+ #print 'serviceslist: '+str(serviceslist) |
268 |
|
+ |
269 |
+ # check if smechange is true or if eventlist has items.. in both cases we must initialize databases |
+ # check if smechange is true or if eventlist has items.. in both cases we must initialize databases |
270 |
+ if smechange == True or len(eventlist)>0: |
+ if smechange == True or len(eventlist)>0: |
271 |
|
+ print 'Initializing databases' |
272 |
+ os.spawnl(os.P_WAIT, initialize_database, initialize_database) |
+ os.spawnl(os.P_WAIT, initialize_database, initialize_database) |
273 |
+ |
+ |
274 |
+ # now, if smechange is false (no reboot needed), we can execute actions, expan templates and adjust services |
+ # now, if smechange is false (no reboot needed), we can execute actions, expan templates and adjust services |
275 |
+ if not smechange: |
+ #if not smechange: |
276 |
+ |
+ |
277 |
+ if len(actionlist)>0: |
+ if len(actionlist)>0: |
278 |
+ print "Executing actions" |
+ print "Executing actions" |
279 |
+ for kactions in actionlist: |
+ for kactions in actionlist: |
280 |
+ #print kactions |
+ #print kactions |
281 |
|
+ if os.path.isfile(kactions): |
282 |
+ os.spawnl(os.P_WAIT, kactions, kactions) |
+ os.spawnl(os.P_WAIT, kactions, kactions) |
283 |
+ |
+ |
284 |
+ if len(templateslist)>0: |
+ if len(templateslist)>0: |
285 |
+ print "Expanding templates" |
+ print "Expanding templates" |
286 |
+ for ktemplates in templateslist: |
+ for ktemplates in templateslist: |
287 |
+ #print ktemplates |
+ #print ktemplates |
288 |
|
+ if os.path.isfile(ktemplates): |
289 |
+ os.spawnl(os.P_WAIT, expand_template, expand_template, ktemplates) |
+ os.spawnl(os.P_WAIT, expand_template, expand_template, ktemplates) |
290 |
+ |
+ |
291 |
+ if len(serviceslist)>0: |
+ if len(serviceslist)>0: |
292 |
+ print "Adjusting services" |
+ print "Adjusting services" |
293 |
+ for kservices in serviceslist: |
+ for kservices in serviceslist: |
294 |
+ print kservices + ": " + serviceslist[kservices] |
+ print kservices + ": " + serviceslist[kservices] |
295 |
+ os.spawnl(os.P_WAIT, service, service, kservices, serviceslist[kservices]) |
+ os.spawnl(os.P_WAIT, service, service, kservices, serviceslist[kservices]) |
296 |
+ |
+ |
297 |
+ |
+ |
298 |
+ if smechange: |
+ if smechange: |