D-17573 Fix NPE when localhost does not match a node in the system model

I think using Optionals is a better approach than throwing exceptions. This way we maintain backwards compatability, and the code seems to be a bit cleaner.