Skip to content

Commit bf59ba2

Browse files
Fixing slim attacher CLI with requested agent version for download (#3096)
* Fixing slim attacher CLI with requested agent version for download --------- Co-authored-by: Sylvain Juge <[email protected]>
1 parent 9c751f9 commit bf59ba2

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ communication - {pull}2996[#2996]
5353
* Fix usage of `HttpUrlConnection.getResponseCode()` causing an error event due to exception capturing, even when it is internally handled - {pull}3024[#3024]
5454
* Fix source code jar to contain apm-agent sources - {pull}3063[#3063]
5555
* Fix security exception when security manager is used with `log_level=debug` - {pull}3077[#3077]
56+
* Fix slim attacher when downloading agent version - {pull}3096[#3096]
5657
5758
[[release-notes-1.x]]
5859
=== Java Agent version 1.x

apm-agent-attach-cli/src/main/java/co/elastic/apm/attach/AgentAttacher.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ private Arguments(DiscoveryRules rules, Set<String> includePids, Map<String, Str
380380
if (!agentJar.canRead()) {
381381
throw new IllegalArgumentException(String.format("Agent jar %s is not readable", agentJarString));
382382
}
383-
} else {
383+
} else if (downloadAgentVersion == null) {
384+
// this would fail if using the slim attacher CLI jar without providing either --agent-jar or --download-agent-version
384385
this.agentJar = ElasticApmAttacher.getBundledAgentJarFile();
385386
}
386387
if (!config.isEmpty() && argsProvider != null) {

apm-agent-attach/src/main/java/co/elastic/apm/attach/ElasticApmAttacher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private static File getAgentJarFile() {
213213

214214
// Running attacher without proper packaging is quite common when running it from the IDE without having
215215
// it packaged from CLI beforehand
216-
throw new IllegalStateException("unable to get packaged agent within attacher jar, make sure to execute 'mvn clean package' first.");
216+
throw new IllegalStateException("unable to get packaged agent within attacher jar.");
217217
}
218218
}
219219

0 commit comments

Comments
 (0)