Gabriel-Adrian Samfira 6 years ago
parent
commit
a1cb3adfa5
2 changed files with 8 additions and 10 deletions
  1. 4 3
      coriolis/osmorphing/debian.py
  2. 4 7
      coriolis/utils.py

+ 4 - 3
coriolis/osmorphing/debian.py

@@ -19,6 +19,7 @@ auto %(device_name)s
 iface %(device_name)s inet dhcp
 iface %(device_name)s inet dhcp
 """
 """
 
 
+
 class BaseDebianMorphingTools(base.BaseLinuxOSMorphingTools):
 class BaseDebianMorphingTools(base.BaseLinuxOSMorphingTools):
     def _check_os(self):
     def _check_os(self):
         lsb_release_path = "etc/lsb-release"
         lsb_release_path = "etc/lsb-release"
@@ -61,7 +62,7 @@ class BaseDebianMorphingTools(base.BaseLinuxOSMorphingTools):
         fp = StringIO()
         fp = StringIO()
         fp.write(LO_NIC_TPL)
         fp.write(LO_NIC_TPL)
         fp.write("\n\n")
         fp.write("\n\n")
-        for idx,_ in enumerate(nics_info):
+        for idx, _ in enumerate(nics_info):
             dev_name = "eth%d" % idx
             dev_name = "eth%d" % idx
             cfg = INTERFACES_NIC_TPL % {
             cfg = INTERFACES_NIC_TPL % {
                 "device_name": dev_name,
                 "device_name": dev_name,
@@ -73,7 +74,7 @@ class BaseDebianMorphingTools(base.BaseLinuxOSMorphingTools):
 
 
     def _compose_netplan_cfg(self, nics_info):
     def _compose_netplan_cfg(self, nics_info):
         cfg = {
         cfg = {
-            "network":{
+            "network": {
                 "version": 2,
                 "version": 2,
                 "ethernets": {
                 "ethernets": {
                     "lo": {
                     "lo": {
@@ -85,7 +86,7 @@ class BaseDebianMorphingTools(base.BaseLinuxOSMorphingTools):
                 }
                 }
             }
             }
         }
         }
-        for idx,_ in enumerate(nics_info):
+        for idx, _ in enumerate(nics_info):
             cfg["network"]["ethernets"]["eth%d" % idx] = {
             cfg["network"]["ethernets"]["eth%d" % idx] = {
                 "dhcp4": True,
                 "dhcp4": True,
                 "dhcp6": True,
                 "dhcp6": True,

+ 4 - 7
coriolis/utils.py

@@ -609,8 +609,8 @@ def create_service(ssh, cmdline, svcname, run_as=None, start=True):
     else:
     else:
         raise exception.CoriolisException(
         raise exception.CoriolisException(
             "could not determine init system")
             "could not determine init system")
-        
-        
+
+
 class Grub2ConfigEditor(object):
 class Grub2ConfigEditor(object):
     """This class edits GRUB2 configs, normally found in
     """This class edits GRUB2 configs, normally found in
     /etc/default/grub. This class tries to preserve commented
     /etc/default/grub. This class tries to preserve commented
@@ -715,7 +715,6 @@ class Grub2ConfigEditor(object):
         else:
         else:
             raise ValueError("unknown option type: %s" % opt_type)
             raise ValueError("unknown option type: %s" % opt_type)
 
 
-
     def set_option(self, option, value):
     def set_option(self, option, value):
         """Replaces the value of an option completely
         """Replaces the value of an option completely
         """
         """
@@ -750,12 +749,12 @@ class Grub2ConfigEditor(object):
                 opt_found = True
                 opt_found = True
                 found = False
                 found = False
                 for val in opt["option_value"]:
                 for val in opt["option_value"]:
-                    if (val["opt_type"] == "key_val" and 
+                    if (val["opt_type"] == "key_val" and
                             value["opt_type"] == "key_val"):
                             value["opt_type"] == "key_val"):
                         if str(val["opt_key"]) == str(value["opt_key"]):
                         if str(val["opt_key"]) == str(value["opt_key"]):
                             val["opt_val"] = value["opt_val"]
                             val["opt_val"] = value["opt_val"]
                             found = True
                             found = True
-                    elif (val["opt_type"] == "single" and 
+                    elif (val["opt_type"] == "single" and
                             value["opt_type"] == "single"):
                             value["opt_type"] == "single"):
                         if str(val["opt_val"]) == str(value["opt_val"]):
                         if str(val["opt_val"]) == str(value["opt_val"]):
                             found = True
                             found = True
@@ -802,5 +801,3 @@ class Grub2ConfigEditor(object):
             tmp.write("%s\n" % fmt)
             tmp.write("%s\n" % fmt)
         tmp.seek(0)
         tmp.seek(0)
         return tmp.read()
         return tmp.read()
-
-