Browse Source

Do not use None values on patch partial update calls

Set path/ids to empty dtrings in order to remove them, instead of None values
as the patch partial updates do not support it.

Change-Id: Ib4801ff00b659897f5c6c639f5abb6895f1e4178
changes/06/681406/1
Adit Sarfaty 1 week ago
parent
commit
3cd40561d3
2 changed files with 11 additions and 11 deletions
  1. 8
    8
      vmware_nsxlib/v3/policy/core_defs.py
  2. 3
    3
      vmware_nsxlib/v3/policy/lb_defs.py

+ 8
- 8
vmware_nsxlib/v3/policy/core_defs.py View File

@@ -300,7 +300,7 @@ class RouterDef(ResourceDef):
300 300
         # Add dhcp relay config
301 301
         # TODO(asarfaty): this can be either dhcp or dhcp relay config
302 302
         if self.has_attr('dhcp_config'):
303
-            paths = None
303
+            paths = ""
304 304
             if self.get_attr('dhcp_config'):
305 305
                 dhcp_conf = DhcpRelayConfigDef(
306 306
                     config_id=self.get_attr('dhcp_config'),
@@ -311,7 +311,7 @@ class RouterDef(ResourceDef):
311 311
                                         value=paths)
312 312
 
313 313
         if self.has_attr('ipv6_ndra_profile_id'):
314
-            paths = None
314
+            paths = ""
315 315
             if self.get_attr('ipv6_ndra_profile_id'):
316 316
                 ndra_profile = Ipv6NdraProfileDef(
317 317
                     profile_id=self.get_attr('ipv6_ndra_profile_id'),
@@ -480,7 +480,7 @@ class Tier1InterfaceDef(ResourceDef):
480 480
                                         value=path)
481 481
 
482 482
         if self.has_attr('ipv6_ndra_profile_id'):
483
-            paths = None
483
+            paths = ""
484 484
             if self.get_attr('ipv6_ndra_profile_id'):
485 485
                 ndra_profile = Ipv6NdraProfileDef(
486 486
                     profile_id=self.get_attr('ipv6_ndra_profile_id'),
@@ -809,7 +809,7 @@ class SegmentPortSecProfilesBindingMapDef(SegmentPortBindingMapDefBase):
809 809
         body = super(SegmentPortSecProfilesBindingMapDef, self).get_obj_dict()
810 810
 
811 811
         if self.has_attr('segment_security_profile_id'):
812
-            path = None
812
+            path = ""
813 813
             if self.get_attr('segment_security_profile_id'):
814 814
                 profile = SegmentSecurityProfileDef(
815 815
                     profile_id=self.get_attr('segment_security_profile_id'),
@@ -821,7 +821,7 @@ class SegmentPortSecProfilesBindingMapDef(SegmentPortBindingMapDefBase):
821 821
                 value=path)
822 822
 
823 823
         if self.has_attr('spoofguard_profile_id'):
824
-            path = None
824
+            path = ""
825 825
             if self.get_attr('spoofguard_profile_id'):
826 826
                 profile = SpoofguardProfileDef(
827 827
                     profile_id=self.get_attr('spoofguard_profile_id'),
@@ -850,7 +850,7 @@ class SegmentPortDiscoveryProfilesBindingMapDef(SegmentPortBindingMapDefBase):
850 850
                      self).get_obj_dict()
851 851
 
852 852
         if self.has_attr('mac_discovery_profile_id'):
853
-            path = None
853
+            path = ""
854 854
             if self.get_attr('mac_discovery_profile_id'):
855 855
                 profile = MacDiscoveryProfileDef(
856 856
                     profile_id=self.get_attr('mac_discovery_profile_id'),
@@ -862,7 +862,7 @@ class SegmentPortDiscoveryProfilesBindingMapDef(SegmentPortBindingMapDefBase):
862 862
                 value=path)
863 863
 
864 864
         if self.has_attr('ip_discovery_profile_id'):
865
-            path = None
865
+            path = ""
866 866
             if self.get_attr('ip_discovery_profile_id'):
867 867
                 profile = IpDiscoveryProfileDef(
868 868
                     profile_id=self.get_attr('ip_discovery_profile_id'),
@@ -891,7 +891,7 @@ class SegmentPortQoSProfilesBindingMapDef(SegmentPortBindingMapDefBase):
891 891
                      self).get_obj_dict()
892 892
 
893 893
         if self.has_attr('qos_profile_id'):
894
-            path = None
894
+            path = ""
895 895
             if self.get_attr('qos_profile_id'):
896 896
                 profile = QosProfileDef(
897 897
                     profile_id=self.get_attr('qos_profile_id'),

+ 3
- 3
vmware_nsxlib/v3/policy/lb_defs.py View File

@@ -263,7 +263,7 @@ class LBVirtualServerDef(ResourceDef):
263 263
                 app_profile_def.get_resource_full_path())
264 264
 
265 265
         if self.has_attr('lb_persistence_profile_id'):
266
-            path = None
266
+            path = ""
267 267
             lb_persistence_profile_id = self.get_attr(
268 268
                 'lb_persistence_profile_id')
269 269
             if lb_persistence_profile_id:
@@ -273,7 +273,7 @@ class LBVirtualServerDef(ResourceDef):
273 273
                 path = lb_persistence_profile_def.get_resource_full_path()
274 274
             body['lb_persistence_profile_path'] = path
275 275
         if self.has_attr('lb_service_id'):
276
-            path = None
276
+            path = ""
277 277
             lb_service_id = self.get_attr('lb_service_id')
278 278
             if lb_service_id:
279 279
                 lb_service_def = LBServiceDef(
@@ -281,7 +281,7 @@ class LBVirtualServerDef(ResourceDef):
281 281
                 path = lb_service_def.get_resource_full_path()
282 282
             body['lb_service_path'] = path
283 283
         if self.has_attr('pool_id'):
284
-            path = None
284
+            path = ""
285 285
             lb_pool_id = self.get_attr('pool_id')
286 286
             if lb_pool_id:
287 287
                 lb_pool_def = LBPoolDef(

Loading…
Cancel
Save