Skip to content

Commit 8d9d1bd

Browse files
author
Murat Bulat
committed
custom_attribute_exclude
1 parent 75cc21d commit 8d9d1bd

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

module/sources/vmware/config.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,13 @@ def __init__(self):
337337
""",
338338
config_example="AA:BB:CC:11:22:33, 66:77:88:AA:BB:CC"
339339
),
340+
ConfigOption("custom_attribute_exclude",
341+
str,
342+
description="""defines a comma separated list of custom attribute which should be excluded
343+
from sync. Any custom attribute with a matching attribute key will be excluded from sync.
344+
""",
345+
config_example="VB_LAST_BACKUP, VB_LAST_BACKUP2"
346+
),
340347

341348
# removed settings
342349
ConfigOption("netbox_host_device_role",

module/sources/vmware/connection.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,11 @@ def get_object_custom_fields(self, obj):
814814
key = grab(obj_custom_field, "key")
815815
value = grab(obj_custom_field, "value")
816816

817+
if self.settings.custom_attribute_exclude is not None and \
818+
key in self.settings.custom_attribute_exclude:
819+
log.debug(f"Custom attribute '{key}' excluded from sync. Skipping")
820+
continue
821+
817822
if key is None or value is None:
818823
continue
819824

settings-example.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ password = super-secret
354354
; host NIC with a matching MAC address will be excluded from sync.
355355
;host_nic_exclude_by_mac_list = AA:BB:CC:11:22:33, 66:77:88:AA:BB:CC
356356

357+
; defines a comma separated list of custom attribute which should be excluded from sync. Any
358+
;custom_attribute_exclude = VB_LAST_BACKUP
359+
357360
[source/my-redfish-example]
358361

359362
; Defines if this source is enabled or not

0 commit comments

Comments
 (0)