Search in sources :

Example 11 with PropertyInfo

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

the class PasswordUtils method getUserPassword.

/**
 * get user's encpassword from system properties
 *
 * @param username
 * @return
 */
public String getUserPassword(String username) {
    PropertyInfo props = null;
    try {
        props = coordinator.getPropertyInfo();
    } catch (CoordinatorException e) {
        _log.error("Access local user properties failed", e);
        return null;
    }
    if (props == null) {
        _log.error("Access local user properties failed");
        return null;
    }
    String encpassword = props.getProperty("system_" + username + "_encpassword");
    if (StringUtils.isBlank(encpassword)) {
        _log.error("No password set for user {} ", username);
        return null;
    }
    return encpassword;
}
Also used : CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) PropertyInfo(com.emc.storageos.model.property.PropertyInfo)

Example 12 with PropertyInfo

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

the class PasswordUtils method getConfigProperties.

/**
 * get current system properties
 *
 * @return
 */
public Map<String, String> getConfigProperties() {
    Map<String, String> mergedProps = new HashMap();
    Set<Map.Entry<Object, Object>> defaults = defaultProperties.entrySet();
    for (Map.Entry<Object, Object> p : defaults) {
        mergedProps.put((String) p.getKey(), (String) p.getValue());
    }
    Map<String, String> overrides = new HashMap();
    Map<String, String> siteScopeprops = new HashMap();
    try {
        overrides = coordinator.getTargetInfo(PropertyInfoExt.class).getProperties();
    } catch (Exception e) {
        _log.info("Fail to get the cluster information ", e);
    }
    try {
        PropertyInfo targetInfo = coordinator.getTargetInfo(coordinator.getSiteId(), PropertyInfoExt.class);
        if (targetInfo != null) {
            siteScopeprops = targetInfo.getProperties();
        }
    } catch (Exception e) {
        _log.info("Fail to get the site information ", e);
    }
    for (Map.Entry<String, String> entry : overrides.entrySet()) {
        mergedProps.put(entry.getKey(), entry.getValue());
    }
    for (Map.Entry<String, String> entry : siteScopeprops.entrySet()) {
        mergedProps.put(entry.getKey(), entry.getValue());
    }
    return mergedProps;
}
Also used : PropertyInfo(com.emc.storageos.model.property.PropertyInfo) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) BadRequestException(com.emc.storageos.svcs.errorhandling.resources.BadRequestException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException)

Example 13 with PropertyInfo

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

the class SchedulerConfig method getExternalServerPassword.

public String getExternalServerPassword() {
    PropertyInfo propInfo = coordinator.getCoordinatorClient().getPropertyInfo();
    byte[] password = getExternalServerPassword(propInfo);
    if (password == null) {
        return "";
    }
    return this.encryptionProvider.decrypt(Base64.decodeBase64(password));
}
Also used : PropertyInfo(com.emc.storageos.model.property.PropertyInfo)

Example 14 with PropertyInfo

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

the class SchedulerConfig method reload.

public void reload() throws Exception {
    log.info("Loading configuration");
    getSofttwareWithRetry();
    PropertyInfo propInfo = coordinator.getCoordinatorClient().getPropertyInfo();
    this.nodeCount = coordinator.getNodeCount();
    initBackupInterval(propInfo);
    this.schedulerEnabled = isSchedulerEnabled(propInfo);
    this.startOffsetMinutes = fetchStartOffsetMinutes(propInfo);
    this.copiesToKeep = fetchCopiesToKeep(propInfo);
    this.uploadServerType = getExternalServerType();
    this.uploadUrl = getExternalServerUrl(propInfo);
    this.uploadDomain = getExternalDomain();
    this.uploadUserName = getExternalServerUserName(propInfo);
    this.uploadPassword = getExternalServerPassword(propInfo);
    initRetainedAndUploadedBackups();
}
Also used : PropertyInfo(com.emc.storageos.model.property.PropertyInfo)

Example 15 with PropertyInfo

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

the class AuditLogManager method recordAuditLogs.

/**
 * Called to record auditlogs in the database.
 *
 * @param events references to recordable auditlogs.
 */
public void recordAuditLogs(RecordableAuditLog... auditlogs) {
    if (!shouldRecordAuditLog()) {
        s_logger.info("Ignore audit log on standby site");
        return;
    }
    AuditLog[] dbAuditLogs = new AuditLog[auditlogs.length];
    int i = 0;
    for (RecordableAuditLog auditlog : auditlogs) {
        AuditLog dbAuditlog = AuditLogUtils.convertToAuditLog(auditlog);
        dbAuditLogs[i++] = dbAuditlog;
        AuditLog auditSyslog = dbAuditlog;
        PropertyInfo propInfo = _coordinator.getPropertyInfo();
        if (propInfo.getProperty(SYSLOG_ENALBE).equalsIgnoreCase("true")) {
            Locale locale = new Locale("en", "US");
            ResourceBundle resb = ResourceBundle.getBundle("SDSAuditlogRes", locale);
            AuditLogUtils.resetDesc(auditSyslog, resb);
            logger.info("audit log is " + dbAuditlog.getServiceType() + " " + dbAuditlog.getUserId() + " " + dbAuditlog.getOperationalStatus() + " " + dbAuditlog.getDescription());
        }
    }
    // Now insert the events into the database.
    try {
        _dbClient.start();
        String bucketId = _dbClient.insertTimeSeries(AuditLogTimeSeries.class, dbAuditLogs);
        s_logger.info("AuditLog(s) persisted into Cassandra with bucketId/rowId : {}", bucketId);
    } catch (DatabaseException e) {
        s_logger.error("Error inserting auditlogs into the database", e);
        throw e;
    }
}
Also used : Locale(java.util.Locale) ResourceBundle(java.util.ResourceBundle) PropertyInfo(com.emc.storageos.model.property.PropertyInfo) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) AuditLog(com.emc.storageos.db.client.model.AuditLog)

Aggregations

PropertyInfo (com.emc.storageos.model.property.PropertyInfo)19 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)5 Configuration (com.emc.storageos.coordinator.common.Configuration)3 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 BadRequestException (com.emc.storageos.svcs.errorhandling.resources.BadRequestException)2 HashMap (java.util.HashMap)2 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)1 SiteInfo (com.emc.storageos.coordinator.client.model.SiteInfo)1 CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)1 RetryableCoordinatorException (com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)1 PropertyInfoMapper.decodeFromString (com.emc.storageos.coordinator.mapper.PropertyInfoMapper.decodeFromString)1 DbClientContext (com.emc.storageos.db.client.impl.DbClientContext)1 EncryptionProviderImpl (com.emc.storageos.db.client.impl.EncryptionProviderImpl)1 AuditLog (com.emc.storageos.db.client.model.AuditLog)1 ComputeImageServer (com.emc.storageos.db.client.model.ComputeImageServer)1 ComputeSystem (com.emc.storageos.db.client.model.ComputeSystem)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 SecurityException (com.emc.storageos.security.exceptions.SecurityException)1 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)1 MigrationCallbackException (com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException)1