dsrvlabs / vatz

Node management integration tools in purpose of maximizing node's uptime for any protocols
https://www.dsrvlabs.com/
GNU General Public License v3.0
30 stars 15 forks source link

Remove Panic message when all CLI commands fails #469

Closed xellos00 closed 8 months ago

xellos00 commented 1 year ago

Checklist


Describe the bug

A clear and concise description of what the bug is.

How to Reproduce

Steps to reproduce the behavior:

  1. Check the plugin list and find a name of plugin that is running
  2. Stop plugin
  3. if there's no process with plugin_name it panics, I think there's better way to not to show message below
Error: can't find the process
Usage:
   plugin stop [flags]

Examples:
vatz plugin stop pluginName

Flags:
  -h, --help            help for stop
  -p, --plugin string   Installed plugin name

panic: can't find the process

goroutine 1 [running]:
main.main()
    /root/dsrv/vatz/main.go:20 +0x45
root@near-testnet-validator-sfo2:~/dsrv/vatz#

Expected behavior

A clear and concise description of what you expected to happen.

Just notify there's no passing process and no Panic on Screen.

Screenshots

If applicable, add screenshots to help explain your problem.

root@near-testnet-validator-sfo2:~/dsrv/vatz# ./vatz plugin stop /root/.vatz/net_monitor
2023-06-06T03:18:49Z INF Load Config default.yaml module=config
2023-06-06T03:18:49Z INF Stop plugin  module=plugin
2023-06-06T03:18:49Z INF Create DB Instance module=db
2023-06-06T03:18:49Z INF Stop plugin  module=plugin
2023-06-06T03:18:49Z INF Find Process  module=plugin
Error: can't find the process
Usage:
   plugin stop [flags]

Examples:
vatz plugin stop pluginName

Flags:
  -h, --help            help for stop
  -p, --plugin string   Installed plugin name

panic: can't find the process

goroutine 1 [running]:
main.main()
    /root/dsrv/vatz/main.go:20 +0x45
root@near-testnet-validator-sfo2:~/dsrv/vatz# ./vatz plugin list
2023-06-06T03:19:14Z INF Load Config default.yaml module=config
2023-06-06T03:19:14Z INF List plugins module=plugin
2023-06-06T03:19:14Z INF Create DB Instance module=db
2023-06-06T03:19:14Z INF List module=plugin
2023-06-06T03:19:14Z INF List module=db
+-------------+------------+---------------------+-------------------------------------------------------------+---------+
| NAME        | IS ENABLED | INSTALL DATE        | REPOSITORY                                                  | VERSION |
+-------------+------------+---------------------+-------------------------------------------------------------+---------+
| net_monitor | true       | 2023-06-06 02:55:51 | github.com/dsrvlabs/vatz-plugin-sysutil/plugins/net_monitor | latest  |
+-------------+------------+---------------------+-------------------------------------------------------------+---------+
root@near-testnet-validator-sfo2:~/dsrv/vatz# ./vatz plugin stop net_monitor
2023-06-06T03:19:22Z INF Load Config default.yaml module=config
2023-06-06T03:19:22Z INF Stop plugin  module=plugin
2023-06-06T03:19:22Z INF Create DB Instance module=db
2023-06-06T03:19:22Z INF Stop plugin  module=plugin
2023-06-06T03:19:22Z INF Find Process  module=plugin
Error: can't find the process
Usage:
   plugin stop [flags]

Examples:
vatz plugin stop pluginName

Flags:
  -h, --help            help for stop
  -p, --plugin string   Installed plugin name

panic: can't find the process

goroutine 1 [running]:
main.main()
    /root/dsrv/vatz/main.go:20 +0x45
root@near-testnet-validator-sfo2:~/dsrv/vatz#
xellos00 commented 1 year ago
gnongs commented 1 year ago

vatz plugin

$ ./vatz plugin status f0d0fjad0f
2023-06-12T13:45:15+09:00 INF Load Config default.yaml module=config
Error: open default.yaml: no such file or directory
Usage:
   plugin status [flags]

Flags:
  -h, --help         help for status
      --rpc string   RPC address of Vatz (default "http://localhost:19091")

panic: open default.yaml: no such file or directory

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45
$ ./vatz plugin list f0d0fjad0f
2023-06-12T13:45:22+09:00 INF Load Config default.yaml module=config
Error: open default.yaml: no such file or directory
Usage:
   plugin list [flags]

Examples:
vatz plugin list

Flags:
  -h, --help   help for list

panic: open default.yaml: no such file or directory

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45
$ ./vatz plugin status f0d0fjad0f]
2023-06-12T13:45:30+09:00 INF Load Config default.yaml module=config
Error: open default.yaml: no such file or directory
Usage:
   plugin status [flags]

Flags:
  -h, --help         help for status
      --rpc string   RPC address of Vatz (default "http://localhost:19091")

panic: open default.yaml: no such file or directory

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45
$ ./vatz plugin stop f0d0fjad0f]
2023-06-12T13:45:35+09:00 INF Load Config default.yaml module=config
Error: open default.yaml: no such file or directory
Usage:
   plugin stop [flags]

Examples:
vatz plugin stop pluginName

Flags:
  -h, --help            help for stop
  -p, --plugin string   Installed plugin name

panic: open default.yaml: no such file or directory

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45
$ ./vatz plugin uninstall f0d0fjad0f]
2023-06-12T13:45:41+09:00 INF Load Config default.yaml module=config
Error: open default.yaml: no such file or directory
Usage:
   plugin uninstall [flags]

Examples:
vatz plugin uninstall name

Flags:
  -h, --help   help for uninstall

panic: open default.yaml: no such file or directory

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45

vatz completion

 GNONG  ~/workspace/dsrv/vatz   main  ./vatz completion bash fkjdalfjie
Error: unknown command "fkjdalfjie" for " completion bash"
Usage:
   completion bash

Flags:
  -h, --help              help for bash
      --no-descriptions   disable completion descriptions

panic: unknown command "fkjdalfjie" for " completion bash"

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45
 ✘ GNONG  ~/workspace/dsrv/vatz   main  ./vatz completion fish fkjdalfjie
Error: unknown command "fkjdalfjie" for " completion fish"
Usage:
   completion fish [flags]

Flags:
  -h, --help              help for fish
      --no-descriptions   disable completion descriptions

panic: unknown command "fkjdalfjie" for " completion fish"

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45
 ✘ GNONG  ~/workspace/dsrv/vatz   main  ./vatz completion powershell fkjdalfjie
Error: unknown command "fkjdalfjie" for " completion powershell"
Usage:
   completion powershell [flags]

Flags:
  -h, --help              help for powershell
      --no-descriptions   disable completion descriptions

panic: unknown command "fkjdalfjie" for " completion powershell"

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45
 ✘ GNONG  ~/workspace/dsrv/vatz   main  ./vatz completion zsh fkjdalfjie
Error: unknown command "fkjdalfjie" for " completion zsh"
Usage:
   completion zsh [flags]

Flags:
  -h, --help              help for zsh
      --no-descriptions   disable completion descriptions

panic: unknown command "fkjdalfjie" for " completion zsh"

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45
xellos00 commented 1 year ago

@gnongs

@heejin-github

gnongs commented 1 year ago

vatz init

$ ./vatz init --al fjieanlfei
Error: unknown flag: --al
Usage:
   init [flags]

Flags:
  -a, --all             Create config yaml with all default setting of official plugins.
  -h, --help            help for init
  -p, --home string     Home directory of VATZ (default "~/.vatz")
  -o, --output string   New config file to create (default "default.yaml")

panic: unknown flag: --al

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45

vatz start

$ ./vatz start --hefdjaienf
Error: unknown flag: --hefdjaienf
Usage:
   start [flags]

Flags:
      --config string       VATZ config file. (default "default.yaml")
  -h, --help                help for start
      --log string          log file export to.
      --prometheus string   prometheus port number. (default "18080")

panic: unknown flag: --hefdjaienf

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45

vatz version

$ ./vatz version --filanelf
Error: unknown flag: --filanelf
Usage:
   version [flags]

Flags:
  -h, --help   help for version

panic: unknown flag: --filanelf

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45

vatz help

 ./vatz help --fiaelnfa
Error: unknown flag: --fiaelnfa
Usage:
   help [command] [flags]

Flags:
  -h, --help   help for help

panic: unknown flag: --fiaelnfa

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45

This should throw error.

 dongyookang DK 🎉   ~/ffplay/GolandProjects/xellos/vatz   ISSUE-469
 ./vatz init --all asdfasdf
2023-06-15T16:38:05-05:00 INF init module=main
2023-06-15T16:38:05-05:00 INF home path ~/.vatz module=main
2023-06-15T16:38:05-05:00 INF create file default.yaml module=main
2023-06-15T16:38:05-05:00 INF Load Config default.yaml module=config
2023-06-15T16:38:05-05:00 INF Plugin dir /Users/dongyookang/.vatz module=main
2023-06-15T16:38:05-05:00 INF Create DB Instance module=db
2023-06-15T16:38:05-05:00 INF initDB /Users/dongyookang/.vatz/vatz.db module=db
2023-06-15T16:38:05-05:00 INF Remove old DB file module=db
2023-06-15T16:38:05-05:00 INF Create new DB file module=db
2023-06-15T16:38:05-05:00 INF Create DB Instance module=db
 dongyookang DK 🎉   ~/ffplay/GolandProjects/xellos/vatz   ISSUE-469
 
gnongs commented 1 year ago

vatz XXXX

 ./vatz list
Error: unknown command "list" for ""
Run ' --help' for usage.
panic: unknown command "list" for ""

goroutine 1 [running]:
main.main()
    /Users/choejinhong/workspace/dsrv/vatz/main.go:20 +0x45
xellos00 commented 1 year ago

Case


2023-06-15T21:22:13-05:00 ERR CLI command error >>  unknown flag: --aa
 dongyookang DK 🎉   ~/ffplay/GolandProjects/xellos/vatz   ISSUE-469 ±
 ./vatz init -aa 
2023-06-15T21:22:20-05:00 INF init module=main
2023-06-15T21:22:20-05:00 INF home path ~/.vatz module=main
2023-06-15T21:22:20-05:00 INF create file default.yaml module=main
2023-06-15T21:22:20-05:00 INF Load Config default.yaml module=config
2023-06-15T21:22:20-05:00 INF Plugin dir /Users/dongyookang/.vatz module=main
2023-06-15T21:22:20-05:00 INF Create DB Instance module=db
2023-06-15T21:22:20-05:00 INF initDB /Users/dongyookang/.vatz/vatz.db module=db
2023-06-15T21:22:20-05:00 INF Remove old DB file module=db
2023-06-15T21:22:20-05:00 INF Create new DB file module=db
2023-06-15T21:22:20-05:00 INF Create DB Instance module=db
 dongyookang DK 🎉   ~/ffplay/GolandProjects/xellos/vatz   ISSUE-469 ±
 ./vatz init -oo
2023-06-15T21:22:23-05:00 INF init module=main
2023-06-15T21:22:23-05:00 INF home path ~/.vatz module=main
2023-06-15T21:22:23-05:00 INF create file o module=main
2023-06-15T21:22:23-05:00 INF Load Config o module=config
2023-06-15T21:22:23-05:00 INF Plugin dir /Users/dongyookang/.vatz module=main
2023-06-15T21:22:23-05:00 INF Create DB Instance module=db
2023-06-15T21:22:23-05:00 INF initDB /Users/dongyookang/.vatz/vatz.db module=db
2023-06-15T21:22:23-05:00 INF Remove old DB file module=db
2023-06-15T21:22:23-05:00 INF Create new DB file module=db
2023-06-15T21:22:23-05:00 INF Create DB Instance module=db
 dongyookang DK 🎉   ~/ffplay/GolandProjects/xellos/vatz   ISSUE-469 ±
 
xellos00 commented 1 year ago

It's partially fixed, but has not done yet.

xellos00 commented 8 months ago

I assume this would take little while to find all these kind enhancement, it's not going to be included on 1.1 and so close this issue and will escalate to next phase.