neoave / mrack

Multicloud use-case based multihost async provisioner for CIs and testing during development
Apache License 2.0
12 stars 14 forks source link

Add "list" and "ssh" actions #8

Closed pvoborni closed 4 years ago

pvoborni commented 4 years ago

This is a follow up after(based on) https://github.com/pvoborni/aiohabit/pull/7

List action

To quickly show content of DB in human readable form

SSH action

To make it very easy to SSH into a host based on value in various configuration objects.

It is usually very time-consuming to "cat" e.g. inventory, copy the real hostname/IP, write all the SSH options including determining if it should use SSH key and what is its location.

The interactive mode even saves time with writing the fake hostname.

The bad UX of these actions is a need to provide metadata/config paths. In some other PR, we should figure out some reasonable default so that ppl can simply execute: aiohabit list and aiohabit ssh

netoarmando commented 4 years ago

@pvoborni Everything looks good, but I have two considerations (which I want to fill bugs for):

  1. There's a bug in AWSProvider.to_host method that is breaking the SSH action: https://github.com/pvoborni/aiohabit/blob/97f482e2e9338c618fdec42bb2f4970057725976/src/aiohabit/providers/aws.py#L216 That should line must be replaced by:

    STATUS_MAP[host_info.get("status")],

    This could be done in this PR, but we also need to better map the statuses among providers.

  2. We could improve the names of the classes to reflect what they do, like rename all action classes to SomethingAction, e.g: SSHAction, ListAction.


Also, I couldn't ssh into AWS hosts, I tried to force the private key without success. Since I don't think that's related to the changes you are providing, I'm fine with all here.

pvoborni commented 4 years ago

Thanks Armando for the review. I agree with both points.