sub target_reboot ($) {
my ($ho) = @_;
- target_cmd_root($ho, "init 6");
+ if (is_host_using_systemd($ho)) {
+ # systemd whould kill sshd before it had time to send the result of the
+ # command which result in the call below to fail
+ # instead, ask the host to reboot in 1 minute
+ #
+ # an alternative to reboot a host using systemd is:
+ # systemctl -H root@host reboot
+ target_cmd_root($ho, "shutdown -r");
+ } else {
+ target_cmd_root($ho, "init 6");
+ }
target_await_down($ho, $timeout{RebootDown});
await_tcp(get_timeout($ho,'reboot',$timeout{RebootUp}), 5,$ho);
}
$ho->{OS} eq "centos");
}
+sub is_host_using_systemd ($) {
+ my ($ho) = @_;
+ return (is_host_redhat_derived($ho) and $ho->{RedhatRelease} >= 7);
+}
+
sub host_install_recipe_create ($) {
my ($ho) = @_;
if ($ho->{OS} eq "debian") {