use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class KeyCertificateAlgorithmValuesHolder method getV1Cert.
public String getV1Cert() {
log.info("trying to get v1 ovf properties");
final String[] cmd = { "/etc/systool", "--getoverrides" };
// 2 min
final long _SYSTOOL_TIMEOUT = 120000;
final Exec.Result result = Exec.sudo(_SYSTOOL_TIMEOUT, cmd);
if (!result.exitedNormally() || result.getExitValue() != 0) {
log.error("Systool command failed. Result exit value: " + result.getExitValue());
return null;
}
String[] propsStrings = result.getStdOutput().split(LINE_DELIMITER);
PropertyInfoExt props = new PropertyInfoExt(propsStrings);
String keyAndCertPem = props.getProperty(V1_SSL_CERT_PROPERTY_NAME);
if (keyAndCertPem == null) {
log.info("Deprecated property " + V1_SSL_CERT_PROPERTY_NAME + " not configured in previous version.");
}
return keyAndCertPem;
}
use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class SendEvent method generateConfigFile.
/**
* Generates configuration file with name taken from variable CONFIG_FILE_NAME
* Returns the created file name.
*/
protected String generateConfigFile() throws JAXBException, LocalRepositoryException, IOException {
ZipOutputStream zos = null;
try {
PropertyInfoExt properties = new PropertyInfoExt(coordinator.getPropertyInfo().getProperties());
zos = new ZipOutputStream(new FileOutputStream(CONFIG_FILE_PATH));
ZipEntry ze = new ZipEntry(CONFIG_FILE_NAME + getFileExtension());
zos.putNextEntry(ze);
if (MediaType.APPLICATION_JSON_TYPE.equals(mediaType)) {
// gson should not be used any more
(new ObjectMapper()).writeValue(zos, properties);
} else {
JAXBContext jaxbContext = JAXBContext.newInstance(PropertyInfo.class);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(properties, zos);
}
zos.flush();
} finally {
if (zos != null) {
zos.close();
}
}
return CONFIG_FILE_PATH;
}
use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class CoordinatorClientExt method getTargetProperties.
/**
* Get all target properties - include global(shared by active/standby), or site specific properties
*
* @return
* @throws Exception
*/
public PropertyInfoExt getTargetProperties() throws Exception {
PropertyInfoExt targetPropInfo = _coordinator.getTargetInfo(PropertyInfoExt.class);
PropertyInfoExt siteScopePropInfo = _coordinator.getTargetInfo(_coordinator.getSiteId(), PropertyInfoExt.class);
if (targetPropInfo != null && siteScopePropInfo != null) {
PropertyInfoExt combinedProps = new PropertyInfoExt();
for (Entry<String, String> entry : targetPropInfo.getAllProperties().entrySet()) {
combinedProps.addProperty(entry.getKey(), entry.getValue());
}
for (Entry<String, String> entry : siteScopePropInfo.getAllProperties().entrySet()) {
combinedProps.addProperty(entry.getKey(), entry.getValue());
}
return combinedProps;
} else if (targetPropInfo != null) {
return targetPropInfo;
} else if (siteScopePropInfo != null) {
return siteScopePropInfo;
} else {
return null;
}
}
use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class CoordinatorClientExt method setSiteSpecificProperties.
/**
* Set site specific properties
*
* @param props
* @param siteId
*/
public void setSiteSpecificProperties(Map<String, String> props, String siteId) {
PropertyInfoExt siteScopeInfo = new PropertyInfoExt(props);
ConfigurationImpl siteCfg = new ConfigurationImpl();
siteCfg.setId(PropertyInfoExt.TARGET_PROPERTY_ID);
siteCfg.setKind(PropertyInfoExt.TARGET_PROPERTY);
siteCfg.setConfig(TARGET_INFO, siteScopeInfo.encodeAsString());
_coordinator.persistServiceConfiguration(siteId, siteCfg);
}
use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class IPSecMonitor method isSameVdcAsLocalNode.
/**
* check if specified node is in the same VDC as the local node
*
* @param node
* @return
*/
private boolean isSameVdcAsLocalNode(String node) {
PropertyInfoExt vdcProps = LocalRepository.getInstance().getVdcPropertyInfo();
String myVdcId = vdcProps.getProperty("vdc_myid");
String vdcShortId = getVdcShortIdByIp(node);
if (vdcShortId != null && vdcShortId.equals(myVdcId)) {
log.info(node + " is in the same vdc as localhost");
return true;
}
log.info(node + " is NOT in the same vdc as localhost");
return false;
}
Aggregations