Use dash in k8s context, but not for directories.
This commit is contained in:
parent
ce07e43529
commit
7113aad8eb
2 changed files with 9 additions and 7 deletions
|
|
@ -337,7 +337,7 @@ public class Configuration implements Dto {
|
||||||
private boolean checkRuntimeDir() {
|
private boolean checkRuntimeDir() {
|
||||||
// Runtime directory (sockets etc.)
|
// Runtime directory (sockets etc.)
|
||||||
if (runtimeDir == null) {
|
if (runtimeDir == null) {
|
||||||
var appDir = FsdUtils.runtimeDir(Runner.APP_NAME);
|
var appDir = FsdUtils.runtimeDir(Runner.APP_NAME.replace("-", ""));
|
||||||
if (!Files.exists(appDir) && appDir.toFile().mkdirs()) {
|
if (!Files.exists(appDir) && appDir.toFile().mkdirs()) {
|
||||||
try {
|
try {
|
||||||
// When appDir is derived from XDG_RUNTIME_DIR
|
// When appDir is derived from XDG_RUNTIME_DIR
|
||||||
|
|
@ -353,7 +353,8 @@ public class Configuration implements Dto {
|
||||||
runtimeDir));
|
runtimeDir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
runtimeDir = FsdUtils.runtimeDir(Runner.APP_NAME).resolve(vm.name);
|
runtimeDir = FsdUtils.runtimeDir(Runner.APP_NAME.replace("-", ""))
|
||||||
|
.resolve(vm.name);
|
||||||
runtimeDir.toFile().mkdir();
|
runtimeDir.toFile().mkdir();
|
||||||
swtpmSocket = runtimeDir.resolve("swtpm-sock");
|
swtpmSocket = runtimeDir.resolve("swtpm-sock");
|
||||||
monitorSocket = runtimeDir.resolve("monitor.sock");
|
monitorSocket = runtimeDir.resolve("monitor.sock");
|
||||||
|
|
@ -372,7 +373,8 @@ public class Configuration implements Dto {
|
||||||
private boolean checkDataDir() {
|
private boolean checkDataDir() {
|
||||||
// Data directory
|
// Data directory
|
||||||
if (dataDir == null) {
|
if (dataDir == null) {
|
||||||
dataDir = FsdUtils.dataHome(Runner.APP_NAME).resolve(vm.name);
|
dataDir = FsdUtils.dataHome(Runner.APP_NAME.replace("-", ""))
|
||||||
|
.resolve(vm.name);
|
||||||
}
|
}
|
||||||
if (!Files.exists(dataDir)) {
|
if (!Files.exists(dataDir)) {
|
||||||
dataDir.toFile().mkdirs();
|
dataDir.toFile().mkdirs();
|
||||||
|
|
|
||||||
|
|
@ -160,9 +160,9 @@ import org.jgrapes.util.events.WatchFile;
|
||||||
public class Runner extends Component {
|
public class Runner extends Component {
|
||||||
|
|
||||||
/** The Constant APP_NAME. */
|
/** The Constant APP_NAME. */
|
||||||
public static final String APP_NAME = "vmrunner";
|
public static final String APP_NAME = "vm-runner";
|
||||||
private static final String TEMPLATE_DIR
|
private static final String TEMPLATE_DIR
|
||||||
= "/opt/" + APP_NAME + "/templates";
|
= "/opt/" + APP_NAME.replace("-", "") + "/templates";
|
||||||
private static final String DEFAULT_TEMPLATE
|
private static final String DEFAULT_TEMPLATE
|
||||||
= "Standard-VM-latest.ftl.yaml";
|
= "Standard-VM-latest.ftl.yaml";
|
||||||
private static final String SAVED_TEMPLATE = "VM.ftl.yaml";
|
private static final String SAVED_TEMPLATE = "VM.ftl.yaml";
|
||||||
|
|
@ -214,7 +214,7 @@ public class Runner extends Component {
|
||||||
|
|
||||||
// Configuration store with file in /etc/opt (default)
|
// Configuration store with file in /etc/opt (default)
|
||||||
File config = new File(cmdLine.getOptionValue('c',
|
File config = new File(cmdLine.getOptionValue('c',
|
||||||
"/etc/opt/" + APP_NAME + "/config.yaml"));
|
"/etc/opt/" + APP_NAME.replace("-", "") + "/config.yaml"));
|
||||||
// Don't rely on night config to produce a good exception
|
// Don't rely on night config to produce a good exception
|
||||||
// for this simple case
|
// for this simple case
|
||||||
if (!Files.isReadable(config.toPath())) {
|
if (!Files.isReadable(config.toPath())) {
|
||||||
|
|
@ -552,7 +552,7 @@ public class Runner extends Component {
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
InputStream props;
|
InputStream props;
|
||||||
var path = FsdUtils.findConfigFile(Runner.APP_NAME,
|
var path = FsdUtils.findConfigFile(Runner.APP_NAME.replace("-", ""),
|
||||||
"logging.properties");
|
"logging.properties");
|
||||||
if (path.isPresent()) {
|
if (path.isPresent()) {
|
||||||
props = Files.newInputStream(path.get());
|
props = Files.newInputStream(path.get());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue