Skip to content

Commit

Permalink
fix: added command option to skip acls (#54)
Browse files Browse the repository at this point in the history
* fix: added command option to skip acls

* fix: added default for the skip argument in other command classes

* refactor: made --skip-acls a global arg
  • Loading branch information
Cinetik authored Feb 17, 2021
1 parent a7f3b13 commit 1e47feb
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/main/java/com/devshawn/kafka/gitops/MainCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class MainCommand implements Callable<Integer> {
@Option(names = {"--no-delete"}, description = "Disable the ability to delete resources.")
private boolean deleteDisabled = false;

@Option(names = {"--skip-acls"}, description = "Do not take ACL into account in the plan file.")
private boolean skipAcls = false;

@Option(names = {"-h", "--help"}, usageHelp = true, description = "Display this help message.")
private boolean helpRequested = false;

Expand Down Expand Up @@ -65,6 +68,10 @@ public boolean isDeleteDisabled() {
return deleteDisabled;
}

public boolean areAclsDisabled() {
return skipAcls;
}

public static void main(String[] args) {
int exitCode = new CommandLine(new MainCommand()).execute(args);
System.exit(exitCode);
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/devshawn/kafka/gitops/StateManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public DesiredPlan plan() {
private DesiredPlan generatePlan() {
DesiredState desiredState = getDesiredState();
DesiredPlan.Builder desiredPlan = new DesiredPlan.Builder();
planManager.planAcls(desiredState, desiredPlan);
if (!managerConfig.isSkipAclsDisabled()) {
planManager.planAcls(desiredState, desiredPlan);
}
planManager.planTopics(desiredState, desiredPlan);
return desiredPlan.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private ManagerConfig generateStateManagerConfig() {
.setVerboseRequested(parent.isVerboseRequested())
.setDeleteDisabled(parent.isDeleteDisabled())
.setIncludeUnchangedEnabled(false)
.setSkipAclsDisabled(parent.areAclsDisabled())
.setStateFile(parent.getFile())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private ManagerConfig generateStateManagerConfig() {
.setVerboseRequested(parent.isVerboseRequested())
.setDeleteDisabled(parent.isDeleteDisabled())
.setIncludeUnchangedEnabled(false)
.setSkipAclsDisabled(parent.areAclsDisabled())
.setStateFile(parent.getFile())
.setNullablePlanFile(planFile)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private ManagerConfig generateStateManagerConfig() {
.setDeleteDisabled(parent.isDeleteDisabled())
.setIncludeUnchangedEnabled(includeUnchanged)
.setStateFile(parent.getFile())
.setSkipAclsDisabled(parent.areAclsDisabled())
.setNullablePlanFile(outputFile)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ private ManagerConfig generateStateManagerConfig() {
.setVerboseRequested(parent.isVerboseRequested())
.setDeleteDisabled(parent.isDeleteDisabled())
.setIncludeUnchangedEnabled(false)
.setSkipAclsDisabled(parent.areAclsDisabled())
.setStateFile(parent.getFile())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public interface ManagerConfig {

boolean isIncludeUnchangedEnabled();

boolean isSkipAclsDisabled();

File getStateFile();

Optional<File> getPlanFile();
Expand Down

0 comments on commit 1e47feb

Please sign in to comment.