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;
}
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;
}
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));
}
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();
}
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;
}
}
Aggregations