• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 19790759973

29 Nov 2025 11:27PM UTC coverage: 69.41% (-0.02%) from 69.431%
19790759973

push

github

web-flow
#1616: fixed postInstall problems (#1619)

3697 of 5857 branches covered (63.12%)

Branch coverage included in aggregate %.

9620 of 13329 relevant lines covered (72.17%)

3.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.48
cli/src/main/java/com/devonfw/tools/ide/tool/aws/Aws.java
1
package com.devonfw.tools.ide.tool.aws;
2

3
import java.io.IOException;
4
import java.nio.file.Path;
5
import java.util.Set;
6

7
import com.devonfw.tools.ide.common.Tag;
8
import com.devonfw.tools.ide.context.IdeContext;
9
import com.devonfw.tools.ide.io.FileAccess;
10
import com.devonfw.tools.ide.nls.NlsBundle;
11
import com.devonfw.tools.ide.process.EnvironmentContext;
12
import com.devonfw.tools.ide.process.ProcessContext;
13
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
14
import com.devonfw.tools.ide.tool.ToolInstallRequest;
15
import com.devonfw.tools.ide.tool.ToolInstallation;
16

17
/**
18
 * {@link LocalToolCommandlet} for <a href="https://docs.aws.amazon.com/cli/">AWS CLI</a> (Amazon Web Services Command Line Interface).
19
 */
20
public class Aws extends LocalToolCommandlet {
21

22
  /**
23
   * The constructor.
24
   *
25
   * @param context the {@link IdeContext}.
26
   */
27
  public Aws(IdeContext context) {
28

29
    super(context, "aws", Set.of(Tag.CLOUD));
6✔
30
  }
1✔
31

32
  @Override
33
  protected void postInstallOnNewInstallation(ToolInstallRequest request) {
34

35
    super.postInstallOnNewInstallation(request);
3✔
36
    Path awsConfigDir = this.context.getConfPath().resolve("aws");
6✔
37
    this.context.getFileAccess().mkdirs(awsConfigDir);
5✔
38
  }
1✔
39

40
  @Override
41
  protected void postExtract(Path extractedDir) {
42

43
    if (this.context.getSystemInfo().isLinux()) {
5!
44
      // running the install-script that aws shipped
45
      ProcessContext pc = this.context.newProcess();
×
46
      Path linuxInstallScript = extractedDir.resolve("install");
×
47
      pc.executable(linuxInstallScript);
×
48
      pc.addArgs("-i", extractedDir.toString(), "-b", extractedDir.toString());
×
49
      pc.run();
×
50

51
      // The install-script that aws ships creates symbolic links to binaries but using absolute paths.
52
      // Since the current process happens in a temporary dir, these links wouldn't be valid after moving the
53
      // installation files to the target dir. So the absolute paths are replaced by relative ones.
54
      FileAccess fileAccess = this.context.getFileAccess();
×
55
      for (String file : new String[] { "aws", "aws_completer", "v2/current" }) {
×
56
        Path link = extractedDir.resolve(file);
×
57
        try {
58
          fileAccess.symlink(link.toRealPath(), link, true);
×
59
        } catch (IOException e) {
×
60
          throw new RuntimeException(
×
61
              "Failed to replace absolute link (" + link + ") provided by AWS install script with relative link.", e);
62
        }
×
63
      }
64
      fileAccess.delete(linuxInstallScript);
×
65
      fileAccess.delete(extractedDir.resolve("dist"));
×
66
    }
67
  }
1✔
68

69
  @Override
70
  public void printHelp(NlsBundle bundle) {
71

72
    this.context.info("To get detailed help about the usage of the AWS CLI, use \"aws help\"");
4✔
73
  }
1✔
74

75
  @Override
76
  public void setEnvironment(EnvironmentContext environmentContext, ToolInstallation toolInstallation, boolean extraInstallation) {
77

78
    super.setEnvironment(environmentContext, toolInstallation, extraInstallation);
5✔
79
    Path awsConfigDir = this.context.getConfPath().resolve("aws");
6✔
80
    environmentContext.withEnvVar("AWS_CONFIG_FILE", awsConfigDir.resolve("config").toString());
8✔
81
    environmentContext.withEnvVar("AWS_SHARED_CREDENTIALS_FILE", awsConfigDir.resolve("credentials").toString());
8✔
82
  }
1✔
83

84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc