Skip to content

Commit 9159b3f

Browse files
authored
Deprecate Hipchat Watcher actions (#39160)
Hipchat has ceased operating, so we are deprecating Hipchat Watcher actions to be removed in Elasticsearch 7.0. This also adds a check for hipchat account settings in elasticsearch.yml. Unfortunately with the current infrastructure we can't check the watches themselves because they're in an index.
1 parent fa98cea commit 9159b3f

File tree

8 files changed

+35
-8
lines changed

8 files changed

+35
-8
lines changed

docs/reference/settings/notification-settings.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ You can configure the following HipChat notification settings in
200200
`elasticsearch.yml`. For more information about sending notifications
201201
via HipChat, see {xpack-ref}/actions-hipchat.html#configuring-hipchat-actions[Configuring HipChat].
202202

203+
deprecated[6.7.0,Hipchat notification has been deprecated as Hipchat has ceased operation]
204+
203205
`xpack.notification.hipchat` ::
204206
Specifies account information for sending notifications
205207
via HipChat. You can specify the following HipChat account attributes:

x-pack/docs/en/watcher/actions/hipchat.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[[actions-hipchat]]
22
=== HipChat Action
33

4+
deprecated[6.7.0,Hipchat actions have been deprecated as Hipchat has ceased operation]
5+
46
Use the `hipchat` action to send messages to https://www.hipchat.com[HipChat]
57
rooms or users. To send HipChat messages, you must
68
<<configuring-hipchat, configure at least one HipChat account>> in `elasticsearch.yml`.

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ private DeprecationChecks() {
5757
NodeDeprecationChecks::tlsv1ProtocolDisabled,
5858
NodeDeprecationChecks::transportSslEnabledWithoutSecurityEnabled,
5959
NodeDeprecationChecks::watcherNotificationsSecureSettingsCheck,
60+
NodeDeprecationChecks::watcherHipchatNotificationSettingsCheck,
6061
NodeDeprecationChecks::auditIndexSettingsCheck
6162
));
6263

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ static DeprecationIssue discoveryConfigurationCheck(Settings nodeSettings, Plugi
154154

155155
static DeprecationIssue watcherNotificationsSecureSettingsCheck(Settings nodeSettings, PluginsAndModules plugins) {
156156
if (false == nodeSettings.getByPrefix("xpack.notification.email.account.").filter(s -> s.endsWith(".smtp.password")).isEmpty()
157-
|| false == nodeSettings.getByPrefix("xpack.notification.hipchat.account.").filter(s -> s.endsWith(".auth_token")).isEmpty()
158157
|| false == nodeSettings.getByPrefix("xpack.notification.jira.account.")
159158
.filter(s -> s.endsWith(".url") || s.endsWith(".user") || s.endsWith(".password")).isEmpty()
160159
|| false == nodeSettings.getByPrefix("xpack.notification.pagerduty.account.")
@@ -169,6 +168,17 @@ static DeprecationIssue watcherNotificationsSecureSettingsCheck(Settings nodeSet
169168
return null;
170169
}
171170

171+
static DeprecationIssue watcherHipchatNotificationSettingsCheck(Settings nodeSettings, PluginsAndModules plugins) {
172+
if (nodeSettings.getByPrefix("xpack.notification.hipchat.").size() > 0) {
173+
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
174+
"Watcher Hipchat notifications will be removed in the next major release",
175+
"https://www.elastic.co/guide/en/elasticsearch/reference/7.0/breaking-changes-7.0.html" +
176+
"#watcher-notifications-account-settings",
177+
"[hipchat] actions are deprecated and should be removed from watch definitions");
178+
}
179+
return null;
180+
}
181+
172182
static DeprecationIssue azureRepositoryChanges(Settings nodeSettings, PluginsAndModules plugins) {
173183
if (plugins.getPluginInfos().stream().anyMatch(pluginInfo -> "repository-azure".equals(pluginInfo.getName()))) {
174184
return new DeprecationIssue(DeprecationIssue.Level.WARNING,

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,6 @@ public void testWatcherNotificationsSecureSettings() {
162162
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html"
163163
+ "#watcher-notifications-account-settings",
164164
"account authentication settings must use the keystore");
165-
assertSettingsAndIssue("xpack.notification.hipchat.account." + randomAlphaOfLength(4) + ".auth_token", randomAlphaOfLength(4),
166-
expected);
167-
expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
168-
"Watcher notification accounts' authentication settings must be defined securely",
169-
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html"
170-
+ "#watcher-notifications-account-settings",
171-
"account authentication settings must use the keystore");
172165
assertSettingsAndIssue("xpack.notification.jira.account." + randomAlphaOfLength(4) + ".url", randomAlphaOfLength(4), expected);
173166
assertSettingsAndIssue("xpack.notification.jira.account." + randomAlphaOfLength(4) + ".user", randomAlphaOfLength(4), expected);
174167
assertSettingsAndIssue("xpack.notification.jira.account." + randomAlphaOfLength(4) + ".password",
@@ -188,6 +181,16 @@ public void testWatcherNotificationsSecureSettings() {
188181
assertSettingsAndIssue("xpack.notification.slack.account." + randomAlphaOfLength(4) + ".url", randomAlphaOfLength(4), expected);
189182
}
190183

184+
public void testWatcherHipchatSettings() {
185+
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
186+
"Watcher Hipchat notifications will be removed in the next major release",
187+
"https://www.elastic.co/guide/en/elasticsearch/reference/7.0/breaking-changes-7.0.html" +
188+
"#watcher-notifications-account-settings",
189+
"[hipchat] actions are deprecated and should be removed from watch definitions");
190+
assertSettingsAndIssues(Settings.builder().put("xpack.notification.hipchat.account.profile", randomAlphaOfLength(4)).build(),
191+
expected);
192+
}
193+
191194
public void testTribeNodeCheck() {
192195
String tribeSetting = "tribe." + randomAlphaOfLengthBetween(1, 20) + ".cluster.name";
193196
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatAction.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
import java.io.IOException;
2121
import java.util.Objects;
2222

23+
/**
24+
* @deprecated Hipchat actions will be removed in Elasticsearch 7.0 since Hipchat is defunct
25+
*/
26+
@Deprecated
2327
public class HipChatAction implements Action {
2428

2529
public static final String TYPE = "hipchat";

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.elasticsearch.xpack.watcher.actions.hipchat;
77

88
import org.apache.logging.log4j.LogManager;
9+
import org.elasticsearch.common.logging.DeprecationLogger;
910
import org.elasticsearch.common.xcontent.XContentParser;
1011
import org.elasticsearch.xpack.core.watcher.actions.ActionFactory;
1112
import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine;
@@ -18,6 +19,7 @@ public class HipChatActionFactory extends ActionFactory {
1819

1920
private final TextTemplateEngine templateEngine;
2021
private final HipChatService hipchatService;
22+
private final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(HipChatActionFactory.class));
2123

2224
public HipChatActionFactory(TextTemplateEngine templateEngine, HipChatService hipchatService) {
2325
super(LogManager.getLogger(ExecutableHipChatAction.class));
@@ -27,6 +29,7 @@ public HipChatActionFactory(TextTemplateEngine templateEngine, HipChatService hi
2729

2830
@Override
2931
public ExecutableHipChatAction parseExecutable(String watchId, String actionId, XContentParser parser) throws IOException {
32+
deprecationLogger.deprecatedAndMaybeLog("hipchat_action", "hipchat actions are deprecated and will be removed in 7.0");
3033
HipChatAction action = HipChatAction.parse(watchId, actionId, parser);
3134
HipChatAccount account = hipchatService.getAccount(action.account);
3235
account.validateParsedTemplate(watchId, actionId, action.message);

x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactoryTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public void testParseAction() throws Exception {
4848
assertThat(parsedAction.action(), is(action));
4949

5050
verify(account, times(1)).validateParsedTemplate("_w1", "_a1", action.message);
51+
assertWarnings("hipchat actions are deprecated and will be removed in 7.0");
5152
}
5253

5354
public void testParseActionUnknownAccount() throws Exception {
@@ -59,5 +60,6 @@ public void testParseActionUnknownAccount() throws Exception {
5960
XContentParser parser = createParser(jsonBuilder);
6061
parser.nextToken();
6162
expectThrows(IllegalArgumentException.class, () -> factory.parseExecutable("_w1", "_a1", parser));
63+
assertWarnings("hipchat actions are deprecated and will be removed in 7.0");
6264
}
6365
}

0 commit comments

Comments
 (0)