Beispiel #1
0
def to_model(device, config=None):
    filtered_device = dict((key, value) for key, value in device.iteritems() if key in PROVD_DEVICE_KEYS)
    new_model = Device(**filtered_device)

    if config:
        if 'configdevice' in config:
            new_model.template_id = config['configdevice']

        if device['configured'] is True:
            if device['config'].startswith('autoprov'):
                new_model.status = 'autoprov'
            else:
                new_model.status = 'configured'
        else:
            new_model.status = 'not_configured'

    return new_model
Beispiel #2
0
def to_model(device, config=None):
    filtered_device = dict((key, value) for key, value in device.iteritems()
                           if key in PROVD_DEVICE_KEYS)
    new_model = Device(**filtered_device)

    if config:
        if 'configdevice' in config:
            new_model.template_id = config['configdevice']

        if device['configured'] is True:
            if device['config'].startswith('autoprov'):
                new_model.status = 'autoprov'
            else:
                new_model.status = 'configured'
        else:
            new_model.status = 'not_configured'

    return new_model