Closed vvv closed 4 years ago
closed via commit 5609219859ac587355aef6cb986580227c1b5e2f
closed via merge request #812
@vvv
To make
hctl reportbug
command, we only need to
- create
utils/hare-reportbug
script with# :help: <help message>
;- [optionally] update hctl's help message.
Addition:
case
instruction here in hctl (it turns out that there is a hardcoded list of commands though).mentioned in merge request #812
MR with solution is ready for review: http://gitlab.mero.colo.seagate.com/mero/hare/merge_requests/491
@konstantin.nekrasov Or you mean that no fancy CLI subcommands parsing is needed at all? Hmm... :thinking_face:
Indeed. I see it now. @konstantin.nekrasov Thanks for disrupting my attempts at over-engineering!
(And kudos to @dmitriy.chumak, who wrote that nice and simple hctl
implementation!)
To make hctl reportbug
command, we only need to
utils/hare-reportbug
script with # :help: <help message>
;I'm sure @azheregelya has figured this out already. Sorry for the noise.
If we use argparse subparsers instead, all the hctl subcommands will be required to be written in Python only and there will be no such easy way to extend the CLI API.
Good point.
os.system()
.@konstantin.nekrasov To be honest, I doubt that Bash implementation of hctl
CLI tool (the dispatcher,
calling subcommand implementations) will be simpler than Python implementation of the same.
AFAIK, getopt
command doesn't let one express CLI with subcommands.
I implemented CLI with subcommands for Mero's and Halon's helper scripts.
This is doable, but I didn't enjoy the process or the resulting code too much.
Bash doesn't go to great lengths to make developer's experience pleasant in this regard.
Command-line arguments parsers provided by Python, Go, and Rust
are much more developer-friendly in comparison.
But. If you would rather implement hctl
in Bash — go ahead. It's your patch after all, not mine. :slightly_smiling_face:
@vvv
[Konstantin] rewrites
hctl
in Python;
Do we really need that piece of work? The current approach allows writing extensible hctl interface just following script naming convention. If we use argparse subparsers instead, all the hctl subcommands will be required to be written in Python only and there will be no such easy way to extend the CLI API. I can imagine a hand-made framework that dynamically searches for all hctl subcommand implementations and registers them within hctl's subparsers but I doubt we need it now. Bash-written hctl
is dumb but pretty easy.
It makes sense to use hctl-
prefix for the file names of hctl subcommand implementations.
This would make it easy to discern utils/hctl-*
scripts from the rest of utils/*
and highlight their relation to hctl
CLI tool.
Compare with git-*
scripts in the Git source repository.
cc @dmitriy.chumak
I propose that we distribute the work like this:
hctl
in Python;@konstantin.nekrasov I guess subcommands of argparse would be a good fit for hctl
CLI. What do you think?
My proposal: allow some of the hctl plugins (utils/hare-*
scripts) be written in something non-bash.
In my particular case (see my branch) I'm going to:
setuptools
to generate the CLI wrapper for the module (similar to how we get hax
executable in HaX, see setup.py file)utils/hare-*
that actually forwards to the executable from [2].Solution: add
hctl reportbug
command that will collect the data required to investigate Hare failures.
@konstantin.nekrasov was going to extend hctl CLI; see #794. @azheregelya, you may want to contact Konstantin and agree on how to extend the CLI. (Could it be the right time to rewrite hctl
in Python?)
changed the description
assigned to @azheregelya
I propose the following structure of an archive file (hare_<hostname>.tar.xz
) collected at node \<hostname>:
<hostname>/
├── build-ees-ha-args.yaml
├── cluster.sls
├── cluster.yaml
├── consul
│ ├── consul-agents.json
│ ├── consul-elect-rc-leader.log
│ ├── consul-kv.json
│ ├── consul-proto-rc.log
│ ├── consul-server-c1-conf.json
│ ├── consul-server-c2-conf.json
│ ├── consul-server-conf.json
│ └── consul-watch-service.log
├── ees-ha-csm-args.yaml
├── syslog.txt
└── systemctl-status.txt
1 directory, 14 files
files from the primary node
The “primary node” will contain /opt/seagate/eos-prvsnr/pillar/components/cluster.sls
and /var/lib/hare/cluster.yaml
.
changed title from Problem: {-the -}collection of Hare forensics is not automated to Problem: collection of Hare forensics is not automated
mentioned in issue #781
cc @azheregelya, @andriy.tkachuk
Solution: add
hctl reportbug
command that will collect the data required to investigate Hare failures.Data to collect:
/opt/seagate/eos-prvsnr/pillar/components/cluster.sls
from the “primary” node;/var/lib/hare/*.{yaml,json}
files from the primary node;/var/log/hare/
directory.The data collected with
hctl reportbug
may overlap with what Mero'sm0reportbug
collects, let us not worry about that for now.Related issue: #781