Description: Fix cluster init on Debian
 Update file paths and service names to work better on Debian.
Author: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Last-Update: 2019-01-12
--- a/crmsh/utils.py
+++ b/crmsh/utils.py
@@ -367,7 +367,7 @@
     """
     if user == "root":
         return cmd
-    return "su -c \"{}\" {}".format(cmd, user)
+    return "su -s /bin/sh -c \"{}\" {}".format(cmd, user)
 
 
 def chown(path, user, group):
@@ -2648,14 +2648,14 @@
     """
     Check if package is installed
     """
-    cmd = "rpm -q --quiet {}".format(pkg)
+    cmd = "dpkg-query --status {}".format(pkg)
     if remote_addr:
         # check on remote
         prompt_msg = "Check whether {} is installed on {}".format(pkg, remote_addr)
         rc, _, _ = run_cmd_on_remote(cmd, remote_addr, prompt_msg)
     else:
         # check on local
-        rc, _ = get_stdout(cmd)
+        rc, _, _ = get_stdout_stderr(cmd)
     return rc == 0
 
 
--- a/crmsh/bootstrap.py
+++ b/crmsh/bootstrap.py
@@ -42,12 +42,12 @@
 logger_utils = log.LoggerUtils(logger)
 
 
-CSYNC2_KEY = "/etc/csync2/key_hagroup"
-CSYNC2_CFG = "/etc/csync2/csync2.cfg"
+CSYNC2_KEY = "/etc/csync2.key_hagroup"
+CSYNC2_CFG = "/etc/csync2.cfg"
 COROSYNC_AUTH = "/etc/corosync/authkey"
 CRM_CFG = "/etc/crm/crm.conf"
 PROFILES_FILE = "/etc/crm/profiles.yml"
-SYSCONFIG_SBD = "/etc/sysconfig/sbd"
+SYSCONFIG_SBD = "/etc/default/sbd"
 SYSCONFIG_PCMK = "/etc/sysconfig/pacemaker"
 SYSCONFIG_NFS = "/etc/sysconfig/nfs"
 SYSCONFIG_FW = "/etc/sysconfig/SuSEfirewall2"
@@ -758,7 +758,7 @@
     """
     Configure passwordless SSH.
     """
-    utils.start_service("sshd.service", enable=True)
+    utils.start_service("ssh.service", enable=True)
     for user in USER_LIST:
         configure_ssh_key(user)
 
@@ -1118,7 +1118,7 @@
             clustername=_context.cluster_name,
             ringXaddr=ringXaddr_res,
             mcastport=mcastport_res,
-            transport="udpu",
+            transport="knet",
             ipv6=_context.ipv6,
             two_rings=two_rings)
     csync2_update(corosync.conf())
@@ -1378,7 +1378,7 @@
     if not seed_host:
         utils.fatal("No existing IP/hostname specified (use -c option)")
 
-    utils.start_service("sshd.service", enable=True)
+    utils.start_service("ssh.service", enable=True)
     for user in USER_LIST:
         configure_ssh_key(user)
         swap_public_ssh_key(seed_host, user)
--- a/crmsh/corosync.py
+++ b/crmsh/corosync.py
@@ -652,7 +652,7 @@
                          two_rings=False,
                          qdevice=None):
 
-    if transport == "udpu":
+    if transport == "knet":
         ring_tmpl = ""
         for i in 0, 1:
             ring_tmpl += "        ring{}_addr: {}\n".format(i, ringXaddr[i])
@@ -691,6 +691,9 @@
     expected_votes: 1
     two_node: 0
 }
+resources {
+    watchdog_device: off
+}
 """
     if qdevice is not None:
         quorum_tmpl = """quorum {
