Skip to content

Commit 0625c3c

Browse files
Noah418afoster
authored andcommitted
added <NONE> as an option for scope type in config
1 parent ac5c334 commit 0625c3c

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

module/sources/vmware/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def __init__(self):
148148
description="""This option defines the scope type for a cluster.
149149
The scope type can be 'dcim.site', 'dcim.sitegroup', 'dcim.location' or 'dcim.region'.
150150
This is done with a comma separated key = value list.
151+
Can be set to "<NONE>" to not assign a scope type.
151152
key: defines a cluster name as regex
152153
value: defines the NetBox scope type name (use quotes if name contains commas)
153154
""",
@@ -157,6 +158,7 @@ def __init__(self):
157158
description="""This option defines the scope id for a cluster.
158159
The scope id is the NetBox ID of the scope type.
159160
This is done with a comma separated key = value list.
161+
To be used in combination with the 'cluster_scope_type_relation'.
160162
key: defines a cluster name as regex
161163
value: defines the NetBox scope id (use quotes if name contains commas)
162164
""",

module/sources/vmware/connection.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,11 @@ def get_scope_type(self, object_type, object_name):
540540
if type(scope_type) is not str:
541541
log.debug(f"scope_type is type: {type(scope_type)}, not str")
542542
return None
543+
544+
if scope_type == "<NONE>":
545+
log.debug(f"Scope type for {object_type.name} '{object_name}' is set to None")
546+
return None
547+
543548
log.debug(f"Returning scope type '{scope_type}' for {object_type.name} '{object_name}'. End of method.")
544549
return scope_type
545550

0 commit comments

Comments
 (0)