Merge branch 'stable-2.16' into stable-2.17
[ganeti-github.git] / lib / ssh.py
index 0fb592b..79a66f0 100644 (file)
@@ -172,13 +172,13 @@ def AddAuthorizedKeys(file_obj, keys):
                            in key_field_list
                            if split_key != line_key]
       nl = line.endswith("\n")
-    else:
-      if not nl:
-        f.write("\n")
-      for (key, _) in key_field_list:
-        f.write(key.rstrip("\r\n"))
-        f.write("\n")
-      f.flush()
+
+    if not nl:
+      f.write("\n")
+    for (key, _) in key_field_list:
+      f.write(key.rstrip("\r\n"))
+      f.write("\n")
+    f.flush()
   finally:
     f.close()
 
@@ -728,7 +728,7 @@ def InitPubKeyFile(master_uuid, key_type, key_file=pathutils.SSH_PUB_KEYS):
   AddPublicKey(master_uuid, key, key_file=key_file)
 
 
-class SshRunner:
+class SshRunner(object):
   """Wrapper for SSH commands.
 
   """