/[smeserver]/rpms/smeserver-yum/sme10/smeserver-yum-2.6.0-bz11466-bz11458.patch
ViewVC logotype

Contents of /rpms/smeserver-yum/sme10/smeserver-yum-2.6.0-bz11466-bz11458.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Mar 17 22:33:21 2021 UTC (3 years, 7 months ago) by jpp
Branch: MAIN
CVS Tags: smeserver-yum-2_6_0-48_el7_sme
* Wed Mar 17 2021 Jean-Philippe Pialasse <tests@pialasse.com> 2.6.0-48.sme
- avoid reboot on removal of smeserver-* rpms [SME: 11458]
- navigation-conf when a panel is installed

1 diff -Nur --no-dereference smeserver-yum-2.6.0.old/root/usr/lib/yum-plugins/smeserver.py smeserver-yum-2.6.0/root/usr/lib/yum-plugins/smeserver.py
2 --- smeserver-yum-2.6.0.old/root/usr/lib/yum-plugins/smeserver.py 2021-03-17 17:37:05.619000000 -0400
3 +++ smeserver-yum-2.6.0/root/usr/lib/yum-plugins/smeserver.py 2021-03-17 18:32:44.417000000 -0400
4 @@ -7,6 +7,8 @@
5 from yum.constants import *
6 from yum.plugins import PluginYumExit
7 from yum.plugins import TYPE_CORE
8 +from yum.packages import parsePackages
9 +from yum.packages import RpmBase
10
11 requires_api_version = '2.1'
12 plugin_type = (TYPE_CORE,)
13 @@ -67,6 +69,8 @@
14 ourfile = False
15 erasing = False
16 DEBUG = False
17 +smeEventPretrans = False
18 +removenorebootok = dict()
19
20 def log(s):
21 if DEBUG :
22 @@ -143,12 +147,16 @@
23 # otherwise for updated packages headers will not be available
24 ts = conduit.getTsInfo()
25 removes = ts.getMembersWithState(output_states=TS_REMOVE_STATES)
26 + rpmdb = conduit.getRpmDB()
27 global smechange
28 global eventlist
29 global actionlist
30 global templateslist
31 global serviceslist
32 global erasing
33 + global smeEventPretrans
34 + global removenorebootok
35 +
36
37 # reinstall are not listed there so already skipped
38 # downgrade are going there
39 @@ -177,7 +185,15 @@
40 log(" template " + mytmptemplate)
41
42 # nothing for actions ???
43 -
44 + tmppathsrv = tmppath + os.sep
45 + files = [f for f in os.listdir(tmppathsrv)]
46 + for f in files:
47 + if os.path.islink(tmppathsrv + f):
48 + mytmpaction = os.path.realpath(os.readlink(tmppath + f).replace("..",events_path))
49 + log(" link " + f + ": " + mytmpaction)
50 + actionlist[f]=mytmpaction
51 +
52 + # end debug print
53 if os.path.isdir(tmppath + "services2adjust" + os.sep):
54 tmppathsrv = tmppath + "services2adjust" + os.sep
55 files = [f for f in os.listdir(tmppathsrv)]
56 @@ -195,6 +211,12 @@
57 if mytmpserv == "restart":
58 log("overriding all signals, forcing restart " + f )
59 serviceslist[f]="restart"
60 + removenorebootok[n]=1;
61 + thispo = rpmdb.searchNevra(name=n, arch=a, epoch=e, ver=v, rel=r)[0]
62 + # thispo.dirlist thispo.ghostlist thispo.filelist
63 + if "/etc/e-smith/web/panels/manager/cgi-bin" in thispo.dirlist:
64 + log(" ==> pannel detected : adding navigation-conf")
65 + actionlist['S80navigation-conf']="../actions/navigation-conf"
66
67 else:
68 if (n.startswith('smeserver') or n.startswith('e-smith')) and not n.startswith('smeserver-locale'):
69 @@ -204,16 +226,19 @@
70
71 #only for debug
72 log('## smechange: '+str(smechange))
73 - log('## eventlist: '+ str(eventlist.keys()))
74 + log('## eventlist: '+ str(eventlist))
75 log('## templateslist: '+str(templateslist.keys()))
76 log('## serviceslist: '+str(serviceslist.items()))
77 + log('## actions ALL: ' + str(actionlist.keys()))
78 log('## smechangelist: ' + str(smechangelist.keys()))
79
80 - # would it be a good idea to do some action/event there to stop service being removed ?
81 - # create an empty temp event
82 - print "Creating temporary event 'temp' and populating it..."
83 - createevent()
84 if len(serviceslist)>0:
85 + # would it be a good idea to do some action/event there to stop service being removed ?
86 + # for the moment we do not, logic : if template still there at posttrans, we expand it after removal
87 + # probably the actions in some situations could be done before...
88 + # create an empty temp event
89 + print "Creating temporary event 'temp' and populating it..."
90 + createevent()
91 print " Adding services to adjust"
92 for kservices in serviceslist:
93 log(" " + kservices + ": " + serviceslist[kservices])
94 @@ -222,23 +247,30 @@
95 # execute the event ; should we really wait ??
96 print "Executing signal-event temp before uninstalling ..........."
97 os.spawnl(os.P_WAIT,signal_event,signal_event, 'temp')
98 + smeEventPretrans = True;
99
100 def posttrans_hook(conduit):
101 report_yum_status('posttrans')
102 log("*******Postrans********")
103 ts = conduit.getTsInfo()
104 -
105 + rpmdb = conduit.getRpmDB()
106 +
107 global smechange
108 global eventlist
109 global actionlist
110 global templateslist
111 global serviceslist
112 global erasing
113 + global smeEventPretrans
114 + global removenorebootok
115
116
117 for tsmem in ts.getMembers():
118 (n, a, e, v, r) = tsmem.po.pkgtup
119 -
120 + # n: name ; a : arch; e: epoch ; v: version, r: release
121 + #if tsmem.output_state in TS_INSTALL_STATES:
122 + # thispo = rpmdb.searchNevra(name=n, arch=a, epoch=e, ver=v, rel=r)[0]
123 +
124 # we're upgrading/installing/removing a rebootpkgs package.. a reboot is required
125 for pkg in rebootpkgs:
126 if n.startswith(pkg):
127 @@ -314,9 +346,15 @@
128 #only for debug
129 log("overriding all signals, forcing restart " + f)
130 serviceslist[f]="restart"
131 + if tsmem.output_state in TS_INSTALL_STATES:
132 + thispo = rpmdb.searchNevra(name=n, arch=a, epoch=e, ver=v, rel=r)[0]
133 + # thispo.dirlist thispo.ghostlist thispo.filelist
134 + if "/etc/e-smith/web/panels/manager/cgi-bin" in thispo.dirlist:
135 + log(" ==> pannel detected : adding navigation-conf")
136 + actionlist['S80navigation-conf']="../actions/navigation-conf"
137
138 else:
139 - if (n.startswith('smeserver') or n.startswith('e-smith')) and not n.startswith('smeserver-locale'):
140 + if (n.startswith('smeserver') or n.startswith('e-smith')) and not n.startswith('smeserver-locale') and not removenorebootok[n]:
141 smechange = True
142 smechangelist[n]=str(tsmem.po.state) + " " + str(tsmem.current_state) + " " + str(tsmem.output_state)
143 log("smechange set to True because of " + n + " with " + str(tsmem.po.state) + " " + str(tsmem.current_state) + " " + str(tsmem.output_state) )
144 @@ -340,6 +378,19 @@
145 if not actionlist.has_key('S89systemd-reload'):
146 actionlist['S89systemd-reload'] = '/etc/e-smith/events/actions/systemd-reload'
147
148 + # here we would like to remove duplicates
149 + # those are potential : S??navigation-conf S??systemd-reload S??systemd-default
150 + for act in ('navigation-conf','systemd-reload','systemd-default'):
151 + global iter
152 + iter = 0
153 + for key in actionlist.keys():
154 + if key.endswith(act):
155 + iter += 1
156 + if iter>1:
157 + del actionlist[key]
158 + log("removing duplicate action " + key + " iter " + str(iter))
159 +
160 +
161 # now, if smechange is false (no reboot needed), we can execute actions, expand templates and adjust services
162
163 # create an empty temp event

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed