Skip to content

Commit

Permalink
Fix duplicate definition of constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Oct 25, 2023
1 parent b229e3f commit e0c3237
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.jdrupes.vmoperator.common.Constants.APP_NAME;
import org.jdrupes.vmoperator.common.Convertions;
import org.jdrupes.vmoperator.util.Dto;
import org.jdrupes.vmoperator.util.FsdUtils;
Expand Down Expand Up @@ -272,7 +273,7 @@ private void checkDrives() {
private boolean checkRuntimeDir() {
// Runtime directory (sockets etc.)
if (runtimeDir == null) {
var appDir = FsdUtils.runtimeDir(Runner.APP_NAME.replace("-", ""));
var appDir = FsdUtils.runtimeDir(APP_NAME.replace("-", ""));
if (!Files.exists(appDir) && appDir.toFile().mkdirs()) {
try {
// When appDir is derived from XDG_RUNTIME_DIR
Expand All @@ -288,7 +289,7 @@ private boolean checkRuntimeDir() {
runtimeDir));
}
}
runtimeDir = FsdUtils.runtimeDir(Runner.APP_NAME.replace("-", ""))
runtimeDir = FsdUtils.runtimeDir(APP_NAME.replace("-", ""))
.resolve(vm.name);
runtimeDir.toFile().mkdir();
swtpmSocket = runtimeDir.resolve("swtpm-sock");
Expand All @@ -308,8 +309,8 @@ private boolean checkRuntimeDir() {
private boolean checkDataDir() {
// Data directory
if (dataDir == null) {
dataDir = FsdUtils.dataHome(Runner.APP_NAME.replace("-", ""))
.resolve(vm.name);
dataDir
= FsdUtils.dataHome(APP_NAME.replace("-", "")).resolve(vm.name);
}
if (!Files.exists(dataDir)) {
dataDir.toFile().mkdirs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import static org.jdrupes.vmoperator.common.Constants.APP_NAME;
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCont;
import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand;
import org.jdrupes.vmoperator.runner.qemu.events.QmpConfigured;
Expand Down Expand Up @@ -178,8 +179,6 @@
"PMD.DataflowAnomalyAnalysis" })
public class Runner extends Component {

/** The Constant APP_NAME. */
public static final String APP_NAME = "vm-runner";
private static final String TEMPLATE_DIR
= "/opt/" + APP_NAME.replace("-", "") + "/templates";
private static final String DEFAULT_TEMPLATE
Expand Down Expand Up @@ -609,7 +608,7 @@ private void shutdown() {
static {
try {
InputStream props;
var path = FsdUtils.findConfigFile(Runner.APP_NAME.replace("-", ""),
var path = FsdUtils.findConfigFile(APP_NAME.replace("-", ""),
"logging.properties");
if (path.isPresent()) {
props = Files.newInputStream(path.get());
Expand Down

0 comments on commit e0c3237

Please sign in to comment.