hilbert / hilbert-cli

Backend management tools: CLI
Apache License 2.0
6 stars 2 forks source link

Add interactive login subcommand for debugging? #59

Closed vga101 closed 6 years ago

vga101 commented 6 years ago

Hi, what do you think about adding a hilbert subcommand that makes a simple interactive login, e.g. "hilbert ssh kiosktower"? It's not really necessary, but for a larger installation IMHO would a lot of sense: The correspondance of hilbert machine names and actual DNS names (or IP addresses) may not be straightforward and can be cumbersome if there are >100 clients in Hilbert.yml. During development and for debugging, interactive login may be used frequently and the "logical" client names are then the ones I would want to work with.

Nothing more than simple ssh login would be included (any more fancy things should be done manually). So if Hilbert.yml says that kiosktower5 has the DNS name "client074234.mydomain", the command "hilbert ssh kiosktower5" would simply execute an "ssh client074234.mydomain" with the default user and credentials.

Not sure about non-Linux machines, though.

malex984 commented 6 years ago

@porst17 i would estimate workload: ~20 min to implement this feature and briefly test it...

malex984 commented 6 years ago

@vga101 Do you think arguments to such a hilbert's ssh command should be passed as with the usual ssh?

vga101 commented 6 years ago

Don't think it's strictly needed, but doesn't hurt to have it for the future.

porst17 commented 6 years ago

We decided against a new subcommand for this because it would introduce functionality into hilbert that can already be achieved via existing tools. So we propose the following approach:

ssh -F $HILBERT_SERVER_CONFIG_SSH_PATH \
    `python3 tools/hilbert.py cfg_query --configfile tests/data/Hilbert.yml -o Stations/testhost1/address` \
    echo HelloWorld

You can put this into a wrapper script if you need a shortcut. You should also check if HILBERT_SERVER_CONFIG_SSH_PATH is defined (and if not remove the parameter).

Stations/testhost1/address is the path to the requested information in th YAML config. The query is very flexible and may be used for different things as well.

Note that there was a bug in the query output, so make sure you use a version later than 52ee3a109b10ccdd5449fa710472826a041858f8.