]> git.proxmox.com Git - mirror_ifupdown2.git/blobdiff - pkg/iface.py
execute 'up' on upper devices if ifup is called with --with-depends
[mirror_ifupdown2.git] / pkg / iface.py
index 61f3e1c2c14cc64f3cc2afe7d2baaf15a60db712..3ea64894eb4eed5162c5bccfedccacd3497f9770 100644 (file)
@@ -107,7 +107,6 @@ class ifaceState():
         elif state_str == 'query-running':
             return cls.QUERY_RUNNING
 
-
 class ifaceJsonEncoder(json.JSONEncoder):
     def default(self, o):
         retconfig = {}
@@ -125,9 +124,9 @@ class ifaceJsonEncoder(json.JSONEncoder):
                             'config' : retconfig})
 
 class iface():
-    """ config flags """
-    AUTO = 0x1
-    HOT_PLUG = 0x2
+    """ flags """
+    # flag to indicate that the object was created from pickled state
+    PICKLED = 0x1
 
     version = '0.1'
 
@@ -139,7 +138,6 @@ class iface():
         self.config_status = {}
         self.state = ifaceState.NEW
         self.status = ifaceStatus.UNKNOWN
-        self.errstr = ''
         self.flags = 0x0
         self.priv_flags = 0x0
         self.refcnt = 0
@@ -148,7 +146,6 @@ class iface():
         self.auto = False
         self.classes = []
         self.env = None
-        self.config_current = {}
         self.raw_lines = []
         self.linkstate = None
 
@@ -199,12 +196,6 @@ class iface():
         else:
             return True
 
-    def set_config_current(self, config_current):
-        self.config_current = config_current
-
-    def get_config_current(self):
-        return self.config_current
-
     def get_auto(self):
         return self.auto
 
@@ -228,7 +219,6 @@ class iface():
     def belongs_to_class(self, intfclass):
         if intfclass in self.classes:
             return True
-
         return False
 
     def set_priv_flags(self, priv_flags):
@@ -255,6 +245,10 @@ class iface():
     def set_status(self, status):
         self.status = status
 
+    def set_state_n_status(self, state, status):
+        self.state = state
+        self.status = status
+
     def state_str_to_hex(self, state_str):
         return self.state_str_map.get(state_str)
 
@@ -388,17 +382,30 @@ class iface():
         del odict['state']
         del odict['status']
         del odict['lowerifaces']
+        del odict['upperifaces']
         del odict['refcnt']
-
+        del odict['config_status']
+        del odict['flags']
+        del odict['priv_flags']
+        del odict['raw_lines']
+        del odict['linkstate']
+        del odict['env']
         return odict
 
     def __setstate__(self, dict):
         self.__dict__.update(dict)
+        self.config_status = {}
         self.state = ifaceState.NEW
         self.status = ifaceStatus.UNKNOWN
         self.refcnt = 0
+        self.flags = 0
         self.lowerifaces = None
+        self.upperifaces = None
         self.linkstate = None
+        self.env = None
+        self.priv_flags = 0
+        self.raw_lines = []
+        self.flags |= self.PICKLED
         
     def dump_raw(self, logger):
         indent = '  '
@@ -411,12 +418,13 @@ class iface():
         logger.info(self.get_name() + ' : {')
         logger.info(indent + 'family: %s' %self.get_addr_family())
         logger.info(indent + 'method: %s' %self.get_addr_method())
+        logger.info(indent + 'flags: %x' %self.flags)
         logger.info(indent + 'state: %s'
                 %ifaceState.to_str(self.get_state()))
         logger.info(indent + 'status: %s'
                 %ifaceStatus.to_str(self.get_status()))
         logger.info(indent + 'refcnt: %d' %self.get_refcnt())
-        d = self.get_lowerdevs()
+        d = self.get_lowerifaces()
         if d:
             logger.info(indent + 'lowerdevs: %s' %str(d))
         else: