Skip to content

Commit

Permalink
Move websocket ports back to "certgen" and clone to "install" at inge…
Browse files Browse the repository at this point in the history
…stion time
  • Loading branch information
tresf committed Jul 7, 2024
1 parent 175d640 commit 86f181c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/qz/build/provision/ProvisionBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@
import org.codehaus.jettison.json.JSONObject;
import qz.build.provision.params.Arch;
import qz.build.provision.params.Os;
import qz.build.provision.params.Phase;
import qz.build.provision.params.Type;
import qz.build.provision.params.types.Script;
import qz.build.provision.params.types.Software;
import qz.common.Constants;
import qz.installer.provision.invoker.PropertyInvoker;
import qz.utils.ArgValue;
import qz.utils.SystemUtilities;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;

import static qz.common.Constants.PROVISION_FILE;

public class ProvisionBuilder {
protected static final Logger log = LogManager.getLogger(ProvisionBuilder.class);
Expand Down Expand Up @@ -111,6 +117,17 @@ private void ingestStep(JSONObject jsonStep, Path relativePath) throws JSONExcep
if(copyResource(step)) {
log.info("[SUCCESS] Step successfully processed '{}'", step);
jsonSteps.put(step.toJSON());
// Special case for custom websocket ports
if(step.getType() == Type.PROPERTY && step.getPhase() == Phase.CERTGEN) {
HashMap<String, String> pairs = PropertyInvoker.parsePropertyPairs(step);
if(pairs.get(ArgValue.WEBSOCKET_SECURE_PORTS.getMatch()) != null ||
pairs.get(ArgValue.WEBSOCKET_INSECURE_PORTS.getMatch()) != null) {

}
// Clone to install step
jsonSteps.put(step.cloneTo(Phase.INSTALL).toJSON());
}

} else {
log.error("[SKIPPED] Resources could not be saved '{}'", step);
}
Expand Down
5 changes: 5 additions & 0 deletions src/qz/build/provision/Step.java
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,9 @@ private static UnsupportedOperationException formatted(String message, Object ..
String formatted = String.format(message, args);
return new UnsupportedOperationException(formatted);
}
Step cloneTo(Phase phase) {
return relativePath != null ?
new Step(relativePath, description, type, os, arch, phase, data, args) :
new Step(relativeClass, description, type, os, arch, phase, data, args);
}
}

0 comments on commit 86f181c

Please sign in to comment.