cosolidates common source config options

This commit is contained in:
ricardo.bartels@telekom.de
2023-03-05 20:33:48 +01:00
parent 83cee9a051
commit 513bcabd2c
3 changed files with 27 additions and 36 deletions

View File

@@ -30,11 +30,7 @@ class CheckRedfishConfig(ConfigBase):
self.options = [
ConfigOption(**config_option_enabled_definition),
ConfigOption("type",
str,
description="type of source. This defines which source handler to use",
config_example="check_redfish",
mandatory=True),
ConfigOption(**{**config_option_type_definition, "config_example": "check_redfish"}),
ConfigOption("inventory_file_path",
str,
@@ -74,19 +70,7 @@ class CheckRedfishConfig(ConfigBase):
via check_redfish if False only data which is not preset in NetBox will be added""",
default_value=True),
ConfigOption("ip_tenant_inheritance_order",
str,
description="""\
define in which order the IP address tenant will be assigned if tenant is undefined.
possible values:
* device : host or VM tenant will be assigned to the IP address
* prefix : if the IP address belongs to an existing prefix and this prefix has a tenant assigned, then this one is used
* disabled : no tenant assignment to the IP address will be performed
the order of the definition is important, the default is "device, prefix" which means:
If the device has a tenant then this one will be used. If not, the prefix tenant will be used if defined
""",
default_value="device, prefix"
),
ConfigOption(**config_option_ip_tenant_inheritance_order_definition),
]
super().__init__()

View File

@@ -7,6 +7,14 @@
# For a copy, see file LICENSE.txt included in this
# repository or visit: <https://opensource.org/licenses/MIT>.
config_option_type_definition = {
"key": "type",
"value_type": str,
"description": "type of source. This defines which source handler to use",
"config_example": "UNDEFINED",
"mandatory": True
}
config_option_enabled_definition = {
"key": "enabled",
"value_type": bool,
@@ -23,3 +31,18 @@ config_option_permitted_subnets_definition = {
""",
"config_example": "172.16.0.0/12, 10.0.0.0/8, 192.168.0.0/16, fd00::/8, !10.23.42.0/24"
}
config_option_ip_tenant_inheritance_order_definition = {
"key": "ip_tenant_inheritance_order",
"value_type": str,
"description": """\
define in which order the IP address tenant will be assigned if tenant is undefined.
possible values:
* device : host or VM tenant will be assigned to the IP address
* prefix : if the IP address belongs to an existing prefix and this prefix has a tenant assigned, then this one is used
* disabled : no tenant assignment to the IP address will be performed
the order of the definition is important, the default is "device, prefix" which means:
If the device has a tenant then this one will be used. If not, the prefix tenant will be used if defined
""",
"default_value": "device, prefix"
}

View File

@@ -32,11 +32,7 @@ class VMWareConfig(ConfigBase):
self.options = [
ConfigOption(**config_option_enabled_definition),
ConfigOption("type",
str,
description="type of source. This defines which source handler to use",
config_example="vmware",
mandatory=True),
ConfigOption(**{**config_option_type_definition, "config_example": "vmware"}),
ConfigOption("host_fqdn",
str,
@@ -317,19 +313,7 @@ class VMWareConfig(ConfigBase):
description="""set a matching value for ESXi host management interface description
(case insensitive, comma separated). Used to figure out the ESXi primary IP address""",
default_value="management, mgmt"),
ConfigOption("ip_tenant_inheritance_order",
str,
description="""\
define in which order the IP address tenant will be assigned if tenant is undefined.
possible values:
* device : host or VM tenant will be assigned to the IP address
* prefix : if the IP address belongs to an existing prefix and this prefix has a tenant assigned, then this one is used
* disabled : no tenant assignment to the IP address will be performed
the order of the definition is important, the default is "device, prefix" which means:
If the device has a tenant then this one will be used. If not, the prefix tenant will be used if defined
""",
default_value="device, prefix"
),
ConfigOption(**config_option_ip_tenant_inheritance_order_definition),
ConfigOption("sync_vm_interface_mtu",
bool,
description="""Usually netbox-sync grabs the MTU size for the VM interface from the