mirror of
https://github.com/bb-Ricardo/netbox-sync.git
synced 2026-01-19 23:40:26 -06:00
fixes an issue with uninitialized object attributes for permitted_subnets config #203
This commit is contained in:
@@ -147,6 +147,8 @@ class CheckRedfish(SourceBase):
|
||||
validation_failed = True
|
||||
|
||||
# check permitted ip subnets
|
||||
permitted_subnets = list()
|
||||
excluded_subnets = list()
|
||||
if config_settings.get("permitted_subnets") is None:
|
||||
log.info(f"Config option 'permitted_subnets' in 'source/{self.name}' is undefined. "
|
||||
f"No IP addresses will be populated to NetBox!")
|
||||
@@ -154,8 +156,6 @@ class CheckRedfish(SourceBase):
|
||||
config_settings["permitted_subnets"] = \
|
||||
[x.strip() for x in config_settings.get("permitted_subnets").split(",") if x.strip() != ""]
|
||||
|
||||
permitted_subnets = list()
|
||||
excluded_subnets = list()
|
||||
# add "invisible" config option
|
||||
self.settings["excluded_subnets"] = None
|
||||
|
||||
@@ -174,8 +174,8 @@ class CheckRedfish(SourceBase):
|
||||
log.error(f"Problem parsing permitted subnet: {e}")
|
||||
validation_failed = True
|
||||
|
||||
config_settings["permitted_subnets"] = permitted_subnets
|
||||
config_settings["excluded_subnets"] = excluded_subnets
|
||||
config_settings["permitted_subnets"] = permitted_subnets
|
||||
config_settings["excluded_subnets"] = excluded_subnets
|
||||
|
||||
if validation_failed is True:
|
||||
log.error("Config validation failed. Exit!")
|
||||
|
||||
@@ -228,6 +228,8 @@ class VMWareHandler(SourceBase):
|
||||
validation_failed = True
|
||||
|
||||
# check permitted ip subnets
|
||||
permitted_subnets = list()
|
||||
excluded_subnets = list()
|
||||
if config_settings.get("permitted_subnets") is None:
|
||||
log.info(f"Config option 'permitted_subnets' in 'source/{self.name}' is undefined. "
|
||||
f"No IP addresses will be populated to NetBox!")
|
||||
@@ -235,8 +237,6 @@ class VMWareHandler(SourceBase):
|
||||
config_settings["permitted_subnets"] = \
|
||||
[x.strip() for x in config_settings.get("permitted_subnets").split(",") if x.strip() != ""]
|
||||
|
||||
permitted_subnets = list()
|
||||
excluded_subnets = list()
|
||||
# add "invisible" config option
|
||||
self.settings["excluded_subnets"] = None
|
||||
|
||||
@@ -255,8 +255,8 @@ class VMWareHandler(SourceBase):
|
||||
log.error(f"Problem parsing permitted subnet: {e}")
|
||||
validation_failed = True
|
||||
|
||||
config_settings["permitted_subnets"] = permitted_subnets
|
||||
config_settings["excluded_subnets"] = excluded_subnets
|
||||
config_settings["permitted_subnets"] = permitted_subnets
|
||||
config_settings["excluded_subnets"] = excluded_subnets
|
||||
|
||||
# check include and exclude filter expressions
|
||||
for setting in [x for x in config_settings.keys() if "filter" in x]:
|
||||
|
||||
Reference in New Issue
Block a user