Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/notify method #93

Merged
merged 4 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/transactional-update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
For these systems transactional-updates provides automatic
updates; snapshots with failed updates will be automatically removed.
Automatic reboots can be triggered using a variety of different reboot
methods (e.g. rebootmgr, kured or systemd), making the appliance of
methods (e.g. rebootmgr, notify, kured or systemd), making the appliance of
the updates cluster aware.
</para>
<para>
Expand Down
2 changes: 1 addition & 1 deletion etc/transactional-update.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See transactional-update.conf(5) for details

# Reboot method
# Valid values: auto salt rebootmgr systemd kexec none
# Valid values: auto salt rebootmgr notify systemd kexec none
#REBOOT_METHOD=auto

# zypper update method
Expand Down
2 changes: 2 additions & 0 deletions lib/Reboot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Reboot::Reboot(std::string method) {

if (method == "rebootmgr") {
command = "/usr/sbin/rebootmgrctl reboot";
} else if (method == "notify") {
command = "/usr/bin/transactional-update-notifier client";
} else if (method == "systemd") {
command = "sync;";
command += "systemctl reboot;";
Expand Down
8 changes: 8 additions & 0 deletions sbin/transactional-update.in
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ reboot_via_rebootmgr() {
tukit reboot rebootmgr |& tee -a ${LOGFILE}
}

reboot_via_notify() {
TELEM_PAYLOAD="${TELEM_PAYLOAD}\nreboot=transactional-update-notify client"
tukit reboot notify |& tee -a ${LOGFILE}
}

reboot_via_systemd() {
TELEM_PAYLOAD="${TELEM_PAYLOAD}\nreboot=systemctl reboot"
tukit reboot systemd |& tee -a ${LOGFILE}
Expand Down Expand Up @@ -1534,6 +1539,9 @@ if [ ${EXITCODE} -eq 0 ]; then
rebootmgr)
reboot_via_rebootmgr
;;
notify)
reboot_via_notify
;;
systemd)
reboot_via_systemd
;;
Expand Down
1 change: 1 addition & 0 deletions systemd/transactional-update.timer
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ After=network.target local-fs.target
OnCalendar=daily
AccuracySec=1m
RandomizedDelaySec=2h
Persistent=true

[Install]
WantedBy=timers.target
2 changes: 1 addition & 1 deletion tukit/tukit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void TUKit::displayHelp() {
cout << " List of fields to print\n";
cout << "\n";
cout << "Reboot Commands:\n";
cout << "reboot [auto|rebootmgr|systemd|kured|kexec]\n";
cout << "reboot [auto|rebootmgr|notify|systemd|kured|kexec]\n";
cout << "\tReboot the system using the given method; Default: auto\n";
cout << "\n";
cout << "Generic Options:\n";
Expand Down