aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-06-29 11:20:37 +0000
committerArne Juul <arnej@verizonmedia.com>2021-06-29 11:20:37 +0000
commit6908231a47c2156392ebab39f1c3c8f59d4fe202 (patch)
treea4bf19c6af1f0bc7c53299d490e71652a61b8882
parent73aa0d1882f0b2ec62e55e42dafc8a4765a31b1b (diff)
String.format -> Text.fmt
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java5
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SystemApplication.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/archive/CuratorArchiveBucketDb.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java5
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificates.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ChangeManagementAssessor.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudEventReporter.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainer.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/InfrastructureUpgrader.java7
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OsUpgrader.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VCMRMaintainer.java5
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationSource.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java5
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequest.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/athenz/AthenzApiHandler.java5
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java5
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiHandler.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployer.java11
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java7
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/Rotation.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzAccessControlRequests.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java3
38 files changed, 91 insertions, 53 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
index ff10f3b77ca..8b4ba3143b6 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
@@ -12,6 +12,7 @@ import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.log.LogLevel;
+import com.yahoo.text.Text;
import com.yahoo.vespa.athenz.api.AthenzDomain;
import com.yahoo.vespa.athenz.api.AthenzIdentity;
import com.yahoo.vespa.athenz.api.AthenzPrincipal;
@@ -156,7 +157,7 @@ public class ApplicationController {
});
count++;
}
- log.log(Level.INFO, String.format("Wrote %d applications in %s", count,
+ log.log(Level.INFO, Text.fmt("Wrote %d applications in %s", count,
Duration.between(start, clock.instant())));
});
}
@@ -809,7 +810,7 @@ public class ApplicationController {
boolean revisionIsOlder = revision.compareTo(deployment.applicationVersion()) < 0 &&
!(revision.isUnknown() && controller.system().isCd());
if (platformIsOlder || revisionIsOlder)
- throw new IllegalArgumentException(String.format("Rejecting deployment of application %s to %s, as the requested versions (platform: %s, application: %s)" +
+ throw new IllegalArgumentException(Text.fmt("Rejecting deployment of application %s to %s, as the requested versions (platform: %s, application: %s)" +
" are older than the currently deployed (platform: %s, application: %s).",
job.application(), zone, platform, revision, deployment.version(), deployment.applicationVersion()));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java
index 6a47957f27f..45fcb8c2ca0 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.api.identifiers.Identifier;
/**
@@ -22,7 +23,7 @@ public class NotExistsException extends IllegalArgumentException {
*
*/
public NotExistsException(String capitalizedType, String id) {
- super(String.format("%s '%s' does not exist", capitalizedType, id));
+ super(Text.fmt("%s '%s' does not exist", capitalizedType, id));
}
public NotExistsException(Identifier id) {
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java
index 1ff68ae641a..fe8ca5a8e6e 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java
@@ -2,6 +2,7 @@
package com.yahoo.vespa.hosted.controller;
import com.yahoo.config.provision.TenantName;
+import com.yahoo.text.Text;
import com.yahoo.vespa.curator.Lock;
import com.yahoo.vespa.flags.BooleanFlag;
import com.yahoo.vespa.flags.FetchVector;
@@ -57,7 +58,7 @@ public class TenantController {
lockIfPresent(name, LockedTenant.class, this::store);
count++;
}
- log.log(Level.INFO, String.format("Wrote %d tenants in %s", count,
+ log.log(Level.INFO, Text.fmt("Wrote %d tenants in %s", count,
Duration.between(start, controller.clock().instant())));
});
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java
index 2132f731280..6791bf33d02 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java
@@ -7,6 +7,7 @@ import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.RoutingMethod;
import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import java.net.URI;
@@ -156,7 +157,7 @@ public class Endpoint {
@Override
public String toString() {
- return String.format("endpoint %s [scope=%s, legacy=%s, routingMethod=%s]", url, scope, legacy, routingMethod);
+ return Text.fmt("endpoint %s [scope=%s, legacy=%s, routingMethod=%s]", url, scope, legacy, routingMethod);
}
private static String endpointOrClusterAsString(EndpointId id, ClusterSpec.Id cluster) {
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SystemApplication.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SystemApplication.java
index cfc9393efe2..b533a94aebb 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SystemApplication.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SystemApplication.java
@@ -7,6 +7,7 @@ import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.NodeType;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ServiceConvergence;
@@ -105,7 +106,7 @@ public enum SystemApplication {
@Override
public String toString() {
- return String.format("system application %s of type %s", id, nodeType);
+ return Text.fmt("system application %s of type %s", id, nodeType);
}
private static class Constants {
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/archive/CuratorArchiveBucketDb.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/archive/CuratorArchiveBucketDb.java
index bb38dd612db..5abe21f7b11 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/archive/CuratorArchiveBucketDb.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/archive/CuratorArchiveBucketDb.java
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.archive;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.archive.ArchiveBucket;
import com.yahoo.vespa.hosted.controller.api.integration.archive.ArchiveService;
@@ -49,7 +50,7 @@ public class CuratorArchiveBucketDb {
public Optional<URI> archiveUriFor(ZoneId zoneId, TenantName tenant) {
if (enabled) {
- return Optional.of(URI.create(String.format("s3://%s/%s/", findOrAssignBucket(zoneId, tenant), tenant.value())));
+ return Optional.of(URI.create(Text.fmt("s3://%s/%s/", findOrAssignBucket(zoneId, tenant), tenant.value())));
} else {
return Optional.empty();
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java
index cb3e5ea97c1..f9dbd27499f 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java
@@ -6,6 +6,7 @@ import com.google.common.cache.CacheLoader;
import com.google.inject.Inject;
import com.yahoo.config.provision.ApplicationName;
import com.yahoo.config.provision.TenantName;
+import com.yahoo.text.Text;
import com.yahoo.vespa.athenz.api.AthenzDomain;
import com.yahoo.vespa.athenz.api.AthenzIdentity;
import com.yahoo.vespa.athenz.api.AthenzPrincipal;
@@ -266,7 +267,7 @@ public class AthenzFacade implements AccessControl {
log("getMembership(domain=%s, role=%s, principal=%s)", domain, "admin", identity);
if ( ! zmsClient.getMembership(new AthenzRole(domain, "admin"), identity))
throw new ForbiddenException(
- String.format("The user '%s' is not admin in Athenz domain '%s'", identity.getFullName(), domain.getName()));
+ Text.fmt("The user '%s' is not admin in Athenz domain '%s'", identity.getFullName(), domain.getName()));
}
public List<AthenzDomain> getDomainList(String prefix) {
@@ -294,7 +295,7 @@ public class AthenzFacade implements AccessControl {
}
private String resourceStringPrefix(AthenzDomain tenantDomain) {
- return String.format("%s:service.%s.tenant.%s",
+ return Text.fmt("%s:service.%s.tenant.%s",
service.getDomain().getName(), service.getName(), tenantDomain.getName());
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificates.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificates.java
index 0391cb05bb7..5f23b4e1352 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificates.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/certificate/EndpointCertificates.java
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.certificate;
import com.yahoo.config.application.api.DeploymentInstanceSpec;
import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.Instance;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
@@ -57,7 +58,7 @@ public class EndpointCertificates {
metadata.ifPresent(m -> curator.writeEndpointCertificateMetadata(instance.id(), m.withLastRequested(clock.instant().getEpochSecond())));
Duration duration = Duration.between(start, clock.instant());
if (duration.toSeconds() > 30)
- log.log(Level.INFO, String.format("Getting endpoint certificate metadata for %s took %d seconds!", instance.id().serializedForm(), duration.toSeconds()));
+ log.log(Level.INFO, Text.fmt("Getting endpoint certificate metadata for %s took %d seconds!", instance.id().serializedForm(), duration.toSeconds()));
return metadata;
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
index 4f4f4b59a2c..ce53225493e 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
@@ -5,6 +5,7 @@ import com.yahoo.config.application.api.DeploymentInstanceSpec;
import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.InstanceName;
+import com.yahoo.text.Text;
import com.yahoo.vespa.curator.Lock;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.ApplicationController;
@@ -204,7 +205,7 @@ public class DeploymentTrigger {
/** retrigger job. If the job is already running, it will be canceled, and retrigger enqueued. */
public Optional<JobId> reTriggerOrAddToQueue(DeploymentId deployment) {
JobType jobType = JobType.from(controller.system(), deployment.zoneId())
- .orElseThrow(() -> new IllegalArgumentException(String.format("No job to trigger for (system/zone): %s/%s", controller.system().value(), deployment.zoneId().value())));
+ .orElseThrow(() -> new IllegalArgumentException(Text.fmt("No job to trigger for (system/zone): %s/%s", controller.system().value(), deployment.zoneId().value())));
Optional<Run> existingRun = controller.jobController().active(deployment.applicationId()).stream()
.filter(run -> run.id().type().equals(jobType))
.findFirst();
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
index 10f96ff13cd..546b4ced7ef 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
@@ -22,6 +22,7 @@ import com.yahoo.security.KeyUtils;
import com.yahoo.security.SignatureAlgorithm;
import com.yahoo.security.X509CertificateBuilder;
import com.yahoo.security.X509CertificateUtils;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.Instance;
@@ -869,7 +870,7 @@ public class InternalStepRunner implements StepRunner {
// Of the remaining memory, split 50/50 between Surefire running the tests and the rest
int testMemoryMb = (int) (1024 * (resources.memoryGb() - jdiscMemoryGb) / 2);
- String resourceString = String.format(Locale.ENGLISH,
+ String resourceString = Text.fmt(
"<resources vcpu=\"%.2f\" memory=\"%.2fGb\" disk=\"%.2fGb\" disk-speed=\"%s\" storage-type=\"%s\"/>",
resources.vcpu(), resources.memoryGb(), resources.diskGb(), resources.diskSpeed().name(), resources.storageType().name());
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java
index a05b3425a01..658eb1bbf12 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java
@@ -2,6 +2,7 @@
package com.yahoo.vespa.hosted.controller.deployment;
import com.yahoo.component.Version;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
import com.yahoo.vespa.hosted.controller.application.Change;
@@ -87,7 +88,7 @@ public class Versions {
@Override
public String toString() {
- return String.format("platform %s%s, application %s%s",
+ return Text.fmt("platform %s%s, application %s%s",
sourcePlatform.filter(source -> !source.equals(targetPlatform))
.map(source -> source + " -> ").orElse(""),
targetPlatform,
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ChangeManagementAssessor.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ChangeManagementAssessor.java
index 95432e3acbc..4797e24bcfc 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ChangeManagementAssessor.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ChangeManagementAssessor.java
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeRepository;
import com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeRepositoryNode;
@@ -120,7 +121,7 @@ public class ChangeManagementAssessor {
private static Cluster clusterKey(NodeRepositoryNode node) {
if (node.getOwner() == null)
return Cluster.EMPTY;
- String appId = String.format("%s:%s:%s", node.getOwner().tenant, node.getOwner().application, node.getOwner().instance);
+ String appId = Text.fmt("%s:%s:%s", node.getOwner().tenant, node.getOwner().application, node.getOwner().instance);
return new Cluster(Node.ClusterType.valueOf(node.getMembership().clustertype), node.getMembership().clusterid, appId, node.getType());
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudEventReporter.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudEventReporter.java
index 5acd0c63670..b5749755b1e 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudEventReporter.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/CloudEventReporter.java
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.config.provision.CloudName;
import com.yahoo.config.provision.zone.ZoneApi;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.aws.AwsEventFetcher;
import com.yahoo.vespa.hosted.controller.api.integration.aws.CloudEvent;
@@ -42,7 +43,7 @@ public class CloudEventReporter extends ControllerMaintainer {
for (var region : zonesByCloudNativeRegion.keySet()) {
List<CloudEvent> events = eventFetcher.getEvents(region);
for (var event : events) {
- log.info(String.format("Retrieved event %s, affecting the following instances: %s",
+ log.info(Text.fmt("Retrieved event %s, affecting the following instances: %s",
event.instanceEventId,
event.affectedInstances));
deprovisionAffectedHosts(region, event);
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainer.java
index 7f8cc8f7f0a..e81062887cf 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentMetricsMaintainer.java
@@ -2,6 +2,7 @@
package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.config.provision.SystemName;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.ApplicationController;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.Instance;
@@ -85,7 +86,7 @@ public class DeploymentMetricsMaintainer extends ControllerMaintainer {
}
if (lastException.get() != null) {
log.log(Level.WARNING,
- String.format("Could not gather metrics for %d/%d deployments. Retrying in %s. Last error: %s",
+ Text.fmt("Could not gather metrics for %d/%d deployments. Retrying in %s. Last error: %s",
failures.get(),
attempts.get(),
interval(),
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/InfrastructureUpgrader.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/InfrastructureUpgrader.java
index 5101de73a33..65c4555989d 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/InfrastructureUpgrader.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/InfrastructureUpgrader.java
@@ -5,6 +5,7 @@ import com.yahoo.component.Version;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.UpgradePolicy;
import com.yahoo.config.provision.zone.ZoneApi;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
import com.yahoo.vespa.hosted.controller.application.SystemApplication;
@@ -57,12 +58,12 @@ public abstract class InfrastructureUpgrader<VERSION> extends ControllerMaintain
} catch (UnreachableNodeRepositoryException e) {
failures++;
converged = false;
- log.warning(String.format("%s: Failed to communicate with node repository in %s, continuing with next parallel zone: %s",
+ log.warning(Text.fmt("%s: Failed to communicate with node repository in %s, continuing with next parallel zone: %s",
this, zone, Exceptions.toMessageString(e)));
} catch (Exception e) {
failures++;
converged = false;
- log.warning(String.format("%s: Failed to upgrade zone: %s, continuing with next parallel zone: %s",
+ log.warning(Text.fmt("%s: Failed to upgrade zone: %s, continuing with next parallel zone: %s",
this, zone, Exceptions.toMessageString(e)));
}
}
@@ -117,7 +118,7 @@ public abstract class InfrastructureUpgrader<VERSION> extends ControllerMaintain
.map(versionField)
.min(Comparator.naturalOrder());
} catch (Exception e) {
- throw new UnreachableNodeRepositoryException(String.format("Failed to get version for %s in %s: %s",
+ throw new UnreachableNodeRepositoryException(Text.fmt("Failed to get version for %s in %s: %s",
application.id(), zone, Exceptions.toMessageString(e)));
}
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OsUpgrader.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OsUpgrader.java
index 203c8187c2c..56a0b3f2489 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OsUpgrader.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OsUpgrader.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.component.Version;
import com.yahoo.config.provision.CloudName;
import com.yahoo.config.provision.zone.ZoneApi;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
import com.yahoo.vespa.hosted.controller.application.SystemApplication;
@@ -43,7 +44,7 @@ public class OsUpgrader extends InfrastructureUpgrader<OsVersionTarget> {
@Override
protected void upgrade(OsVersionTarget target, SystemApplication application, ZoneApi zone) {
Duration zoneUpgradeBudget = zoneBudgetOf(target.upgradeBudget(), zone);
- log.info(String.format("Upgrading OS of %s to version %s in %s in cloud %s%s", application.id(),
+ log.info(Text.fmt("Upgrading OS of %s to version %s in %s in cloud %s%s", application.id(),
target.osVersion().version().toFullString(),
zone.getVirtualId(), zone.getCloudName(),
" with time budget " + zoneUpgradeBudget));
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java
index e286db5882b..0ad273ff621 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.component.Version;
import com.yahoo.config.provision.zone.RoutingMethod;
import com.yahoo.config.provision.zone.ZoneApi;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
import com.yahoo.vespa.hosted.controller.application.SystemApplication;
@@ -31,7 +32,7 @@ public class SystemUpgrader extends InfrastructureUpgrader<Version> {
@Override
protected void upgrade(Version target, SystemApplication application, ZoneApi zone) {
- log.info(String.format("Deploying %s version %s in %s", application.id(), target, zone.getId()));
+ log.info(Text.fmt("Deploying %s version %s in %s", application.id(), target, zone.getId()));
controller().applications().deploy(application, zone.getId(), target);
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VCMRMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VCMRMaintainer.java
index 4cd24289676..59bc083933f 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VCMRMaintainer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VCMRMaintainer.java
@@ -5,6 +5,7 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.NodeType;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeRepository;
@@ -166,7 +167,7 @@ public class VCMRMaintainer extends ControllerMaintainer {
if (shouldRetire(changeRequest, hostAction)) {
if (!node.wantToRetire()) {
- logger.info(String.format("Retiring %s due to %s", node.hostname().value(), changeRequest.getChangeRequestSource().getId()));
+ logger.info(Text.fmt("Retiring %s due to %s", node.hostname().value(), changeRequest.getChangeRequestSource().getId()));
// TODO: Remove try/catch once retirement is stabilized
try {
setWantToRetire(changeRequest.getZoneId(), node, true);
@@ -308,7 +309,7 @@ public class VCMRMaintainer extends ControllerMaintainer {
}
private void updateReport(ZoneId zoneId, Node node, VCMRReport report) {
- logger.info(String.format("Updating report for %s: %s", node.hostname(), report));
+ logger.info(Text.fmt("Updating report for %s: %s", node.hostname(), report));
var newNode = new NodeRepositoryNode();
newNode.setReports(report.toNodeReports());
nodeRepository.patchNode(zoneId, node.hostname().value(), newNode);
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationSource.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationSource.java
index fa89c6459f1..74fd79069af 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationSource.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationSource.java
@@ -8,6 +8,7 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
@@ -52,7 +53,7 @@ public class NotificationSource {
if (jobType.isPresent() && instance.isEmpty())
throw new IllegalArgumentException("Instance name must be present with job type");
if (jobType.isPresent() != runNumber.isPresent())
- throw new IllegalArgumentException(String.format("Run number (%s) must be 1-to-1 with job type (%s)",
+ throw new IllegalArgumentException(Text.fmt("Run number (%s) must be 1-to-1 with job type (%s)",
runNumber.isPresent() ? "present" : "missing", jobType.map(i -> "present").orElse("missing")));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
index 03107718544..60bb8bcc9d4 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.notification;
import com.yahoo.collections.Pair;
import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.text.Text;
import com.yahoo.vespa.curator.Lock;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics;
@@ -152,7 +153,7 @@ public class NotificationsDb {
private static Optional<Notification> createReindexNotification(NotificationSource source, Instant at, ClusterMetrics metric) {
if (metric.reindexingProgress().isEmpty()) return Optional.empty();
List<String> messages = metric.reindexingProgress().entrySet().stream()
- .map(entry -> String.format(Locale.US, "document type '%s' (%.1f%% done)", entry.getKey(), 100 * entry.getValue()))
+ .map(entry -> Text.fmt("document type '%s' (%.1f%% done)", entry.getKey(), 100 * entry.getValue()))
.sorted()
.collect(Collectors.toUnmodifiableList());
return Optional.of(new Notification(at, Type.reindex, Level.info, source, messages));
@@ -169,7 +170,7 @@ public class NotificationsDb {
double utilRelativeToLimit = util.get() / feedBlockLimit.get();
if (utilRelativeToLimit < 0.9) return Optional.empty();
- String message = String.format(Locale.US, "%s (usage: %.1f%%, feed block limit: %.1f%%)",
+ String message = Text.fmt("%s (usage: %.1f%%, feed block limit: %.1f%%)",
resource, 100 * util.get(), 100 * feedBlockLimit.get());
if (utilRelativeToLimit < 1) return Optional.of(new Pair<>(Level.warning, message));
return Optional.of(new Pair<>(Level.error, message));
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java
index 858bf857429..1a812737339 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java
@@ -5,6 +5,7 @@ import ai.vespa.util.http.hc4.retry.Sleeper;
import com.google.inject.Inject;
import com.yahoo.component.AbstractComponent;
import com.yahoo.jdisc.http.HttpRequest.Method;
+import com.yahoo.text.Text;
import com.yahoo.vespa.athenz.api.AthenzIdentity;
import com.yahoo.vespa.athenz.identity.ServiceIdentityProvider;
import com.yahoo.vespa.athenz.tls.AthenzIdentityVerifier;
@@ -120,7 +121,7 @@ public class ConfigServerRestExecutorImpl extends AbstractComponent implements C
errorBuilder.append("Talking to server ").append(url.getHost());
errorBuilder.append(", got ").append(status).append(" ")
.append(content).append("\n");
- LOG.log(Level.FINE, () -> String.format("Got response from %s with status code %d and content:\n %s",
+ LOG.log(Level.FINE, () -> Text.fmt("Got response from %s with status code %d and content:\n %s",
url.getHost(), status, content));
return Optional.empty();
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequest.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequest.java
index 5fd90c83999..aaab32d4ac6 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequest.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequest.java
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.proxy;
import com.yahoo.container.jdisc.HttpRequest;
+import com.yahoo.text.Text;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
@@ -32,7 +33,7 @@ public class ProxyRequest {
String path) {
Objects.requireNonNull(url);
if (!url.getPath().endsWith(path)) {
- throw new IllegalArgumentException(String.format("Request path '%s' does not end with proxy path '%s'", url.getPath(), path));
+ throw new IllegalArgumentException(Text.fmt("Request path '%s' does not end with proxy path '%s'", url.getPath(), path));
}
if (targets.isEmpty()) {
throw new IllegalArgumentException("targets must be non-empty");
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
index 4041693ee55..2bed7e85ba9 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
@@ -36,6 +36,7 @@ import com.yahoo.slime.Inspector;
import com.yahoo.slime.JsonParseException;
import com.yahoo.slime.Slime;
import com.yahoo.slime.SlimeUtils;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.Instance;
@@ -1512,7 +1513,7 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
setGlobalRotationStatus(deploymentId, inService, request);
setGlobalEndpointStatus(deploymentId, inService, request);
- return new MessageResponse(String.format("Successfully set %s in %s %s service",
+ return new MessageResponse(Text.fmt("Successfully set %s in %s %s service",
instance.id().toShortString(), zone, inService ? "in" : "out of"));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java
index dba618d139c..316c60af54a 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java
@@ -10,6 +10,7 @@ import com.yahoo.restapi.SlimeJsonResponse;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
import com.yahoo.slime.SlimeUtils;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.NotExistsException;
@@ -166,7 +167,7 @@ class JobControllerApiHandlerHelper {
catch (RuntimeException ignored) { } // Return response when this fails, which it does when, e.g., logserver is booting.
RunLog runLog = (after == null ? jobController.details(runId) : jobController.details(runId, Long.parseLong(after)))
- .orElseThrow(() -> new NotExistsException(String.format(
+ .orElseThrow(() -> new NotExistsException(Text.fmt(
"No run details exist for application: %s, job type: %s, number: %d",
runId.application().toShortString(), runId.type().jobName(), runId.number())));
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/athenz/AthenzApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/athenz/AthenzApiHandler.java
index 26c4bf6292a..03101fa0bc6 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/athenz/AthenzApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/athenz/AthenzApiHandler.java
@@ -13,6 +13,7 @@ import com.yahoo.restapi.ResourceResponse;
import com.yahoo.restapi.SlimeJsonResponse;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
+import com.yahoo.text.Text;
import com.yahoo.vespa.athenz.api.AthenzDomain;
import com.yahoo.vespa.athenz.api.AthenzPrincipal;
import com.yahoo.vespa.athenz.api.AthenzUser;
@@ -74,14 +75,14 @@ public class AthenzApiHandler extends LoggingRequestHandler {
if (path.matches("/athenz/v1/domains")) return domainList(request);
if (path.matches("/athenz/v1/properties")) return properties();
- return ErrorResponse.notFoundError(String.format("No '%s' handler at '%s'", request.getMethod(),
+ return ErrorResponse.notFoundError(Text.fmt("No '%s' handler at '%s'", request.getMethod(),
request.getUri().getPath()));
}
private HttpResponse post(HttpRequest request) {
Path path = new Path(request.getUri());
if (path.matches("/athenz/v1/user")) return signup(request);
- return ErrorResponse.notFoundError(String.format("No '%s' handler at '%s'", request.getMethod(),
+ return ErrorResponse.notFoundError(Text.fmt("No '%s' handler at '%s'", request.getMethod(),
request.getUri().getPath()));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java
index 59ae2a505bb..6857e2c310f 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/controller/ControllerApiHandler.java
@@ -15,6 +15,7 @@ import com.yahoo.restapi.ResourceResponse;
import com.yahoo.security.X509CertificateUtils;
import com.yahoo.slime.Inspector;
import com.yahoo.slime.SlimeUtils;
+import com.yahoo.text.Text;
import com.yahoo.vespa.athenz.api.AthenzUser;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
@@ -125,8 +126,8 @@ public class ControllerApiHandler extends AuditLoggingRequestHandler {
// Trigger deployment to include operator cert
Optional<JobId> jobId = controller.applications().deploymentTrigger().reTriggerOrAddToQueue(deployment);
return new MessageResponse(
- jobId.map(id -> String.format("Operator %s granted access and job %s triggered", principal.getName(), id.type().jobName()))
- .orElseGet(() -> String.format("Operator %s granted access and job trigger queued", principal.getName())));
+ jobId.map(id -> Text.fmt("Operator %s granted access and job %s triggered", principal.getName(), id.type().jobName()))
+ .orElseGet(() -> Text.fmt("Operator %s granted access and job trigger queued", principal.getName())));
}
private <T> T requireField(Inspector inspector, String field, Function<String, T> mapper) {
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiHandler.java
index e2922c040d2..4d85267f208 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/BadgeApiHandler.java
@@ -8,6 +8,7 @@ import com.yahoo.container.jdisc.LoggingRequestHandler;
import com.yahoo.jdisc.http.HttpRequest.Method;
import com.yahoo.restapi.ErrorResponse;
import com.yahoo.restapi.Path;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
@@ -68,7 +69,7 @@ public class BadgeApiHandler extends LoggingRequestHandler {
if (path.matches("/badge/v1/{tenant}/{application}/{instance}")) return overviewBadge(path.get("tenant"), path.get("application"), path.get("instance"));
if (path.matches("/badge/v1/{tenant}/{application}/{instance}/{jobName}")) return historyBadge(path.get("tenant"), path.get("application"), path.get("instance"), path.get("jobName"), request.getProperty("historyLength"));
- return ErrorResponse.notFoundError(String.format("No '%s' handler at '%s'", request.getMethod(),
+ return ErrorResponse.notFoundError(Text.fmt("No '%s' handler at '%s'", request.getMethod(),
request.getUri().getPath()));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployer.java
index 0331bf292a0..82c9d634646 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployer.java
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.restapi.systemflags;
import com.yahoo.concurrent.DaemonThreadFactory;
import com.yahoo.config.provision.SystemName;
+import com.yahoo.text.Text;
import com.yahoo.vespa.athenz.identity.ServiceIdentityProvider;
import com.yahoo.vespa.flags.FlagId;
import com.yahoo.vespa.flags.Flags;
@@ -65,7 +66,7 @@ class SystemFlagsDeployer {
try {
results.add(future.get());
} catch (InterruptedException | ExecutionException e) {
- log.log(Level.SEVERE, String.format("Failed to deploy flags for target '%s': %s", target, e.getMessage()), e);
+ log.log(Level.SEVERE, Text.fmt("Failed to deploy flags for target '%s': %s", target, e.getMessage()), e);
throw new RuntimeException(e);
}
});
@@ -85,7 +86,7 @@ class SystemFlagsDeployer {
currentFlagData = lookupTable(client.listFlagData(target));
definedFlags = client.listDefinedFlags(target);
} catch (Exception e) {
- log.log(Level.WARNING, String.format("Failed to list flag data for target '%s': %s", target, e.getMessage()), e);
+ log.log(Level.WARNING, Text.fmt("Failed to list flag data for target '%s': %s", target, e.getMessage()), e);
return new SystemFlagsDeployResult(List.of(OperationError.listFailed(e.getMessage(), target)));
}
@@ -119,7 +120,7 @@ class SystemFlagsDeployer {
dryRunFlagDataValidation(data);
}
} catch (Exception e) {
- log.log(Level.WARNING, String.format("Failed to put flag '%s' for target '%s': %s", data.id(), target, e.getMessage()), e);
+ log.log(Level.WARNING, Text.fmt("Failed to put flag '%s' for target '%s': %s", data.id(), target, e.getMessage()), e);
errors.add(OperationError.createFailed(e.getMessage(), target, data));
return;
}
@@ -145,7 +146,7 @@ class SystemFlagsDeployer {
dryRunFlagDataValidation(wantedData);
}
} catch (Exception e) {
- log.log(Level.WARNING, String.format("Failed to update flag '%s' for target '%s': %s", wantedData.id(), target, e.getMessage()), e);
+ log.log(Level.WARNING, Text.fmt("Failed to update flag '%s' for target '%s': %s", wantedData.id(), target, e.getMessage()), e);
errors.add(OperationError.updateFailed(e.getMessage(), target, wantedData));
return;
}
@@ -167,7 +168,7 @@ class SystemFlagsDeployer {
try {
client.deleteFlagData(target, id);
} catch (Exception e) {
- log.log(Level.WARNING, String.format("Failed to delete flag '%s' for target '%s': %s", id, target, e.getMessage()), e);
+ log.log(Level.WARNING, Text.fmt("Failed to delete flag '%s' for target '%s': %s", id, target, e.getMessage()), e);
errors.add(OperationError.deleteFailed(e.getMessage(), target, id));
return;
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java
index e195401f03a..8416376ba21 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiHandler.java
@@ -18,6 +18,7 @@ import com.yahoo.slime.Inspector;
import com.yahoo.slime.Slime;
import com.yahoo.slime.SlimeStream;
import com.yahoo.slime.SlimeUtils;
+import com.yahoo.text.Text;
import com.yahoo.vespa.flags.BooleanFlag;
import com.yahoo.vespa.flags.FetchVector;
import com.yahoo.vespa.flags.FlagSource;
@@ -106,7 +107,7 @@ public class UserApiHandler extends LoggingRequestHandler {
if (path.matches("/user/v1/tenant/{tenant}")) return listTenantRoleMembers(path.get("tenant"));
if (path.matches("/user/v1/tenant/{tenant}/application/{application}")) return listApplicationRoleMembers(path.get("tenant"), path.get("application"));
- return ErrorResponse.notFoundError(String.format("No '%s' handler at '%s'", request.getMethod(),
+ return ErrorResponse.notFoundError(Text.fmt("No '%s' handler at '%s'", request.getMethod(),
request.getUri().getPath()));
}
@@ -114,7 +115,7 @@ public class UserApiHandler extends LoggingRequestHandler {
if (path.matches("/user/v1/tenant/{tenant}")) return addTenantRoleMember(path.get("tenant"), request);
if (path.matches("/user/v1/tenant/{tenant}/application/{application}")) return addApplicationRoleMember(path.get("tenant"), path.get("application"), request);
- return ErrorResponse.notFoundError(String.format("No '%s' handler at '%s'", request.getMethod(),
+ return ErrorResponse.notFoundError(Text.fmt("No '%s' handler at '%s'", request.getMethod(),
request.getUri().getPath()));
}
@@ -122,7 +123,7 @@ public class UserApiHandler extends LoggingRequestHandler {
if (path.matches("/user/v1/tenant/{tenant}")) return removeTenantRoleMember(path.get("tenant"), request);
if (path.matches("/user/v1/tenant/{tenant}/application/{application}")) return removeApplicationRoleMember(path.get("tenant"), path.get("application"), request);
- return ErrorResponse.notFoundError(String.format("No '%s' handler at '%s'", request.getMethod(),
+ return ErrorResponse.notFoundError(Text.fmt("No '%s' handler at '%s'", request.getMethod(),
request.getUri().getPath()));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/Rotation.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/Rotation.java
index a638756a600..d1fbfa5dfd9 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/Rotation.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/Rotation.java
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.rotation;
+import com.yahoo.text.Text;
import java.util.Objects;
/**
@@ -43,7 +44,7 @@ public class Rotation {
@Override
public String toString() {
- return String.format("rotation %s -> %s", id().asString(), name());
+ return Text.fmt("rotation %s -> %s", id().asString(), name());
}
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java
index 71b1fb9b2e4..0af01f16dd7 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java
@@ -6,6 +6,7 @@ import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.application.api.Endpoint;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.ApplicationController;
import com.yahoo.vespa.hosted.controller.Instance;
import com.yahoo.vespa.hosted.controller.application.AssignedRotation;
@@ -165,7 +166,7 @@ public class RotationRepository {
Map<RotationId, Rotation> availableRotations = availableRotations(lock);
// Return first available rotation
RotationId rotation = requireNonEmpty(availableRotations.keySet()).iterator().next();
- log.info(String.format("Offering %s to application %s", rotation, id));
+ log.info(Text.fmt("Offering %s to application %s", rotation, id));
return allRotations.get(rotation);
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
index ae33d214ecc..ff4d35b5409 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
@@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableSortedSet;
import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.RoutingMethod;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry;
import com.yahoo.vespa.hosted.controller.application.Endpoint;
import com.yahoo.vespa.hosted.controller.application.Endpoint.Port;
@@ -132,7 +133,7 @@ public class RoutingPolicy {
@Override
public String toString() {
- return String.format("%s [endpoints: %s%s], %s owned by %s, in %s", canonicalName, endpoints,
+ return Text.fmt("%s [endpoints: %s%s], %s owned by %s, in %s", canonicalName, endpoints,
dnsZone.map(z -> ", DNS zone: " + z).orElse(""), id.cluster(), id.owner().toShortString(),
id.zone().value());
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzAccessControlRequests.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzAccessControlRequests.java
index 6cf0c8f4fb1..1b427c92171 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzAccessControlRequests.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzAccessControlRequests.java
@@ -5,6 +5,7 @@ import com.google.inject.Inject;
import com.yahoo.config.provision.TenantName;
import com.yahoo.jdisc.http.HttpRequest;
import com.yahoo.slime.Inspector;
+import com.yahoo.text.Text;
import com.yahoo.vespa.athenz.api.AthenzDomain;
import com.yahoo.vespa.athenz.api.AthenzPrincipal;
import com.yahoo.vespa.athenz.api.OktaAccessToken;
@@ -77,7 +78,7 @@ public class AthenzAccessControlRequests implements AccessControlRequests {
Principal principal = request.getUserPrincipal();
Objects.requireNonNull(principal, "Expected a user principal");
if ( ! (principal instanceof AthenzPrincipal))
- throw new RuntimeException(String.format("Expected principal of type %s, got %s",
+ throw new RuntimeException(Text.fmt("Expected principal of type %s, got %s",
AthenzPrincipal.class.getSimpleName(), principal.getClass().getName()));
return (AthenzPrincipal) principal;
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java
index 7e68ca289f6..1f3c8bc355f 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/tenant/CloudTenant.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.tenant;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import com.yahoo.config.provision.TenantName;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.api.integration.secrets.TenantSecretStore;
import java.security.Principal;
@@ -40,7 +41,7 @@ public class CloudTenant extends Tenant {
this.tenantSecretStores = tenantSecretStores;
this.archiveAccessRole = archiveAccessRole;
if (!archiveAccessRole.map(role -> VALID_ARCHIVE_ACCESS_ROLE_PATTERN.matcher(role).matches()).orElse(true))
- throw new IllegalArgumentException(String.format("Invalid archive access role '%s': Must match expected pattern: '%s'",
+ throw new IllegalArgumentException(Text.fmt("Invalid archive access role '%s': Must match expected pattern: '%s'",
archiveAccessRole.get(), VALID_ARCHIVE_ACCESS_ROLE_PATTERN.pattern()));
if (archiveAccessRole.map(role -> role.length() > 100).orElse(false))
throw new IllegalArgumentException("Invalid archive access role too long, must be 100 or less characters");
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java
index 006e4e63136..14b65a42513 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java
@@ -12,6 +12,7 @@ import com.yahoo.config.provision.zone.RoutingMethod;
import com.yahoo.config.provision.zone.ZoneApi;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.test.ManualClock;
+import com.yahoo.text.Text;
import com.yahoo.vespa.athenz.api.AthenzDomain;
import com.yahoo.vespa.athenz.api.AthenzPrincipal;
import com.yahoo.vespa.athenz.api.AthenzUser;
@@ -395,7 +396,7 @@ public final class ControllerTester {
private static RotationsConfig defaultRotationsConfig() {
RotationsConfig.Builder builder = new RotationsConfig.Builder();
for (int i = 1; i <= availableRotations; i++) {
- String id = String.format("%02d", i);
+ String id = Text.fmt("%02d", i);
builder = builder.rotations("rotation-id-" + id, "rotation-fqdn-" + id);
}
return new RotationsConfig(builder);
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java
index 78f688f545b..8989c0518c9 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java
@@ -9,6 +9,7 @@ import com.yahoo.config.provision.RegionName;
import com.yahoo.security.SignatureAlgorithm;
import com.yahoo.security.X509CertificateBuilder;
import com.yahoo.security.X509CertificateUtils;
+import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.application.ApplicationPackage;
import javax.security.auth.x500.X500Principal;
@@ -166,7 +167,7 @@ public class ApplicationPackageBuilder {
}
public ApplicationPackageBuilder athenzIdentity(AthenzDomain domain, AthenzService service) {
- this.athenzIdentityAttributes = String.format("athenz-domain='%s' athenz-service='%s'", domain.value(),
+ this.athenzIdentityAttributes = Text.fmt("athenz-domain='%s' athenz-service='%s'", domain.value(),
service.value());
return this;
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
index 098282e4e89..bb81d7f5614 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
@@ -13,6 +13,7 @@ import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.NodeType;
import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.text.Text;
import com.yahoo.vespa.flags.json.FlagData;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeploymentData;
@@ -477,8 +478,8 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
@Override
public ApplicationView getApplicationView(String tenantName, String applicationName, String instanceName,
String environment, String region) {
- String cfgHostname = String.format("https://cfg.%s.%s.test.vip:4443", environment, region);
- String cfgServiceUrlPrefix = String.format("%s/serviceview/v1/tenant/%s/application/%s/environment/%s/region/%s/instance/%s/service",
+ String cfgHostname = Text.fmt("https://cfg.%s.%s.test.vip:4443", environment, region);
+ String cfgServiceUrlPrefix = Text.fmt("%s/serviceview/v1/tenant/%s/application/%s/environment/%s/region/%s/instance/%s/service",
cfgHostname, tenantName, applicationName,
environment, region, instanceName);
ApplicationView applicationView = new ApplicationView();
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java
index ca3909af0ba..10b90bf9bbd 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneRegistryMock.java
@@ -14,6 +14,7 @@ import com.yahoo.config.provision.zone.UpgradePolicy;
import com.yahoo.config.provision.zone.ZoneApi;
import com.yahoo.config.provision.zone.ZoneFilter;
import com.yahoo.config.provision.zone.ZoneId;
+import com.yahoo.text.Text;
import com.yahoo.vespa.athenz.api.AthenzIdentity;
import com.yahoo.vespa.athenz.api.AthenzService;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
@@ -222,7 +223,7 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry
@Override
public URI getConfigServerVipUri(ZoneId zoneId) {
- return URI.create(String.format("https://cfg.%s.test.vip:4443/", zoneId.value()));
+ return URI.create(Text.fmt("https://cfg.%s.test.vip:4443/", zoneId.value()));
}
@Override