brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Refactoring openIptables executio...
Date Thu, 22 Oct 2015 14:08:09 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/980#discussion_r42751884
  
    --- Diff: software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineInitTasks.java
---
    @@ -75,13 +72,19 @@ public Void call() {
         /**
          * Returns a queued {@link Task} which stops iptables on the given machine.
          */
    -    public Task<Void> stopIptablesAsync(final SshMachineLocation machine) {
    -        return DynamicTasks.queue("stop iptables", new Callable<Void>() {
    -            public Void call() {
    -                stopIptablesImpl(machine);
    -                return null;
    -            }
    -        });
    +    public ProcessTaskWrapper<Integer> stopIptablesAsync(final SshMachineLocation
machine) {
    +
    +        log.info("Stopping iptables for {} at {}", entity(), machine);
    +
    +        List<String> cmds = ImmutableList.<String>of();
    +        if (isLocationFirewalldEnabled(machine)) {
    +            cmds = ImmutableList.of(IptablesCommands.firewalldServiceStop(), IptablesCommands.firewalldServiceStatus());
    +        } else {
    +            cmds = ImmutableList.of(IptablesCommands.iptablesServiceStop(), IptablesCommands.iptablesServiceStatus());
    +        }
    +        ProcessTaskFactory<Integer>  stopIptables = SshTasks.newSshExecTaskFactory(machine,
cmds.toArray(new String[cmds.size()]))
    +                .summary("stop iptables");
    --- End diff --
    
    Also do a `.requireExitCodeZero` unless the command is expected to fail.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message