Skip to content

If a modifier fails the host should be discarded #58

@paalbra

Description

@paalbra

If a modifier fails, the processing will just continue without those modifications:

try:
modified_host = host_modifier["module"].modify(host.copy(deep=True))
assert isinstance(modified_host, models.Host)
assert hostname == modified_host.hostname, f"Modifier changed the hostname, '{hostname}' -> '{modified_host.hostname}'"
host = modified_host
except AssertionError as e:
logging.warning("Host, '%s', was modified to be invalid by modifier: '%s'. Error: %s", hostname, host_modifier["name"], str(e))
except Exception as e:
logging.warning("Error when running modifier %s on host '%s': %s", host_modifier["name"], hostname, str(e))
# TODO: Do more?

This could lead to a weird state/unknown problems (very dependent on the modifier, obviously).

I think that the current host, that is being modified, should be discarded from the current update run (kind of like a failing collector), since we do not know what happened/what it really should look like. This would mean: Keep the host as is in the database.

This issue is also mentioned in #57

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions