Skip to content

Commit f6babb9

Browse files
committed
Address Copilot review: make API-version error messages syntax-neutral
Error messages for the webhooks/node-sources API-version gates only referenced the legacy --include-webhooks/--include-node-sources flags, which was misleading when using the new --include webhooks/nodeSources syntax.
1 parent 6bb0150 commit f6babb9

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

rd-cli-tool/src/main/java/org/rundeck/client/tool/commands/projects/Archives.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ public int importArchive(@CommandLine.Mixin ArchiveImportOpts opts) throws Input
192192
}
193193
Set<ImportFlags> importFlags = opts.calculateFlags();
194194
if ((importFlags.contains(ImportFlags.webhooks) || opts.isWhkRegenAuthTokens()) && getRdTool().getClient().getApiVersion() < 34) {
195-
throw new InputError(String.format("Cannot use --include-webhooks or --regenerate-tokens with API < 34 (currently: %s)", getRdTool().getClient().getApiVersion()));
195+
throw new InputError(String.format("Cannot include webhooks (--include-webhooks or --include webhooks) or use --regenerate-tokens with API < 34 (currently: %s)", getRdTool().getClient().getApiVersion()));
196196
}
197197
if ((importFlags.contains(ImportFlags.webhooks) && opts.isWhkRegenUuid()) && getRdTool().getClient().getApiVersion() < 47) {
198-
throw new InputError(String.format("Cannot use --include-webhooks with --remove-webhooks-uuids with API < 47 (currently: %s)", getRdTool().getClient().getApiVersion()));
198+
throw new InputError(String.format("Cannot include webhooks (--include-webhooks or --include webhooks) with --remove-webhooks-uuids with API < 47 (currently: %s)", getRdTool().getClient().getApiVersion()));
199199
}
200200
if ((importFlags.contains(ImportFlags.nodeSources)) && getRdTool().getClient().getApiVersion() < 38) {
201-
throw new InputError(String.format("Cannot use --include-node-sources with API < 38 (currently: %s)", getRdTool().getClient().getApiVersion()));
201+
throw new InputError(String.format("Cannot include node sources (--include-node-sources or --include nodeSources) with API < 38 (currently: %s)", getRdTool().getClient().getApiVersion()));
202202
}
203203
RequestBody body = RequestBody.create(input, Client.MEDIA_TYPE_ZIP);
204204

rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/projects/ArchivesSpec.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class ArchivesSpec extends Specification {
118118

119119
then:
120120
InputError exc = thrown()
121-
exc.message.contains('Cannot use --include-webhooks or --regenerate-tokens with API < 34')
121+
exc.message.contains('Cannot include webhooks (--include-webhooks or --include webhooks) or use --regenerate-tokens with API < 34')
122122

123123
where:
124124
apiversion = 33
@@ -220,7 +220,7 @@ class ArchivesSpec extends Specification {
220220

221221
then:
222222
InputError exc = thrown()
223-
exc.message.contains('Cannot use --include-node-sources with API < 38')
223+
exc.message.contains('Cannot include node sources (--include-node-sources or --include nodeSources) with API < 38')
224224

225225
where:
226226
apiversion = 37
@@ -320,7 +320,7 @@ class ArchivesSpec extends Specification {
320320

321321
then:
322322
InputError exc = thrown()
323-
exc.message.contains('Cannot use --include-webhooks with --remove-webhooks-uuids with API < 47')
323+
exc.message.contains('Cannot include webhooks (--include-webhooks or --include webhooks) with --remove-webhooks-uuids with API < 47')
324324

325325
where:
326326
apiversion = 46

0 commit comments

Comments
 (0)