From b7b4f30b0c485988396c579e079e38d5ac1a8430 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 20 Feb 2024 16:22:02 +0300 Subject: [PATCH] disable aws --- src/main/java/com/rultor/agents/Agents.java | 32 ++++++++++++--------- src/main/java/com/rultor/spi/Agent.java | 27 +++++++++++++++++ 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/rultor/agents/Agents.java b/src/main/java/com/rultor/agents/Agents.java index 95e9ebe501..f81b334429 100644 --- a/src/main/java/com/rultor/agents/Agents.java +++ b/src/main/java/com/rultor/agents/Agents.java @@ -263,17 +263,19 @@ public Agent agent(final Talk talk, final Profile profile) new QnSafe(question) ), new StartsRequest(profile), - new StartsInstance( - new AwsEc2Image( - new AwsEc2( - Manifests.read("Rultor-EC2Key"), - Manifests.read("Rultor-EC2Secret") + new Agent.Disabled( + new StartsInstance( + new AwsEc2Image( + new AwsEc2( + Manifests.read("Rultor-EC2Key"), + Manifests.read("Rultor-EC2Secret") + ), + Manifests.read("Rultor-EC2Image") ), - Manifests.read("Rultor-EC2Image") - ), - profile, - Agents.PORT, Agents.LOGIN, - Agents.priv() + profile, + Agents.PORT, Agents.LOGIN, + Agents.priv() + ) ), new RegistersShell( profile, @@ -305,10 +307,12 @@ public Agent agent(final Talk talk, final Profile profile) new ReleaseBinaries(this.github, profile), new Dephantomizes(this.github), new Reports(this.github), - new StopsInstance( - new AwsEc2( - Manifests.read("Rultor-EC2Key"), - Manifests.read("Rultor-EC2Secret") + new Agent.Disabled( + new StopsInstance( + new AwsEc2( + Manifests.read("Rultor-EC2Key"), + Manifests.read("Rultor-EC2Secret") + ) ) ), new RemovesShell(), diff --git a/src/main/java/com/rultor/spi/Agent.java b/src/main/java/com/rultor/spi/Agent.java index 0d63d7d656..eeaaf58de3 100644 --- a/src/main/java/com/rultor/spi/Agent.java +++ b/src/main/java/com/rultor/spi/Agent.java @@ -89,4 +89,31 @@ public void execute(final Talk talk) throws IOException { } } + /** + * Disabled. + * + * @since 1.0 + */ + @Immutable + @ToString + @EqualsAndHashCode(of = "agent") + final class Disabled implements Agent { + /** + * Agent to disable. + */ + private final transient Agent agent; + + /** + * Ctor. + * @param agt Agent + */ + public Disabled(final Agent agt) { + this.agent = agt; + } + + @Override + public void execute(final Talk talk) throws IOException { + // nothing to do + } + } }