[libvirt PATCH 07/11] virnetclient: Use 'if' consistently

Daniel P. Berrangé berrange at redhat.com
Fri Feb 11 17:46:31 UTC 2022


On Fri, Feb 11, 2022 at 06:39:15PM +0100, Andrea Bolognani wrote:
> This makes the generated script a bit shorter and removes an
> unnecessary call to test.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  src/rpc/virnetclient.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
> index cbefa8f11f..7e7e9d52a6 100644
> --- a/src/rpc/virnetclient.c
> +++ b/src/rpc/virnetclient.c
> @@ -449,8 +449,7 @@ virNetClientSSHHelperCommand(virNetClientProxy proxy,
>  
>      switch (proxy) {
>      case VIR_NET_CLIENT_PROXY_AUTO:
> -        return g_strdup_printf("sh -c 'which virt-ssh-helper 1>/dev/null 2>&1; "
> -                               "if test $? = 0; then "
> +        return g_strdup_printf("sh -c 'if which virt-ssh-helper >/dev/null 2>&1; then "
>                                     "%s; "
>                                 "else "
>                                     "%s; "

I understand the motivation, but please don't change this. Applications
like OpenStack have configured ssh authorized_keys files with the
specific command that libvirt invokes. So changes like this will break
their SSH configs.  We caused this pain when we first introduced the
virt-ssh-helper, but at least that was giving them a functional
improvement and they could use a URI parameter to force the old command
string. This change is just prettiness for no functional improvement
so is not worth breaking apps for.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list