fixes issue with cloned VMs not synced if same VM uuid exists in different vCenter instances #111

This commit is contained in:
ricardo.bartels@telekom.de
2021-10-23 02:03:02 +02:00
parent 3109cb1e84
commit bb4e693eba
4 changed files with 19 additions and 19 deletions

View File

@@ -142,7 +142,7 @@ def get_config(config_handler=None, section=None, valid_settings=None, deprecate
# check for deprecated settings
if isinstance(deprecated_settings, dict):
for deprecated_setting, alternative_setting in deprecated_settings.items():
if config_handler.get(section, deprecated_setting) is not None:
if config_handler.get(section, deprecated_setting, fallback=None) is not None:
log_text = f"Setting '{deprecated_setting}' is deprecated and will be removed soon."
if alternative_setting is not None:
log_text += f" Consider changing your config to use the '{alternative_setting}' setting."
@@ -151,7 +151,7 @@ def get_config(config_handler=None, section=None, valid_settings=None, deprecate
# check for removed settings
if isinstance(removed_settings, dict):
for removed_setting, alternative_setting in removed_settings.items():
if config_handler.get(section, removed_setting) is not None:
if config_handler.get(section, removed_setting, fallback=None) is not None:
log_text = f"Setting '{removed_setting}' has been removed " \
f"but is still defined in config section '{section}'."
if alternative_setting is not None:

View File

@@ -92,7 +92,6 @@ class CheckRedfish(SourceBase):
source_type = "check_redfish"
enabled = False
inventory_file_path = None
interface_adapter_type_dict = dict()
device_object = None
inventory_file_content = None
@@ -114,6 +113,8 @@ class CheckRedfish(SourceBase):
self.init_successful = True
self.interface_adapter_type_dict = dict()
def parse_config_settings(self, config_settings):
"""
Validate parsed settings from config file

View File

@@ -142,22 +142,6 @@ class VMWareHandler(SourceBase):
site_name = None
network_data = {
"vswitch": dict(),
"pswitch": dict(),
"host_pgroup": dict(),
"dpgroup": dict(),
"dpgroup_ports": dict()
}
permitted_clusters = dict()
processed_host_names = dict()
processed_vm_names = dict()
processed_vm_uuid = list()
parsing_vms_the_first_time = True
def __init__(self, name=None, settings=None, inventory=None):
if name is None:
@@ -185,6 +169,20 @@ class VMWareHandler(SourceBase):
self.init_successful = True
# instantiate source specific vars
self.network_data = {
"vswitch": dict(),
"pswitch": dict(),
"host_pgroup": dict(),
"dpgroup": dict(),
"dpgroup_ports": dict()
}
self.permitted_clusters = dict()
self.processed_host_names = dict()
self.processed_vm_names = dict()
self.processed_vm_uuid = list()
self.parsing_vms_the_first_time = True
def parse_config_settings(self, config_settings):
"""
Validate parsed settings from config file

View File

@@ -117,6 +117,7 @@ def main():
# loop over sources and patch netbox data
for source in sources:
log.debug(f"Retrieving data from source '{source.name}'")
source.apply()
# add/remove tags to/from all inventory items