...
This commit is contained in:
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&ERPNext {
|
||||
data := r.hget('context:erpnext', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('ERPNext with name: ${args.name} does not exist, prob bug.')
|
||||
return error('ERPNext with name: erpnext does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(ERPNext, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&ERPNext {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("ERPNext with name '${args.name}' does not exist")
|
||||
return error("ERPNext with name 'erpnext' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return erpnext_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for erpnext with name:${args.name}')
|
||||
return error('could not get config for erpnext with name:erpnext')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&GiteaClient {
|
||||
data := r.hget('context:giteaclient', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('GiteaClient with name: ${args.name} does not exist, prob bug.')
|
||||
return error('GiteaClient with name: giteaclient does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(GiteaClient, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&GiteaClient {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("GiteaClient with name '${args.name}' does not exist")
|
||||
return error("GiteaClient with name 'giteaclient' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return giteaclient_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for giteaclient with name:${args.name}')
|
||||
return error('could not get config for giteaclient with name:giteaclient')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&IPApi {
|
||||
data := r.hget('context:ipapi', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('IPApi with name: ${args.name} does not exist, prob bug.')
|
||||
return error('IPApi with name: ipapi does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(IPApi, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&IPApi {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("IPApi with name '${args.name}' does not exist")
|
||||
return error("IPApi with name 'ipapi' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return ipapi_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for ipapi with name:${args.name}')
|
||||
return error('could not get config for ipapi with name:ipapi')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&Jina {
|
||||
data := r.hget('context:jina', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('Jina with name: ${args.name} does not exist, prob bug.')
|
||||
return error('Jina with name: jina does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(Jina, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&Jina {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("Jina with name '${args.name}' does not exist")
|
||||
return error("Jina with name 'jina' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return jina_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for jina with name:${args.name}')
|
||||
return error('could not get config for jina with name:jina')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&MailClient {
|
||||
data := r.hget('context:mailclient', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('MailClient with name: ${args.name} does not exist, prob bug.')
|
||||
return error('MailClient with name: mailclient does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(MailClient, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&MailClient {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("MailClient with name '${args.name}' does not exist")
|
||||
return error("MailClient with name 'mailclient' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return mailclient_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for mailclient with name:${args.name}')
|
||||
return error('could not get config for mailclient with name:mailclient')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&MeilisearchClient {
|
||||
data := r.hget('context:meilisearch', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('MeilisearchClient with name: ${args.name} does not exist, prob bug.')
|
||||
return error('MeilisearchClient with name: meilisearch does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(MeilisearchClient, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&MeilisearchClient {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("MeilisearchClient with name '${args.name}' does not exist")
|
||||
return error("MeilisearchClient with name 'meilisearch' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return meilisearch_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for meilisearch with name:${args.name}')
|
||||
return error('could not get config for meilisearch with name:meilisearch')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&Mycelium {
|
||||
data := r.hget('context:mycelium', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('Mycelium with name: ${args.name} does not exist, prob bug.')
|
||||
return error('Mycelium with name: mycelium does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(Mycelium, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&Mycelium {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("Mycelium with name '${args.name}' does not exist")
|
||||
return error("Mycelium with name 'mycelium' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return mycelium_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for mycelium with name:${args.name}')
|
||||
return error('could not get config for mycelium with name:mycelium')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&MyceliumRPC {
|
||||
data := r.hget('context:mycelium_rpc', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('MyceliumRPC with name: ${args.name} does not exist, prob bug.')
|
||||
return error('MyceliumRPC with name: mycelium_rpc does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(MyceliumRPC, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&MyceliumRPC {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("MyceliumRPC with name '${args.name}' does not exist")
|
||||
return error("MyceliumRPC with name 'mycelium_rpc' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return mycelium_rpc_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for mycelium_rpc with name:${args.name}')
|
||||
return error('could not get config for mycelium_rpc with name:mycelium_rpc')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&OpenAI {
|
||||
data := r.hget('context:openai', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('OpenAI with name: ${args.name} does not exist, prob bug.')
|
||||
return error('OpenAI with name: openai does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(OpenAI, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&OpenAI {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("OpenAI with name '${args.name}' does not exist")
|
||||
return error("OpenAI with name 'openai' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return openai_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for openai with name:${args.name}')
|
||||
return error('could not get config for openai with name:openai')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&OpenRouter {
|
||||
data := r.hget('context:openrouter', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('OpenRouter with name: ${args.name} does not exist, prob bug.')
|
||||
return error('OpenRouter with name: openrouter does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(OpenRouter, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&OpenRouter {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("OpenRouter with name '${args.name}' does not exist")
|
||||
return error("OpenRouter with name 'openrouter' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return openrouter_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for openrouter with name:${args.name}')
|
||||
return error('could not get config for openrouter with name:openrouter')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&PostgresqlClient {
|
||||
data := r.hget('context:postgresql_client', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('PostgresqlClient with name: ${args.name} does not exist, prob bug.')
|
||||
return error('PostgresqlClient with name: postgresql_client does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(PostgresqlClient, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&PostgresqlClient {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("PostgresqlClient with name '${args.name}' does not exist")
|
||||
return error("PostgresqlClient with name 'postgresql_client' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return postgresql_client_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for postgresql_client with name:${args.name}')
|
||||
return error('could not get config for postgresql_client with name:postgresql_client')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&QDrantClient {
|
||||
data := r.hget('context:qdrant', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('QDrantClient with name: ${args.name} does not exist, prob bug.')
|
||||
return error('QDrantClient with name: qdrant does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(QDrantClient, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&QDrantClient {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("QDrantClient with name '${args.name}' does not exist")
|
||||
return error("QDrantClient with name 'qdrant' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return qdrant_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for qdrant with name:${args.name}')
|
||||
return error('could not get config for qdrant with name:qdrant')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
module rclone
|
||||
|
||||
import incubaid.herolib.core.playbook
|
||||
import incubaid.herolib.core.texttools
|
||||
import os
|
||||
|
||||
const configfile = '${os.home_dir()}/.config/rclone/rclone.conf'
|
||||
|
||||
// will look for personal configuration file in ~/hero/config .
|
||||
// this file is in heroscript format and will have all required info to configure rclone
|
||||
//```
|
||||
// !!config.s3server_define
|
||||
// name:'tf_write_1'
|
||||
// description:'ThreeFold Read Write Repo 1
|
||||
// keyid:'003e2a7be6357fb0000000001'
|
||||
// keyname:'tfrw'
|
||||
// appkey:'K003UsdrYOZou2ulBHA8p4KLa/dL2n4'
|
||||
// url:''
|
||||
//```
|
||||
pub fn configure() ! {
|
||||
mut plbook := playbook.new(
|
||||
path: configfile
|
||||
// actor_filter: ['config']
|
||||
// action_filter: [
|
||||
// 's3server_define',
|
||||
// ]
|
||||
)!
|
||||
|
||||
actions := plbook.find(filter: 'config.s3server_define')!
|
||||
mut out := ''
|
||||
for action in actions {
|
||||
mut name := action.params.get_default('name', '')!
|
||||
mut descr := action.params.get_default('descr', '')!
|
||||
mut config := '
|
||||
[${name}]
|
||||
type = b2
|
||||
account = e2a7be6357fb
|
||||
hard_delete = true
|
||||
key = 003b79a6ae62cd7cb04477834a24e007e7afc601ba
|
||||
'
|
||||
config = texttools.dedent(config)
|
||||
out += '\n${config}\n'
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
# RCloneClient Module
|
||||
|
||||
This module provides a V language interface to RCloneClient, a command line program to manage files on cloud storage.
|
||||
|
||||
## Features
|
||||
|
||||
- Mount/unmount remote storage
|
||||
- Upload files and directories
|
||||
- Download files and directories
|
||||
- List remote contents
|
||||
- Configuration management through heroscript format
|
||||
|
||||
## Prerequisites
|
||||
|
||||
RCloneClient must be installed on your system. Visit <https://rclone.org/install/> for installation instructions.
|
||||
|
||||
## Usage
|
||||
|
||||
```v
|
||||
import incubaid.herolib.osal.core.rclone
|
||||
|
||||
fn main() {
|
||||
// Create a new RCloneClient instance
|
||||
mut rc := rclone.new('my_remote') or { panic(err) }
|
||||
|
||||
// Upload a directory
|
||||
rc.upload('./local_dir', 'backup/remote_dir') or { panic(err) }
|
||||
|
||||
// Download a directory
|
||||
rc.download('backup/remote_dir', './downloaded_dir') or { panic(err) }
|
||||
|
||||
// Mount a remote
|
||||
rc.mount('backup', './mounted_backup') or { panic(err) }
|
||||
|
||||
// List contents
|
||||
content := rc.list('backup') or { panic(err) }
|
||||
println(content)
|
||||
|
||||
// Unmount when done
|
||||
rc.unmount('./mounted_backup') or { panic(err) }
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Configuration is managed through heroscript format in `~/hero/config`. Example configuration:
|
||||
|
||||
```heroscript
|
||||
!!config.s3server_define
|
||||
name:'my_remote'
|
||||
description:'My Remote Storage'
|
||||
keyid:'your_key_id'
|
||||
keyname:'your_key_name'
|
||||
appkey:'your_app_key'
|
||||
url:'your_url'
|
||||
```
|
||||
|
||||
The configuration will be automatically loaded and applied when creating a new RCloneClient instance.
|
||||
|
||||
## Testing
|
||||
|
||||
To run the tests:
|
||||
|
||||
```bash
|
||||
vtest ~/code/github/incubaid/herolib/lib/osal/rclone/rclone_test.v
|
||||
```
|
||||
|
||||
Note: Some tests are commented out as they require an actual rclone configuration and remote to work with. They serve as examples of how to use the RCloneClient module.
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
!!hero_code.generate_client
|
||||
name:'rclone'
|
||||
name:'rcloneclient'
|
||||
classname:'RCloneClient'
|
||||
singleton:1
|
||||
default:1
|
||||
44
lib/clients/rcloneclient/config.v
Normal file
44
lib/clients/rcloneclient/config.v
Normal file
@@ -0,0 +1,44 @@
|
||||
module rcloneclient
|
||||
|
||||
import incubaid.herolib.core.playbook
|
||||
import incubaid.herolib.core.texttools
|
||||
import os
|
||||
|
||||
// const configfile = '${os.home_dir()}/.config/rclone/rclone.conf'
|
||||
|
||||
// // will look for personal configuration file in ~/hero/config .
|
||||
// // this file is in heroscript format and will have all required info to configure rclone
|
||||
// //```
|
||||
// // !!config.s3server_define
|
||||
// // name:'tf_write_1'
|
||||
// // description:'ThreeFold Read Write Repo 1
|
||||
// // keyid:'003e2a7be6357fb0000000001'
|
||||
// // keyname:'tfrw'
|
||||
// // appkey:'K003UsdrYOZou2ulBHA8p4KLa/dL2n4'
|
||||
// // url:''
|
||||
// //```
|
||||
// pub fn configure() ! {
|
||||
// mut plbook := playbook.new(
|
||||
// path: configfile
|
||||
// // actor_filter: ['config']
|
||||
// // action_filter: [
|
||||
// // 's3server_define',
|
||||
// // ]
|
||||
// )!
|
||||
|
||||
// actions := plbook.find(filter: 'config.s3server_define')!
|
||||
// mut out := ''
|
||||
// for action in actions {
|
||||
// mut name := action.params.get_default('name', '')!
|
||||
// mut descr := action.params.get_default('descr', '')!
|
||||
// mut config := '
|
||||
// [${name}]
|
||||
// type = b2
|
||||
// account = e2a7be6357fb
|
||||
// hard_delete = true
|
||||
// key = 003b79a6ae62cd7cb04477834a24e007e7afc601ba
|
||||
// '
|
||||
// config = texttools.dedent(config)
|
||||
// out += '\n${config}\n'
|
||||
// }
|
||||
// }
|
||||
@@ -1,4 +1,4 @@
|
||||
module rclone
|
||||
module rcloneclient
|
||||
|
||||
fn test_rclone_new() {
|
||||
rclone := new('test_remote') or { panic(err) }
|
||||
@@ -1,4 +1,4 @@
|
||||
module rclone
|
||||
module rcloneclient
|
||||
|
||||
import os
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module rclone
|
||||
module rcloneclient
|
||||
|
||||
import incubaid.herolib.core.base
|
||||
import incubaid.herolib.core.playbook { PlayBook }
|
||||
@@ -6,8 +6,8 @@ import incubaid.herolib.ui.console
|
||||
import json
|
||||
|
||||
__global (
|
||||
rclone_global map[string]&RCloneClient
|
||||
rclone_default string
|
||||
rcloneclient_global map[string]&RCloneClient
|
||||
rcloneclient_default string
|
||||
)
|
||||
|
||||
/////////FACTORY
|
||||
@@ -30,14 +30,14 @@ pub fn new(args ArgsGet) !&RCloneClient {
|
||||
|
||||
pub fn get(args ArgsGet) !&RCloneClient {
|
||||
mut context := base.context()!
|
||||
rclone_default = args.name
|
||||
if args.fromdb || args.name !in rclone_global {
|
||||
rcloneclient_default = args.name
|
||||
if args.fromdb || args.name !in rcloneclient_global {
|
||||
mut r := context.redis()!
|
||||
if r.hexists('context:rclone', args.name)! {
|
||||
data := r.hget('context:rclone', args.name)!
|
||||
if r.hexists('context:rcloneclient', args.name)! {
|
||||
data := r.hget('context:rcloneclient', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('RCloneClient with name: ${args.name} does not exist, prob bug.')
|
||||
return error('RCloneClient with name: rcloneclient does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(RCloneClient, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,37 +46,37 @@ pub fn get(args ArgsGet) !&RCloneClient {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("RCloneClient with name '${args.name}' does not exist")
|
||||
return error("RCloneClient with name 'rcloneclient' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return rclone_global[args.name] or {
|
||||
return rcloneclient_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for rclone with name:${args.name}')
|
||||
return error('could not get config for rcloneclient with name:rcloneclient')
|
||||
}
|
||||
}
|
||||
|
||||
// register the config for the future
|
||||
pub fn set(o RCloneClient) ! {
|
||||
mut o2 := set_in_mem(o)!
|
||||
rclone_default = o2.name
|
||||
rcloneclient_default = o2.name
|
||||
mut context := base.context()!
|
||||
mut r := context.redis()!
|
||||
r.hset('context:rclone', o2.name, json.encode(o2))!
|
||||
r.hset('context:rcloneclient', o2.name, json.encode(o2))!
|
||||
}
|
||||
|
||||
// does the config exists?
|
||||
pub fn exists(args ArgsGet) !bool {
|
||||
mut context := base.context()!
|
||||
mut r := context.redis()!
|
||||
return r.hexists('context:rclone', args.name)!
|
||||
return r.hexists('context:rcloneclient', args.name)!
|
||||
}
|
||||
|
||||
pub fn delete(args ArgsGet) ! {
|
||||
mut context := base.context()!
|
||||
mut r := context.redis()!
|
||||
r.hdel('context:rclone', args.name)!
|
||||
r.hdel('context:rcloneclient', args.name)!
|
||||
}
|
||||
|
||||
@[params]
|
||||
@@ -91,12 +91,12 @@ pub fn list(args ArgsList) ![]&RCloneClient {
|
||||
mut context := base.context()!
|
||||
if args.fromdb {
|
||||
// reset what is in mem
|
||||
rclone_global = map[string]&RCloneClient{}
|
||||
rclone_default = ''
|
||||
rcloneclient_global = map[string]&RCloneClient{}
|
||||
rcloneclient_default = ''
|
||||
}
|
||||
if args.fromdb {
|
||||
mut r := context.redis()!
|
||||
mut l := r.hkeys('context:rclone')!
|
||||
mut l := r.hkeys('context:rcloneclient')!
|
||||
|
||||
for name in l {
|
||||
res << get(name: name, fromdb: true)!
|
||||
@@ -104,7 +104,7 @@ pub fn list(args ArgsList) ![]&RCloneClient {
|
||||
return res
|
||||
} else {
|
||||
// load from memory
|
||||
for _, client in rclone_global {
|
||||
for _, client in rcloneclient_global {
|
||||
res << client
|
||||
}
|
||||
}
|
||||
@@ -114,16 +114,16 @@ pub fn list(args ArgsList) ![]&RCloneClient {
|
||||
// only sets in mem, does not set as config
|
||||
fn set_in_mem(o RCloneClient) !RCloneClient {
|
||||
mut o2 := obj_init(o)!
|
||||
rclone_global[o2.name] = &o2
|
||||
rclone_default = o2.name
|
||||
rcloneclient_global[o2.name] = &o2
|
||||
rcloneclient_default = o2.name
|
||||
return o2
|
||||
}
|
||||
|
||||
pub fn play(mut plbook PlayBook) ! {
|
||||
if !plbook.exists(filter: 'rclone.') {
|
||||
if !plbook.exists(filter: 'rcloneclient.') {
|
||||
return
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'rclone.configure')!
|
||||
mut install_actions := plbook.find(filter: 'rcloneclient.configure')!
|
||||
if install_actions.len > 0 {
|
||||
for mut install_action in install_actions {
|
||||
heroscript := install_action.heroscript()
|
||||
@@ -134,6 +134,6 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
}
|
||||
|
||||
// switch instance to be used for rclone
|
||||
// switch instance to be used for rcloneclient
|
||||
pub fn switch(name string) {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
module rclone
|
||||
module rcloneclient
|
||||
|
||||
import incubaid.herolib.data.paramsparser
|
||||
import incubaid.herolib.data.encoderhero
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&RunPod {
|
||||
data := r.hget('context:runpod', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('RunPod with name: ${args.name} does not exist, prob bug.')
|
||||
return error('RunPod with name: runpod does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(RunPod, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&RunPod {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("RunPod with name '${args.name}' does not exist")
|
||||
return error("RunPod with name 'runpod' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return runpod_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for runpod with name:${args.name}')
|
||||
return error('could not get config for runpod with name:runpod')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&SendGrid {
|
||||
data := r.hget('context:sendgrid', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('SendGrid with name: ${args.name} does not exist, prob bug.')
|
||||
return error('SendGrid with name: sendgrid does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(SendGrid, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&SendGrid {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("SendGrid with name '${args.name}' does not exist")
|
||||
return error("SendGrid with name 'sendgrid' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return sendgrid_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for sendgrid with name:${args.name}')
|
||||
return error('could not get config for sendgrid with name:sendgrid')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&VastAI {
|
||||
data := r.hget('context:vastai', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('VastAI with name: ${args.name} does not exist, prob bug.')
|
||||
return error('VastAI with name: vastai does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(VastAI, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&VastAI {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("VastAI with name '${args.name}' does not exist")
|
||||
return error("VastAI with name 'vastai' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return vastai_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for vastai with name:${args.name}')
|
||||
return error('could not get config for vastai with name:vastai')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&WireGuard {
|
||||
data := r.hget('context:wireguard', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('WireGuard with name: ${args.name} does not exist, prob bug.')
|
||||
return error('WireGuard with name: wireguard does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(WireGuard, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&WireGuard {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("WireGuard with name '${args.name}' does not exist")
|
||||
return error("WireGuard with name 'wireguard' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return wireguard_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for wireguard with name:${args.name}')
|
||||
return error('could not get config for wireguard with name:wireguard')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&ZeroDBClient {
|
||||
data := r.hget('context:zerodb_client', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('ZeroDBClient with name: ${args.name} does not exist, prob bug.')
|
||||
return error('ZeroDBClient with name: zerodb_client does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(ZeroDBClient, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&ZeroDBClient {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("ZeroDBClient with name '${args.name}' does not exist")
|
||||
return error("ZeroDBClient with name 'zerodb_client' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return zerodb_client_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for zerodb_client with name:${args.name}')
|
||||
return error('could not get config for zerodb_client with name:zerodb_client')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&ZinitRPC {
|
||||
data := r.hget('context:zinit', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('ZinitRPC with name: ${args.name} does not exist, prob bug.')
|
||||
return error('ZinitRPC with name: zinit does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(ZinitRPC, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&ZinitRPC {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("ZinitRPC with name '${args.name}' does not exist")
|
||||
return error("ZinitRPC with name 'zinit' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return zinit_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for zinit with name:${args.name}')
|
||||
return error('could not get config for zinit with name:zinit')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import incubaid.herolib.clients.openai
|
||||
import incubaid.herolib.clients.openrouter
|
||||
import incubaid.herolib.clients.postgresql_client
|
||||
import incubaid.herolib.clients.qdrant
|
||||
import incubaid.herolib.clients.rclone
|
||||
import incubaid.herolib.clients.rcloneclient
|
||||
import incubaid.herolib.clients.runpod
|
||||
import incubaid.herolib.clients.sendgrid
|
||||
import incubaid.herolib.clients.vastai
|
||||
@@ -69,7 +69,7 @@ pub fn run_all(args_ PlayArgs) ! {
|
||||
openrouter.play(mut plbook)!
|
||||
postgresql_client.play(mut plbook)!
|
||||
qdrant.play(mut plbook)!
|
||||
rclone.play(mut plbook)!
|
||||
rcloneclient.play(mut plbook)!
|
||||
runpod.play(mut plbook)!
|
||||
sendgrid.play(mut plbook)!
|
||||
vastai.play(mut plbook)!
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&Workspace {
|
||||
data := r.hget('context:heroprompt', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('Workspace with name: ${args.name} does not exist, prob bug.')
|
||||
return error('Workspace with name: heroprompt does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(Workspace, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&Workspace {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("Workspace with name '${args.name}' does not exist")
|
||||
return error("Workspace with name 'heroprompt' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return heroprompt_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for heroprompt with name:${args.name}')
|
||||
return error('could not get config for heroprompt with name:heroprompt')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&CometBFT {
|
||||
data := r.hget('context:cometbft', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('CometBFT with name: ${args.name} does not exist, prob bug.')
|
||||
return error('CometBFT with name: cometbft does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(CometBFT, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&CometBFT {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("CometBFT with name '${args.name}' does not exist")
|
||||
return error("CometBFT with name 'cometbft' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return cometbft_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for cometbft with name:${args.name}')
|
||||
return error('could not get config for cometbft with name:cometbft')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&MeilisearchInstaller {
|
||||
data := r.hget('context:meilisearch_installer', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('MeilisearchInstaller with name: ${args.name} does not exist, prob bug.')
|
||||
return error('MeilisearchInstaller with name: meilisearch_installer does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(MeilisearchInstaller, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&MeilisearchInstaller {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("MeilisearchInstaller with name '${args.name}' does not exist")
|
||||
return error("MeilisearchInstaller with name 'meilisearch_installer' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return meilisearch_installer_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for meilisearch_installer with name:${args.name}')
|
||||
return error('could not get config for meilisearch_installer with name:meilisearch_installer')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&Postgresql {
|
||||
data := r.hget('context:postgresql', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('Postgresql with name: ${args.name} does not exist, prob bug.')
|
||||
return error('Postgresql with name: postgresql does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(Postgresql, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&Postgresql {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("Postgresql with name '${args.name}' does not exist")
|
||||
return error("Postgresql with name 'postgresql' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return postgresql_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for postgresql with name:${args.name}')
|
||||
return error('could not get config for postgresql with name:postgresql')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&QDrant {
|
||||
data := r.hget('context:qdrant_installer', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('QDrant with name: ${args.name} does not exist, prob bug.')
|
||||
return error('QDrant with name: qdrant_installer does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(QDrant, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&QDrant {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("QDrant with name '${args.name}' does not exist")
|
||||
return error("QDrant with name 'qdrant_installer' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return qdrant_installer_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for qdrant_installer with name:${args.name}')
|
||||
return error('could not get config for qdrant_installer with name:qdrant_installer')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&ZeroDB {
|
||||
data := r.hget('context:zerodb', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('ZeroDB with name: ${args.name} does not exist, prob bug.')
|
||||
return error('ZeroDB with name: zerodb does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(ZeroDB, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&ZeroDB {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("ZeroDB with name '${args.name}' does not exist")
|
||||
return error("ZeroDB with name 'zerodb' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return zerodb_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for zerodb with name:${args.name}')
|
||||
return error('could not get config for zerodb with name:zerodb')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&CoreDNS {
|
||||
data := r.hget('context:coredns', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('CoreDNS with name: ${args.name} does not exist, prob bug.')
|
||||
return error('CoreDNS with name: coredns does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(CoreDNS, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&CoreDNS {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("CoreDNS with name '${args.name}' does not exist")
|
||||
return error("CoreDNS with name 'coredns' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return coredns_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for coredns with name:${args.name}')
|
||||
return error('could not get config for coredns with name:coredns')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&GiteaServer {
|
||||
data := r.hget('context:gitea', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('GiteaServer with name: ${args.name} does not exist, prob bug.')
|
||||
return error('GiteaServer with name: gitea does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(GiteaServer, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&GiteaServer {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("GiteaServer with name '${args.name}' does not exist")
|
||||
return error("GiteaServer with name 'gitea' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return gitea_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for gitea with name:${args.name}')
|
||||
return error('could not get config for gitea with name:gitea')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&LivekitServer {
|
||||
data := r.hget('context:livekit', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('LivekitServer with name: ${args.name} does not exist, prob bug.')
|
||||
return error('LivekitServer with name: livekit does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(LivekitServer, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&LivekitServer {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("LivekitServer with name '${args.name}' does not exist")
|
||||
return error("LivekitServer with name 'livekit' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return livekit_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for livekit with name:${args.name}')
|
||||
return error('could not get config for livekit with name:livekit')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'zinit_installer.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure zinit_installer:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure zinit_installer, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'zinit_installer.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'golang.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure golang:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure golang, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'golang.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'nodejs.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure nodejs:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure nodejs, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'nodejs.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'python.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure python:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure python, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'python.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'rust.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure rust:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure rust, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'rust.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&MyceliumInstaller {
|
||||
data := r.hget('context:mycelium_installer', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('MyceliumInstaller with name: ${args.name} does not exist, prob bug.')
|
||||
return error('MyceliumInstaller with name: mycelium_installer does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(MyceliumInstaller, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&MyceliumInstaller {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("MyceliumInstaller with name '${args.name}' does not exist")
|
||||
return error("MyceliumInstaller with name 'mycelium_installer' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return mycelium_installer_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for mycelium_installer with name:${args.name}')
|
||||
return error('could not get config for mycelium_installer with name:mycelium_installer')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'wireguard_installer.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure wireguard_installer:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure wireguard_installer, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'wireguard_installer.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -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:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure actrunner, 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:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure b2, 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:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure fungistor, 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: ${args.name} does not exist, prob bug.')
|
||||
return error('GarageS3 with name: garage_s3 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 '${args.name}' does not exist")
|
||||
return error("GarageS3 with name 'garage_s3' 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:${args.name}')
|
||||
return error('could not get config for garage_s3 with name:garage_s3')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure grafana, 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:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure prometheus, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'prometheus.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -38,7 +38,7 @@ pub fn get(args ArgsGet) !&RClone {
|
||||
data := r.hget('context:rclone', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('RClone with name: ${args.name} does not exist, prob bug.')
|
||||
return error('RClone with name: rclone does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(RClone, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -47,14 +47,14 @@ pub fn get(args ArgsGet) !&RClone {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("RClone with name '${args.name}' does not exist")
|
||||
return error("RClone with name 'rclone' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return rclone_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for rclone with name:${args.name}')
|
||||
return error('could not get config for rclone with name:rclone')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure restic, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'restic.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'griddriver.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure griddriver:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure griddriver, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'griddriver.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'cloudhypervisor.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure cloudhypervisor:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure cloudhypervisor, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'cloudhypervisor.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'docker.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure docker:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure docker, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'docker.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'herorunner.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure herorunner:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure herorunner, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'herorunner.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&LimaInstaller {
|
||||
data := r.hget('context:lima', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('LimaInstaller with name: ${args.name} does not exist, prob bug.')
|
||||
return error('LimaInstaller with name: lima does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(LimaInstaller, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&LimaInstaller {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("LimaInstaller with name '${args.name}' does not exist")
|
||||
return error("LimaInstaller with name 'lima' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return lima_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for lima with name:${args.name}')
|
||||
return error('could not get config for lima with name:lima')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'pacman.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure pacman:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure pacman, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'pacman.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'podman.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure podman:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure podman, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'podman.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'youki.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure youki:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure youki, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'youki.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'bun.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure bun:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure bun, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'bun.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'lighttpd.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure lighttpd:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure lighttpd, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'lighttpd.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'tailwind.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure tailwind:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure tailwind, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'tailwind.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'tailwind4.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure tailwind4:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure tailwind4, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'tailwind4.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&TraefikServer {
|
||||
data := r.hget('context:traefik', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('TraefikServer with name: ${args.name} does not exist, prob bug.')
|
||||
return error('TraefikServer with name: traefik does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(TraefikServer, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&TraefikServer {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("TraefikServer with name '${args.name}' does not exist")
|
||||
return error("TraefikServer with name 'traefik' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return traefik_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for traefik with name:${args.name}')
|
||||
return error('could not get config for traefik with name:traefik')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
}
|
||||
mut install_actions := plbook.find(filter: 'zola.configure')!
|
||||
if install_actions.len > 0 {
|
||||
return error("can't configure zola:${args.name}, because no configuration allowed for this installer.")
|
||||
return error("can't configure zola, because no configuration allowed for this installer.")
|
||||
}
|
||||
mut other_actions := plbook.find(filter: 'zola.')!
|
||||
for mut other_action in other_actions {
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&TFGridDeployer {
|
||||
data := r.hget('context:deployer', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('TFGridDeployer with name: ${args.name} does not exist, prob bug.')
|
||||
return error('TFGridDeployer with name: deployer does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(TFGridDeployer, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&TFGridDeployer {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("TFGridDeployer with name '${args.name}' does not exist")
|
||||
return error("TFGridDeployer with name 'deployer' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return deployer_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for deployer with name:${args.name}')
|
||||
return error('could not get config for deployer with name:deployer')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn get(args ArgsGet) !&HetznerManager {
|
||||
data := r.hget('context:hetznermanager', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('HetznerManager with name: ${args.name} does not exist, prob bug.')
|
||||
return error('HetznerManager with name: hetznermanager does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(HetznerManager, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -46,14 +46,14 @@ pub fn get(args ArgsGet) !&HetznerManager {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("HetznerManager with name '${args.name}' does not exist")
|
||||
return error("HetznerManager with name 'hetznermanager' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return hetznermanager_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for hetznermanager with name:${args.name}')
|
||||
return error('could not get config for hetznermanager with name:hetznermanager')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn get(args ArgsGet) !&KubeClient {
|
||||
data := r.hget('context:kubernetes', args.name)!
|
||||
if data.len == 0 {
|
||||
print_backtrace()
|
||||
return error('KubeClient with name: ${args.name} does not exist, prob bug.')
|
||||
return error('KubeClient with name: kubernetes does not exist, prob bug.')
|
||||
}
|
||||
mut obj := json.decode(KubeClient, data)!
|
||||
set_in_mem(obj)!
|
||||
@@ -48,14 +48,14 @@ pub fn get(args ArgsGet) !&KubeClient {
|
||||
new(args)!
|
||||
} else {
|
||||
print_backtrace()
|
||||
return error("KubeClient with name '${args.name}' does not exist")
|
||||
return error("KubeClient with name 'kubernetes' does not exist")
|
||||
}
|
||||
}
|
||||
return get(name: args.name)! // no longer from db nor create
|
||||
}
|
||||
return kubernetes_global[args.name] or {
|
||||
print_backtrace()
|
||||
return error('could not get config for kubernetes with name:${args.name}')
|
||||
return error('could not get config for kubernetes with name:kubernetes')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user