diff --git a/cli/hero.v b/cli/hero.v index 2b7a0c00..22bad431 100644 --- a/cli/hero.v +++ b/cli/hero.v @@ -38,7 +38,7 @@ fn do() ! { if os.args.len == 2 { mypath := os.args[1] - if mypath.to_lower().ends_with('.hero') { + if mypath.to_lower().ends_with('.hero') || mypath.to_lower().ends_with('.heroscript') || mypath.to_lower().ends_with('.hs') { // hero was called from a file playcmds_do(mypath)! return @@ -94,7 +94,7 @@ fn do() ! { fn main() { do() or { - $dbg; + // $dbg; eprintln('Error: ${err}') print_backtrace() exit(1) diff --git a/examples/virt/hetzner/hetzner_example.hero b/examples/virt/hetzner/hetzner_example.hero new file mode 100755 index 00000000..cab8bd1a --- /dev/null +++ b/examples/virt/hetzner/hetzner_example.hero @@ -0,0 +1,34 @@ +#!/usr/bin/env hero + + +// !!hetznermanager.configure +// name:"main" +// user:"krist" +// whitelist:"2111181, 2392178, 2545053, 2542166, 2550508, 2550378,2550253" +// password:"wontsethere" +// sshkey:"kristof" + + +!!hetznermanager.server_rescue + server_name: 'kristof21' // The name of the server to manage (or use `id`) + wait: true // Wait for the operation to complete + hero_install: true // Automatically install Herolib in the rescue system + +// # Install Ubuntu 24.04 on a server +// !!hetznermanager.ubuntu_install +// instance: 'main' +// id: 1234567 // The ID of the server (or use `server_name`) +// wait: true +// hero_install: true // Install Herolib on the new OS + +// # Reset a server +// !!hetznermanager.server_reset +// instance: 'main' +// server_name: 'your-server-name' +// wait: true + +// # Add a new SSH key to your Hetzner account +// !!hetznermanager.key_create +// instance: 'main' +// key_name: 'my-laptop-key' +// data: 'ssh-rsa AAAA...' \ No newline at end of file diff --git a/examples/virt/hetzner/hetzner_example.vsh b/examples/virt/hetzner/hetzner_example.vsh index a0b4cc72..18c035ae 100755 --- a/examples/virt/hetzner/hetzner_example.vsh +++ b/examples/virt/hetzner/hetzner_example.vsh @@ -17,20 +17,22 @@ passwd := os.environ()['HETZNER_PASSWORD'] or { exit(1) } -playcmds.run( - heroscript: ' - !!hetznermanager.configure - name:"main" - user:"${user}" - whitelist:"2111181, 2392178, 2545053, 2542166, 2550508, 2550378,2550253" - password:"${passwd}" - sshkey:"kristof" - ' -)! +hs:=' +!!hetznermanager.configure + user:"${user}" + whitelist:"2111181, 2392178, 2545053, 2542166, 2550508, 2550378,2550253" + password:"${passwd}" + sshkey:"kristof" +' + +println(hs) + +playcmds.run(heroscript: hs)! + console.print_header('Hetzner Test.') -mut cl := hetznermanager.get(name: 'main')! +mut cl := hetznermanager.get()! // println(cl) // for i in 0 .. 5 { diff --git a/lib/core/herocmds/bootstrap.v b/lib/core/herocmds/bootstrap.v index 5b6f6475..605f3a31 100644 --- a/lib/core/herocmds/bootstrap.v +++ b/lib/core/herocmds/bootstrap.v @@ -95,7 +95,6 @@ fn cmd_bootstrap_execute(cmd Command) ! { if develop { // n.crystal_install(reset: reset)! n.hero_install()! - n.dagu_install()! } else { panic('implement, need to download here and install') }