'Used when exporting to yaml.'

def to_dict(self):

    d = {}
    for prop in ['ip', 'hostname', 'public_ip', 'public_hostname', 'connect_to', 'preconfigured', 'containerized', 'schedulable', 'roles', 'node_labels']:
        if getattr(self, prop):
            d[prop] = getattr(self, prop)
    for (variable, value) in self.other_variables.items():
        d[variable] = value
    return d
