Add Juju Public Key
[osm/N2VC.git] / modules / libjuju / juju / provisioner.py
index 91747a4..2886574 100644 (file)
@@ -12,13 +12,12 @@ import uuid
 
 
 arches = [
 
 
 arches = [
-    [re.compile("amd64|x86_64"), "amd64"],
-    [re.compile("i?[3-9]86"), "i386"],
-    [re.compile("(arm$)|(armv.*)"), "armhf"],
-    [re.compile("aarch64"), "arm64"],
-    [re.compile("ppc64|ppc64el|ppc64le"), "ppc64el"],
-    [re.compile("ppc64|ppc64el|ppc64le"), "s390x"],
-
+    [re.compile(r"amd64|x86_64"), "amd64"],
+    [re.compile(r"i?[3-9]86"), "i386"],
+    [re.compile(r"(arm$)|(armv.*)"), "armhf"],
+    [re.compile(r"aarch64"), "arm64"],
+    [re.compile(r"ppc64|ppc64el|ppc64le"), "ppc64el"],
+    [re.compile(r"s390x?"), "s390x"],
 ]
 
 
 ]
 
 
@@ -158,6 +157,7 @@ class SSHProvisioner:
         # TODO: Test this on an image without the ubuntu user setup.
 
         auth_user = self.user
         # TODO: Test this on an image without the ubuntu user setup.
 
         auth_user = self.user
+        ssh = None
         try:
             # Run w/o allocating a pty, so we fail if sudo prompts for a passwd
             ssh = self._get_ssh_client(
         try:
             # Run w/o allocating a pty, so we fail if sudo prompts for a passwd
             ssh = self._get_ssh_client(
@@ -234,7 +234,7 @@ class SSHProvisioner:
         info['series'] = lines[0].strip()
         info['arch'] = normalize_arch(lines[1].strip())
 
         info['series'] = lines[0].strip()
         info['arch'] = normalize_arch(lines[1].strip())
 
-        memKb = re.split('\s+', lines[2])[1]
+        memKb = re.split(r'\s+', lines[2])[1]
 
         # Convert megabytes -> kilobytes
         info['mem'] = round(int(memKb) / 1024)
 
         # Convert megabytes -> kilobytes
         info['mem'] = round(int(memKb) / 1024)
@@ -251,8 +251,8 @@ class SSHProvisioner:
                 cores = line.split(":")[1].strip()
 
                 if physical_id not in recorded.keys():
                 cores = line.split(":")[1].strip()
 
                 if physical_id not in recorded.keys():
-                        info['cpu-cores'] += cores
-                        recorded[physical_id] = True
+                    info['cpu-cores'] += cores
+                    recorded[physical_id] = True
 
         return info
 
 
         return info