Browse code

Added logic to not restart services after cloud-init upgrade And also added hack to not break cloud-init after upgrade

Change-Id: I2aa4014c6a3da9f8a6da0f83ba584a541e376e63
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1626
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Sharath George

dthaluru authored on 2016/11/04 03:45:27
Showing 1 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 Name:           cloud-init
2 2
 Version:        0.7.6
3
-Release:        11%{?dist}
3
+Release:        12%{?dist}
4 4
 Summary:        Cloud instance init scripts
5 5
 Group:          System Environment/Base
6 6
 License:        GPLv3
... ...
@@ -60,6 +60,25 @@ cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
60 60
 %clean
61 61
 rm -rf $RPM_BUILD_ROOT
62 62
 
63
+%pre
64
+if [ -f /usr/lib/systemd/system/cloud-final.service ]; then
65
+    cp /usr/lib/systemd/system/cloud-final.service /usr/lib/systemd/system/cloud-final.service.bak
66
+    sed -i "s@ExecStart=.*@ExecStart=/usr/bin/cloud-init --version@g" /usr/lib/systemd/system/cloud-final.service
67
+fi
68
+if [ -f /usr/lib/systemd/system/cloud-init.service ]; then
69
+    cp /usr/lib/systemd/system/cloud-init.service /usr/lib/systemd/system/cloud-init.service.bak
70
+    sed -i "s@ExecStart=.*@ExecStart=/usr/bin/cloud-init --version@g" /usr/lib/systemd/system/cloud-init.service
71
+fi
72
+if [ -f /usr/lib/systemd/system/cloud-config.service ]; then
73
+    cp /usr/lib/systemd/system/cloud-config.service /usr/lib/systemd/system/cloud-config.service.bak
74
+    sed -i "s@ExecStart=.*@ExecStart=/usr/bin/cloud-init --version@g" /usr/lib/systemd/system/cloud-config.service
75
+fi
76
+if [ -f /usr/lib/systemd/system/cloud-init-local.service ]; then
77
+    cp /usr/lib/systemd/system/cloud-init-local.service /usr/lib/systemd/system/cloud-init-local.service.bak
78
+    sed -i "s@ExecStart=.*@ExecStart=/usr/bin/cloud-init --version@g" /usr/lib/systemd/system/cloud-init-local.service
79
+fi
80
+systemctl daemon-reload >/dev/null 2>&1 || :
81
+
63 82
 %post
64 83
 %systemd_post cloud-config.service
65 84
 %systemd_post cloud-final.service
... ...
@@ -73,10 +92,25 @@ rm -rf $RPM_BUILD_ROOT
73 73
 %systemd_preun cloud-init-local.service
74 74
 
75 75
 %postun
76
-%systemd_postun_with_restart cloud-config.service
77
-%systemd_postun_with_restart cloud-final.service
78
-%systemd_postun_with_restart cloud-init.service
79
-%systemd_postun_with_restart cloud-init-local.service
76
+%systemd_postun cloud-config.service
77
+%systemd_postun cloud-final.service
78
+%systemd_postun cloud-init.service
79
+%systemd_postun cloud-init-local.service
80
+
81
+%posttrans
82
+if [ -f /usr/lib/systemd/system/cloud-final.service.bak ]; then
83
+    mv /usr/lib/systemd/system/cloud-final.service.bak /usr/lib/systemd/system/cloud-final.service
84
+fi
85
+if [ -f /usr/lib/systemd/system/cloud-init.service.bak ]; then
86
+    mv /usr/lib/systemd/system/cloud-init.service.bak /usr/lib/systemd/system/cloud-init.service
87
+fi
88
+if [ -f /usr/lib/systemd/system/cloud-config.service.bak ]; then
89
+    mv /usr/lib/systemd/system/cloud-config.service.bak /usr/lib/systemd/system/cloud-config.service
90
+fi
91
+if [ -f /usr/lib/systemd/system/cloud-init-local.service.bak ]; then
92
+    mv /usr/lib/systemd/system/cloud-init-local.service.bak /usr/lib/systemd/system/cloud-init-local.service
93
+fi
94
+systemctl daemon-reload >/dev/null 2>&1 || :
80 95
 
81 96
 %files
82 97
 %license LICENSE
... ...
@@ -90,10 +124,12 @@ rm -rf $RPM_BUILD_ROOT
90 90
 
91 91
 
92 92
 %changelog
93
+*   Tue Nov 1 2016 Divya Thaluru <dthaluru@vmware.com>  0.7.6-12
94
+-   Fixed logic to not restart services after upgrade
93 95
 *   Mon Oct 24 2016 Divya Thaluru <dthaluru@vmware.com>  0.7.6-11
94 96
 -   Enabled ssh module in cloud-init
95 97
 *   Thu May 26 2016 Divya Thaluru <dthaluru@vmware.com>  0.7.6-10
96
--   Fixed logic to restart the active services after upgrade 
98
+-   Fixed logic to restart the active services after upgrade
97 99
 *	Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 0.7.6-9
98 100
 -	GA - Bump release of all rpms
99 101
 *   Tue May 3 2016 Divya Thaluru <dthaluru@vmware.com>  0.7.6-8