Github user neykov commented on a diff in the pull request: https://github.com/apache/incubator-brooklyn/pull/980#discussion_r42750820 --- 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"); + return DynamicTasks.queue(stopIptables); --- End diff -- The above 3 lines repeat multiple times in the file, in functions `insertIptablesRulesOnCommandBatches`, `serviceIptablesSave`, `listIptablesRules`. Better create a single helper function which takes the machine, list of commands and summary for the task instead of creating a dedicated function for each call.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---