Search in sources :

Example 6 with PropertyMetadata

use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.

the class CreateISO method formatProperties.

private static String formatProperties(Map<String, String> properties) {
    StringBuffer props = new StringBuffer();
    PropertyMetadata metadata;
    String equal = "=";
    String newLine = "\n";
    // Getting properties metadata
    Map<String, PropertyMetadata> metadataMap = PropertiesMetadata.getGlobalMetadata();
    if (metadataMap == null) {
        _log.warn("Properties metadata not found");
        throw APIException.internalServerErrors.targetIsNullOrEmpty("Properties metadata");
    }
    // Looping through each property, checking if it is visible to all nodes
    for (Map.Entry<String, String> entry : properties.entrySet()) {
        // Check if this property is visible to all nodes
        metadata = metadataMap.get(entry.getKey());
        if (metadata != null && !metadata.getControlNodeOnly()) {
            props.append(entry.getKey());
            props.append(equal);
            props.append(entry.getValue());
            props.append(newLine);
        } else {
            _log.info("Property metadata not found or control only: " + entry.getKey());
        }
    }
    return props.toString();
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata) Map(java.util.Map)

Example 7 with PropertyMetadata

use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.

the class PropertyManager method getLocalTargetPropInfo.

/**
 * Get local target property info
 *
 * For control node, properties that can be found in metadata are target properties
 * For extra node, not only exist in metadata, but also ControlNodeOnly==false
 *
 * @param localPropInfo
 * @return
 */
private PropertyInfoExt getLocalTargetPropInfo(final PropertyInfoExt localPropInfo) {
    Map<String, PropertyMetadata> metadata = PropertiesMetadata.getGlobalMetadata();
    PropertyInfoExt localTargetProps = new PropertyInfoExt();
    for (Entry<String, String> entry : localPropInfo.getAllProperties().entrySet()) {
        final String key = entry.getKey();
        final String value = entry.getValue();
        if (metadata.containsKey(key)) {
            if (coordinator.isControlNode()) {
                localTargetProps.addProperty(key, value);
            } else {
                if (!metadata.get(key).getControlNodeOnly()) {
                    localTargetProps.addProperty(key, value);
                }
            }
        }
    }
    return localTargetProps;
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata)

Example 8 with PropertyMetadata

use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.

the class PasswordServiceTest method setPropMetaData.

public PropertyMetadata setPropMetaData(String label, String description, String type, int maxLen, String tag, Boolean advanced, Boolean userMutable, Boolean userConfigurable, Boolean reconfigRequired, Boolean rebootRequired, String value, Boolean controlNodeOnly) {
    PropertyMetadata metaData = new PropertyMetadata();
    metaData.setLabel(label);
    metaData.setDescription(description);
    metaData.setType(type);
    metaData.setMaxLen(maxLen);
    metaData.setTag(tag);
    metaData.setAdvanced(advanced);
    metaData.setUserMutable(userMutable);
    metaData.setUserConfigurable(userConfigurable);
    metaData.setReconfigRequired(reconfigRequired);
    metaData.setRebootRequired(rebootRequired);
    metaData.setValue(value);
    metaData.setControlNodeOnly(controlNodeOnly);
    return metaData;
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata)

Example 9 with PropertyMetadata

use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.

the class LocalPasswordHandlerTestBase method setPropsMetaData.

public void setPropsMetaData() {
    PropertyMetadata proxyuser_metadata = setPropMetaData("Encrypted password for the 'proxyuser' account", "Encrypted (SHA-512) password for the local 'proxyuser' account.", "encryptedstring", 255, "Security", true, true, false, true, false, "", true);
    PropertyMetadata sysmonitor_metadata = setPropMetaData("Encrypted password for the 'sysmonitor' account", "Encrypted password for the 'sysmonitor' account.", "string", 255, "Security", true, true, false, true, false, "$6$BIu9aQ6$wBnn9Tn.CUuuoi/JZe.oAOmUDIVCqHpXeem7ZHO5R7dPg2hul8tNCBzwumKrFw8A0qm.LH8YvMJUaN2AL1JVc0", true);
    PropertyMetadata root_metadata = setPropMetaData("Encrypted password for the 'root' account", "Encrypted (SHA-512) password for the local 'root' account.", "string", 255, "Security", true, true, false, true, false, "$6$eBIu9aQ6$wBnn9Tn.CUuuoi/JZe.oAOmUDIVCqHpXeem7ZHO5R7dPg2hul8tNCBzwumKrFw8A0qm.LH8YvMJUaN2AL1JVc0", false);
    PropertyMetadata svcuser_metadata = setPropMetaData("Encrypted password for the 'svcuser' account", "Encrypted (SHA-512) password for the local 'svcuser' account.", "string", 255, "Security", true, true, false, true, false, "$6$eBIu9aQ6$wBnn9Tn.CUuuoi/JZe.oAOmUDIVCqHpXeem7ZHO5R7dPg2hul8tNCBzwumKrFw8A0qm.LH8YvMJUaN2AL1JVc0", false);
    _propsMetadata.put("system_proxyuser_encpassword", proxyuser_metadata);
    _propsMetadata.put("system_sysmonitor_encpassword", sysmonitor_metadata);
    _propsMetadata.put("system_root_encpassword", root_metadata);
    _propsMetadata.put("system_svcuser_encpassword", svcuser_metadata);
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata)

Example 10 with PropertyMetadata

use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.

the class CreateISOTest method setPropMetaData.

public PropertyMetadata setPropMetaData(String label, String description, String type, Integer maxLen, String tag, Boolean advanced, Boolean userMutable, Boolean userConfigurable, Boolean reconfigRequired, Boolean rebootRequired, String value, Boolean controlNodeOnly) {
    PropertyMetadata metaData = new PropertyMetadata();
    metaData.setLabel(label);
    metaData.setDescription(description);
    metaData.setType(type);
    metaData.setMaxLen(maxLen);
    metaData.setTag(tag);
    metaData.setAdvanced(advanced);
    metaData.setUserMutable(userMutable);
    metaData.setUserConfigurable(userConfigurable);
    metaData.setReconfigRequired(reconfigRequired);
    metaData.setRebootRequired(rebootRequired);
    metaData.setValue(value);
    metaData.setControlNodeOnly(controlNodeOnly);
    return metaData;
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata)

Aggregations

PropertyMetadata (com.emc.storageos.model.property.PropertyMetadata)19 Map (java.util.Map)7 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)2 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 ArrayList (java.util.ArrayList)2 TreeMap (java.util.TreeMap)2 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)1 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1 PropertyInfoRestRep (com.emc.storageos.model.property.PropertyInfoRestRep)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 BadRequestException (com.emc.storageos.svcs.errorhandling.resources.BadRequestException)1 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)1 InvalidLockOwnerException (com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException)1 SyssvcException (com.emc.storageos.systemservices.exceptions.SyssvcException)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 HashMap (java.util.HashMap)1 Property (models.properties.Property)1