...
This commit is contained in:
@@ -33,7 +33,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'actrunner.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure actrunner, because no configuration allowed for this installer.")
|
||||
return error("can't configure actrunner:${args.name}, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'actrunner.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'b2.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure b2, because no configuration allowed for this installer.")
|
||||
return error("can't configure b2:${args.name}, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'b2.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'fungistor.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure fungistor, because no configuration allowed for this installer.")
|
||||
return error("can't configure fungistor:${args.name}, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'fungistor.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&GarageS3 {
|
||||
data := r.hget('context:garage_s3', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('GarageS3 with name: garage_s3 does not exist, prob bug.')
|
||||
return error('GarageS3 with name: ${args.name} does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(GarageS3, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&GarageS3 {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("GarageS3 with name 'garage_s3' does not exist")
|
||||
return error("GarageS3 with name '${args.name}' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return garage_s3_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for garage_s3 with name:garage_s3')
|
||||
return error('could not get config for garage_s3 with name:${args.name}')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'grafana.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure grafana, because no configuration allowed for this installer.")
|
||||
return error("can't configure grafana:${args.name}, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'grafana.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'prometheus.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure prometheus, because no configuration allowed for this installer.")
|
||||
return error("can't configure prometheus:${args.name}, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'prometheus.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -4,10 +4,11 @@ import incubaid.herolib.core.base
|
||||
import incubaid.herolib.core.playbook { PlayBook }
|
||||
import incubaid.herolib.ui.console
|
||||
import json
|
||||
import incubaid.herolib.osal.startupmanager
|
||||
|
||||
__global (
|
||||
rclone_installer_global map[string]&RClone
|
||||
rclone_installer_default string
|
||||
rclone_global map[string]&RClone
|
||||
rclone_default string
|
||||
)
|
||||
|
||||
/////////FACTORY
|
||||
@@ -30,14 +31,14 @@ pub fn new(args ArgsGet) !&RClone {
|
||||
|
||||
pub fn get(args ArgsGet) !&RClone {
|
||||
mut context := base.context()!
|
||||
rclone_installer_default = args.name
|
||||
if args.fromdb || args.name !in rclone_installer_global {
|
||||
rclone_default = args.name
|
||||
if args.fromdb || args.name !in rclone_global {
|
||||
mut r := context.redis()!
|
||||
if r.hexists('context:rclone', args.name)! {
|
||||
data := r.hget('context:rclone', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('RClone with name: rclone does not exist, prob bug.')
|
||||
return error('RClone with name: ${args.name} does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(RClone, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,21 +47,21 @@ pub fn get(args ArgsGet) !&RClone {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("RClone with name 'rclone' does not exist")
|
||||
return error("RClone with name '${args.name}' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return rclone_installer_global[args.name] or {
|
||||
return rclone_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for rclone with name:rclone')
|
||||
return error('could not get config for rclone with name:${args.name}')
|
||||
}
|
||||
}
|
||||
|
||||
// register the config for the future
|
||||
pub fn set(o RClone) ! {
|
||||
mut o2 := set_in_mem(o)!
|
||||
rclone_installer_default = o2.name
|
||||
rclone_default = o2.name
|
||||
mut context := base.context()!
|
||||
mut r := context.redis()!
|
||||
r.hset('context:rclone', o2.name, json.encode(o2))!
|
||||
@@ -91,8 +92,8 @@ pub fn list(args ArgsList) ![]&RClone {
|
||||
mut context := base.context()!
|
||||
if args.fromdb {
|
||||
// reset what is in mem
|
||||
rclone_installer_global = map[string]&RClone{}
|
||||
rclone_installer_default = ''
|
||||
rclone_global = map[string]&RClone{}
|
||||
rclone_default = ''
|
||||
}
|
||||
if args.fromdb {
|
||||
mut r := context.redis()!
|
||||
@@ -104,7 +105,7 @@ pub fn list(args ArgsList) ![]&RClone {
|
||||
return res
|
||||
} else {
|
||||
// load from memory
|
||||
for _, client in rclone_installer_global {
|
||||
for _, client in rclone_global {
|
||||
res << client
|
||||
}
|
||||
}
|
||||
@@ -114,8 +115,8 @@ pub fn list(args ArgsList) ![]&RClone {
|
||||
// only sets in mem, does not set as config
|
||||
fn set_in_mem(o RClone) !RClone {
|
||||
mut o2 := obj_init(o)!
|
||||
rclone_installer_global[o2.name] = &o2
|
||||
rclone_installer_default = o2.name
|
||||
rclone_global[o2.name] = &o2
|
||||
rclone_default = o2.name
|
||||
return o2
|
||||
}
|
||||
|
||||
@@ -180,5 +181,5 @@ pub fn (mut self RClone) destroy() ! {
|
||||
|
||||
// switch instance to be used for rclone
|
||||
pub fn switch(name string) {
|
||||
rclone_installer_default = name
|
||||
rclone_default = name
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'restic.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure restic, because no configuration allowed for this installer.")
|
||||
return error("can't configure restic:${args.name}, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'restic.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
Reference in New Issue
Block a user