fix bugs 1117 and 1142 at deleting k8scluster helm-chart
[osm/N2VC.git] / n2vc / provisioner.py
index a2fe13e..fbb16ca 100644 (file)
@@ -72,8 +72,8 @@ fi
 
 IPTABLES_SCRIPT = """#!/bin/bash
 set -e
-apt-get update
-DEBIAN_FRONTEND=noninteractive apt-get install -yqq iptables-persistent
+[ -v `which netfilter-persistent` ] && apt update \
+    && DEBIAN_FRONTEND=noninteractive apt-get install -yqq iptables-persistent
 iptables -t nat -A OUTPUT -p tcp -d {} -j DNAT --to-destination {}
 netfilter-persistent save
 """
@@ -243,8 +243,8 @@ class AsyncSSHProvisioner:
             params.series = hw["series"]
             params.instance_id = "manual:{}".format(self.host)
             params.nonce = "manual:{}:{}".format(
-                self.host, str(uuid.uuid4()),  # a nop for Juju w/manual machines
-            )
+                self.host, str(uuid.uuid4()),
+            )  # a nop for Juju w/manual machines
             params.hardware_characteristics = {
                 "arch": hw["arch"],
                 "mem": int(hw["mem"]),
@@ -586,8 +586,8 @@ class SSHProvisioner:
                 params.series = hw["series"]
                 params.instance_id = "manual:{}".format(self.host)
                 params.nonce = "manual:{}:{}".format(
-                    self.host, str(uuid.uuid4()),  # a nop for Juju w/manual machines
-                )
+                    self.host, str(uuid.uuid4()),
+                )  # a nop for Juju w/manual machines
                 params.hardware_characteristics = {
                     "arch": hw["arch"],
                     "mem": int(hw["mem"]),