@@ -377,15 +377,15 @@ def to_dict(self):
377377 if isinstance (data_value , list ):
378378 new_data_value = list ()
379379 for possible_option in data_value :
380- if type (possible_option ) == type :
380+ if type (possible_option ) is type :
381381 new_data_value .append (str (possible_option ))
382382 else :
383383 new_data_value .append (possible_option )
384384
385385 data_value = new_data_value
386386
387387 # if value is class name then print class name
388- if type (data_value ) == type :
388+ if type (data_value ) is type :
389389 data_value = str (data_value )
390390
391391 data_model [data_key ] = data_value
@@ -458,7 +458,7 @@ def format_slug(text=None, max_len=50):
458458 # Enforce max length
459459 return text [0 :max_len ]
460460
461- def get_uniq_slug (self , text = None , max_len = 50 )-> str :
461+ def get_uniq_slug (self , text = None , max_len = 50 ) -> str :
462462 """
463463 return an uniq slug. If the default slug is already used try to
464464 append a number until a slug is found which has not been used.
@@ -480,7 +480,7 @@ def get_uniq_slug(self, text=None, max_len=50)-> str:
480480 if self .inventory .slug_used (self .__class__ , slug ) is False :
481481 return slug
482482
483- for x in range (1 ,20 ):
483+ for x in range (1 , 20 ):
484484 new_slug = f"{ slug } -{ x } "
485485 if self .inventory .slug_used (self .__class__ , new_slug ) is False and len (new_slug ) <= max_len :
486486 log .info (f"Slug '{ slug } ' for { self .name } '{ text } ' has been used. "
@@ -1272,6 +1272,7 @@ def get_site_name(self, data=None):
12721272 if isinstance (this_site , dict ):
12731273 return this_site .get ("name" )
12741274
1275+
12751276class NBObjectList (list ):
12761277 """
12771278 Base class of listed NetBox objects. Extends list(). Currently used for tags and untagged VLANs
@@ -1697,7 +1698,6 @@ def update(self, data=None, read_from_netbox=False, source=None):
16971698
16981699 super ().update (data = data , read_from_netbox = read_from_netbox , source = source )
16991700
1700-
17011701 def resolve_relations (self ):
17021702
17031703 self .resolve_scoped_relations ("scope_id" , "scope_type" )
@@ -2141,18 +2141,6 @@ def update(self, data=None, read_from_netbox=False, source=None):
21412141 object_type = data .get ("assigned_object_type" )
21422142 assigned_object = data .get ("assigned_object_id" )
21432143
2144- # Skip IP assignments when the IP is assigned to FHRP groups when config option
2145- # skip_fhrp_group_ips is set to True, or if the IP is manually assigned to an FHRP group (no source)
2146- if source is not None :
2147- if source .source_type == "vmware" :
2148- config_relation = source .get_object_relation (assigned_object , "skip_fhrp_group_ips" )
2149- if config_relation == True and object_type == "ipam.fhrpgroup" :
2150- log .debug (f"IP address with id '{ assigned_object } ' assigned to FHRP group. Skipping." )
2151- return
2152- elif object_type == "ipam.fhrpgroup" :
2153- log .debug (f"IP address with id '{ assigned_object } ' assigned to FHRP group. It was manually created. Skipping." )
2154- return
2155-
21562144 # used to track changes in object primary IP assignments
21572145 previous_ip_device_vm = None
21582146 is_primary_ipv4_of_previous_device = False
@@ -2241,6 +2229,7 @@ def remove_interface_association(self):
22412229 if o_type is not None :
22422230 self .unset_attribute ("assigned_object_type" )
22432231
2232+
22442233class NBMACAddress (NetBoxObject ):
22452234 name = "MAC address"
22462235 api_path = "dcim/mac-addresses"
0 commit comments