use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED in project halyard by spinnaker.
the class AbstractEditAuthnMethodCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
String authnMethodName = getMethod().id;
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
AuthnMethod authnMethod = new OperationHandler<AuthnMethod>().setOperation(Daemon.getAuthnMethod(currentDeployment, authnMethodName, false)).setFailureMesssage("Failed to get " + authnMethodName + " method.").get();
new OperationHandler<Void>().setOperation(Daemon.setAuthnMethod(currentDeployment, authnMethodName, !noValidate, editAuthnMethod((T) authnMethod))).setFailureMesssage("Failed to edit " + authnMethodName + " method.").setSuccessMessage("Successfully edited " + authnMethodName + " method.").get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED in project halyard by spinnaker.
the class AbstractEditAccountCommand method executeThis.
@Override
protected void executeThis() {
String accountName = getAccountName();
String providerName = getProviderName();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
Account account = new OperationHandler<Account>().setFailureMesssage("Failed to get account " + accountName + " for provider " + providerName + ".").setOperation(Daemon.getAccount(currentDeployment, providerName, accountName, false)).get();
int originaHash = account.hashCode();
account = editAccount((T) account);
account.setRequiredGroupMembership(updateStringList(account.getRequiredGroupMembership(), requiredGroupMembership, addRequiredGroupMembership, removeRequiredGroupMembership));
account.setProviderVersion(isSet(providerVersion) ? providerVersion : account.getProviderVersion());
if (originaHash == account.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setFailureMesssage("Failed to edit account " + accountName + " for provider " + providerName + ".").setSuccessMessage("Successfully edited account " + accountName + " for provider " + providerName + ".").setOperation(Daemon.setAccount(currentDeployment, providerName, accountName, !noValidate, account)).get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED in project halyard by spinnaker.
the class AbstractEditBaseImageCommand method executeThis.
@Override
protected void executeThis() {
String baseImageId = getBaseImageId();
String providerName = getProviderName();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
BaseImage baseImage = new OperationHandler<BaseImage>().setFailureMesssage("Failed to get base image " + baseImageId + " in" + providerName + "'s bakery.").setOperation(Daemon.getBaseImage(currentDeployment, providerName, baseImageId, false)).get();
int originalHash = baseImage.hashCode();
BaseImage.ImageSettings imageSettings = baseImage.getBaseImage();
if (imageSettings == null) {
throw new RuntimeException("Image settings cannot be deleted during an edit. This is a bug in the " + getProviderName() + " provider's implementation of halyard.");
}
imageSettings.setId(isSet(id) ? id : imageSettings.getId());
imageSettings.setShortDescription(isSet(shortDescription) ? shortDescription : imageSettings.getShortDescription());
imageSettings.setDetailedDescription(isSet(detailedDescription) ? detailedDescription : imageSettings.getDetailedDescription());
imageSettings.setPackageType(isSet(packageType) ? packageType : imageSettings.getPackageType());
imageSettings.setTemplateFile(isSet(templateFile) ? templateFile : imageSettings.getTemplateFile());
baseImage = editBaseImage((T) baseImage);
if (originalHash == baseImage.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setFailureMesssage("Failed to edit base image " + baseImageId + " in" + providerName + "'s bakery.").setSuccessMessage("Successfully edited base image " + baseImageId + " in" + providerName + "'s bakery.").setOperation(Daemon.setBaseImage(currentDeployment, providerName, baseImageId, !noValidate, baseImage)).get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED in project halyard by spinnaker.
the class AbstractPersistentStoreEditCommand method executeThis.
@Override
protected void executeThis() {
String persistentStoreType = getPersistentStoreType();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
PersistentStore persistentStore = new OperationHandler<PersistentStore>().setFailureMesssage("Failed to get persistent store \"" + persistentStoreType + "\".").setOperation(Daemon.getPersistentStore(currentDeployment, persistentStoreType, false)).get();
int originalHash = persistentStore.hashCode();
persistentStore = editPersistentStore((T) persistentStore);
if (originalHash == persistentStore.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setFailureMesssage("Failed to edit persistent store \"" + persistentStoreType + "\".").setSuccessMessage("Successfully edited persistent store \"" + persistentStoreType + "\".").setOperation(Daemon.setPersistentStore(currentDeployment, persistentStoreType, !noValidate, persistentStore)).get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeDiff.ChangeType.EDITED in project halyard by spinnaker.
the class DCOSEditClusterCommand method executeThis.
@Override
protected void executeThis() {
String clusterName = getClusterName();
String providerName = getProviderName();
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
DCOSCluster cluster = (DCOSCluster) new OperationHandler<Cluster>().setFailureMesssage("Failed to get cluster " + clusterName + " for provider " + providerName + ".").setOperation(Daemon.getCluster(currentDeployment, providerName, clusterName, false)).get();
int originalHash = cluster.hashCode();
if (!isStringEmpty(dcosUrl)) {
cluster.setDcosUrl(dcosUrl);
}
if (!isStringEmpty(caCertFile)) {
cluster.setCaCertFile(caCertFile);
}
if (removeCaCertFile) {
cluster.setCaCertFile(null);
}
if (Objects.nonNull(insecureSkipTlsVerify)) {
cluster.setInsecureSkipTlsVerify(insecureSkipTlsVerify);
}
if (!isStringEmpty(loadBalancerImage)) {
DCOSCluster.LoadBalancer loadBalancer = cluster.getLoadBalancer();
if (loadBalancer == null) {
loadBalancer = new DCOSCluster.LoadBalancer();
cluster.setLoadBalancer(loadBalancer);
}
loadBalancer.setImage(loadBalancerImage);
}
if (!isStringEmpty(loadBalancerServiceAccountSecret)) {
DCOSCluster.LoadBalancer loadBalancer = cluster.getLoadBalancer();
if (loadBalancer == null) {
loadBalancer = new DCOSCluster.LoadBalancer();
cluster.setLoadBalancer(loadBalancer);
}
loadBalancer.setServiceAccountSecret(loadBalancerServiceAccountSecret);
}
if (removeLoadBalancer) {
cluster.setLoadBalancer(null);
}
if (originalHash == cluster.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setFailureMesssage("Failed to edit cluster " + clusterName + " for provider " + providerName + ".").setSuccessMessage("Successfully edited cluster " + clusterName + " for provider " + providerName + ".").setOperation(Daemon.setCluster(currentDeployment, providerName, clusterName, !noValidate, cluster)).get();
}
Aggregations