Skip to content

Commit e689b1d

Browse files
committed
Merge branch 'hg'
2 parents 054c832 + c651e53 commit e689b1d

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

.hgtags

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,3 +513,5 @@ fa6fc60a9d8ab4981317c5be18e47b28868691e5 11.4.84.0.1.201.0
513513
4aa2fc1df7c1cf43786bcb1d7a75fea721f9864e st202
514514
d3a4e98be3b2016eecfd2fc31437d9b386a9b0c0 st203
515515
611b9daec17e8217a55d6418976b2c407604f26d st204
516+
acf995441b3cfe6bea0fa77889d9d163feba4ab5 st205
517+
acf995441b3cfe6bea0fa77889d9d163feba4ab5 st206

src/pkg/external_deps.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
# Only the variant used by pkg(7) utilities is listed here;
5555
# this is to avoid unnecessary circular dependencies with ON.
5656
pkg:/system/library/python/solaris-core-311
57+
pkg:/system/python/boot-environment-utilities-311
5758
pkg:/system/library/security/crypto
5859
pkg:/system/library/smf
5960
pkg:/system/linker

src/svc/svc-pkg-auto-update.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import pkg.no_site_packages
2727
import pkg.smf as smf
2828
import pkg.client.pkgdefs as pkgdefs
29+
import bemgmt
2930
import smf_include
3031
import os
3132
import subprocess
@@ -121,8 +122,7 @@ def start():
121122
pkg_status = subprocess.call(cmd)
122123
if pkg_status != pkgdefs.EXIT_LOCKED:
123124
break
124-
print('Image locked, sleeping for {0} seconds'.format(wait_secs),
125-
flush=True)
125+
print(f'Image locked, sleeping for {wait_secs} seconds', flush=True)
126126
time.sleep(wait_secs)
127127

128128
if pkg_status == pkgdefs.EXIT_NOP:
@@ -154,15 +154,24 @@ def start():
154154
new_be_activated = pkgplan['activate-be']
155155
if new_be_created and new_be_activated and auto_reboot:
156156
if check_before_reboot:
157-
print('Running reboot-check-hook {0}'.format(reboot_hook))
157+
print(f'Running reboot-check-hook {reboot_hook}')
158158
exitcode, output = subprocess.getstatusoutput(reboot_hook)
159159
if exitcode != 0:
160+
print(output)
161+
bename = pkgplan['be-name']
162+
print(f'Reboot Hook failed {exitcode}, removing {bename}')
163+
# Remove the BE as a future auto-update may create the same BE.
164+
# Leaving it risks it becoming stale and surprising the
165+
# admin on a manual reboot.
166+
try:
167+
bemgmt.BEManager().destroy(bename)
168+
except bemgmt.be_errors.BeMgmtError as e:
169+
print(f"BE destroy failed: {e}")
170+
pass
160171
message = f'Reboot Hook failed {exitcode}, see service log'
161172
smf_include.smf_method_exit(smf_include.SMF_EXIT_DEGRADED,
162173
'reboot-check-hook-failed',
163174
message)
164-
print('Reboot hook output follows:')
165-
print(output)
166175

167176
print('Reboot after auto update')
168177
msg = myfmri + ' : automatic reboot after update'

0 commit comments

Comments
 (0)