Merge "ensure that libvirt is running before creation of VM"
diff --git a/metadata/service/syndic/cluster.yml b/metadata/service/syndic/cluster.yml
index 278b7ce..d46c4b5 100644
--- a/metadata/service/syndic/cluster.yml
+++ b/metadata/service/syndic/cluster.yml
@@ -1,7 +1,6 @@
 parameters:
+  _param:
+    salt_syndic_enabled: true
   salt:
     syndic:
-      enabled: true
-      masters:
-      - host: ${_param:salt_syndic_master_address_01}
-      - host: ${_param:salt_syndic_master_address_02}
+      enabled: ${_param:salt_syndic_enabled}
diff --git a/metadata/service/syndic/single.yml b/metadata/service/syndic/single.yml
index 088cbdf..f599749 100644
--- a/metadata/service/syndic/single.yml
+++ b/metadata/service/syndic/single.yml
@@ -1,6 +1,8 @@
 parameters:
+  _param:
+    salt_syndic_enabled: true
   salt:
     syndic:
-      enabled: true
+      enabled: ${_param:salt_syndic_enabled}
       master:
         host: ${_param:salt_syndic_master_address}
diff --git a/salt/files/restore_master.sh b/salt/files/restore_master.sh
index 92b94f2..9ac6100 100644
--- a/salt/files/restore_master.sh
+++ b/salt/files/restore_master.sh
@@ -5,6 +5,10 @@
 mkdir -p /etc/salt/pki.bak
 mv /etc/salt/pki/* /etc/salt/pki.bak
 scp -r backupninja@{{ master.initial_data.source }}:{{ master.initial_data.get('home_dir', '/srv/backupninja') }}/{{ master.initial_data.host }}/etc/salt/pki/pki.0/* /etc/salt/pki
+RC=$?
+if [ $RC -gt 0 ]; then
+    mv /etc/salt/pki.bak/* /etc/salt/pki
+fi
 {%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined) %}
 scp -r backupninja@{{ master.initial_data.source }}:{{ master.initial_data.get('home_dir', '/srv/backupninja') }}/{{ master.initial_data.host }}/srv/salt/reclass/reclass.0/* /srv/salt/reclass
 {%- endif %}
diff --git a/salt/files/restore_minion.sh b/salt/files/restore_minion.sh
index a6ea1d4..c72e8ad 100644
--- a/salt/files/restore_minion.sh
+++ b/salt/files/restore_minion.sh
@@ -7,5 +7,9 @@
 mkdir -p /etc/pki/ca
 mv /etc/pki/ca/* /etc/pki/pki_ca.bak
 scp -r backupninja@{{ minion.initial_data.source }}:{{ minion.initial_data.get('home_dir', '/srv/backupninja') }}/{{ minion.initial_data.host }}/etc/pki/ca/ca.0/* /etc/pki/ca
+RC=$?
+if [ $RC -gt 0 ]; then
+    mv /etc/pki/pki_ca.bak/* /etc/pki/ca
+fi
 {%- endif %}
 {%- endif %}