From e5f1ef47995c508b5429207ad157e31ba2f47c9c Mon Sep 17 00:00:00 2001 From: David Roberts Date: Mon, 29 Nov 2021 15:38:13 +0000 Subject: [PATCH] [ML] Switch message and detail for model snapshot deprecations This is a fix to the fix of #81060. In the original fix where I tried to port the changes from #79387 to master I didn't notice that the text of the message and detail of the deprecation had been largely switched around. My tweaks to the wording in #81060 did not make this major switch. This PR switches the two strings we generate. --- .../xpack/deprecation/MlDeprecationIT.java | 2 +- .../xpack/deprecation/MlDeprecationChecker.java | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java b/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java index 3fc880adcf235..dad4d25afe62b 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java +++ b/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/MlDeprecationIT.java @@ -105,7 +105,7 @@ public void testMlDeprecationChecks() throws Exception { assertThat(response.getMlSettingsIssues(), hasSize(1)); assertThat( response.getMlSettingsIssues().get(0).getMessage(), - containsString("Delete model snapshot [1] or update it to 7.0.0 or greater") + containsString("Model snapshot [1] for job [deprecation_check_job] has an obsolete minimum version") ); assertThat(response.getMlSettingsIssues().get(0).getMeta(), equalTo(Map.of("job_id", jobId, "snapshot_id", "1"))); } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/MlDeprecationChecker.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/MlDeprecationChecker.java index 36092a820844f..2988af7a2dab6 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/MlDeprecationChecker.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/MlDeprecationChecker.java @@ -73,12 +73,9 @@ static Optional checkModelSnapshot(ModelSnapshot modelSnapshot StringBuilder details = new StringBuilder( String.format( Locale.ROOT, - // Important: the Kibana upgrade assistant expects this to match the pattern /[Mm]odel snapshot/ - // and if it doesn't then the expected "Fix" button won't appear for this deprecation. - "Model snapshot [%s] for job [%s] has an obsolete minimum version [%s].", + "Delete model snapshot [%s] or update it to %s or greater.", modelSnapshot.getSnapshotId(), - modelSnapshot.getJobId(), - modelSnapshot.getMinVersion() + MIN_REPORTED_SUPPORTED_SNAPSHOT_VERSION ) ); if (modelSnapshot.getLatestRecordTimeStamp() != null) { @@ -95,9 +92,12 @@ static Optional checkModelSnapshot(ModelSnapshot modelSnapshot DeprecationIssue.Level.CRITICAL, String.format( Locale.ROOT, - "Delete model snapshot [%s] or update it to %s or greater.", + // Important: the Kibana upgrade assistant expects this to match the pattern /[Mm]odel snapshot/ + // and if it doesn't then the expected "Fix" button won't appear for this deprecation. + "Model snapshot [%s] for job [%s] has an obsolete minimum version [%s].", modelSnapshot.getSnapshotId(), - MIN_REPORTED_SUPPORTED_SNAPSHOT_VERSION + modelSnapshot.getJobId(), + modelSnapshot.getMinVersion() ), "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-upgrade-job-model-snapshot.html", details.toString(),