fixing startupcmd
This commit is contained in:
@@ -20,6 +20,7 @@ import incubaid.herolib.installers.horus.herorunner
|
||||
import incubaid.herolib.installers.horus.osirisrunner
|
||||
import incubaid.herolib.installers.horus.salrunner
|
||||
import incubaid.herolib.installers.virt.podman
|
||||
import incubaid.herolib.installers.virt.kubernetes_installer
|
||||
import incubaid.herolib.installers.infra.gitea
|
||||
import incubaid.herolib.builder
|
||||
|
||||
@@ -80,6 +81,7 @@ pub fn run(args_ PlayArgs) ! {
|
||||
herolib.play(mut plbook)!
|
||||
vlang.play(mut plbook)!
|
||||
podman.play(mut plbook)!
|
||||
kubernetes_installer.play(mut plbook)!
|
||||
gitea.play(mut plbook)!
|
||||
|
||||
giteaclient.play(mut plbook)!
|
||||
|
||||
@@ -54,6 +54,7 @@ fn (self &KubernetesInstaller) startupcmd() ![]startupmanager.ZProcessNewArgs {
|
||||
|
||||
res << startupmanager.ZProcessNewArgs{
|
||||
name: 'k3s_${self.name}'
|
||||
startuptype: .systemd
|
||||
cmd: cmd
|
||||
env: {
|
||||
'HOME': os.home_dir()
|
||||
@@ -89,11 +90,10 @@ fn check_ubuntu() ! {
|
||||
}
|
||||
|
||||
// Check /etc/os-release for Ubuntu
|
||||
mut os_release := pathlib.get_file(path: '/etc/os-release') or {
|
||||
content := os.read_file('/etc/os-release') or {
|
||||
return error('Could not read /etc/os-release. Is this Ubuntu?')
|
||||
}
|
||||
|
||||
content := os_release.read()!
|
||||
|
||||
if !content.contains('Ubuntu') && !content.contains('ubuntu') {
|
||||
return error('This installer requires Ubuntu. Current OS is not Ubuntu.')
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import incubaid.herolib.core.playbook { PlayBook }
|
||||
import incubaid.herolib.ui.console
|
||||
import json
|
||||
import incubaid.herolib.osal.startupmanager
|
||||
import incubaid.herolib.osal.core as osal
|
||||
import time
|
||||
|
||||
__global (
|
||||
@@ -238,7 +239,12 @@ pub fn (mut self KubernetesInstaller) start() ! {
|
||||
return error('K3s is not installed. Please run install_master, join_master, or install_worker first.')
|
||||
}
|
||||
|
||||
configure()!
|
||||
// Ensure data directory exists
|
||||
osal.dir_ensure(self.data_dir)!
|
||||
|
||||
// Create manifests directory for auto-apply
|
||||
manifests_dir := '${self.data_dir}/server/manifests'
|
||||
osal.dir_ensure(manifests_dir)!
|
||||
|
||||
for zprocess in self.startupcmd()! {
|
||||
mut sm := startupmanager_get(zprocess.startuptype)!
|
||||
|
||||
@@ -37,7 +37,7 @@ pub mut:
|
||||
// your checking & initialization code if needed
|
||||
fn obj_init(mycfg_ KubernetesInstaller) !KubernetesInstaller {
|
||||
mut mycfg := mycfg_
|
||||
|
||||
|
||||
// Set default data directory if not provided
|
||||
if mycfg.data_dir == '' {
|
||||
mycfg.data_dir = os.join_path(os.home_dir(), 'hero/var/k3s')
|
||||
@@ -60,10 +60,8 @@ fn obj_init(mycfg_ KubernetesInstaller) !KubernetesInstaller {
|
||||
mycfg.token = rand.hex(32)
|
||||
}
|
||||
|
||||
// Validate: join operations require token and master_url
|
||||
if !mycfg.is_first_master && (mycfg.token == '' || mycfg.master_url == '') {
|
||||
return error('Joining a cluster requires both token and master_url to be set')
|
||||
}
|
||||
// Note: Validation of token/master_url is done in the specific action functions
|
||||
// (join_master, install_worker) where the context is clear
|
||||
|
||||
return mycfg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user