The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4158

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
When containers have mulitple IP addresses, `lxc list` rows span over multiple lines, like:  

```
+------------------+---------+--------------------------------+-----------------------------------------------+------------+-----------+
| maas             | RUNNING | 192.168.200.1 (maas0)          | fd42:1fe6:bf48:a57d:216:3eff:fefd:a254 (eth0) | PERSISTENT | 0         |
|                  |         | 10.215.5.126 (eth0)            |                                               |            |           |
+------------------+---------+--------------------------------+-----------------------------------------------+------------+-----------+
```

This causes bash completion to include a `|` among container names.
From f26a91cd20498036c502034d6487f32b3502f531 Mon Sep 17 00:00:00 2001
From: Alberto Donato <[email protected]>
Date: Wed, 10 Jan 2018 23:47:48 +0100
Subject: [PATCH] fix parsing for container name tab-completion

---
 config/bash/lxd-client | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/config/bash/lxd-client b/config/bash/lxd-client
index e74dd8d95..fbbefbcd7 100644
--- a/config/bash/lxd-client
+++ b/config/bash/lxd-client
@@ -6,11 +6,11 @@ _have lxc && {
       local state=$1
       local keys=$2
 
-      local cmd="lxc list --fast"
-      [ -n "$state" ] && cmd="$cmd | grep -E '$state'"
+      local cmd="lxc list --format=csv --columns=ns"
+      [ -n "$state" ] && cmd="$cmd | grep -E '$state$'"
 
       COMPREPLY=( $( compgen -W \
-        "$( eval $cmd | grep -Ev '(\+--|NAME)' | awk '{print $2}' ) $keys" 
"$cur" )
+        "$( eval $cmd | cut -d, -f1 ) $keys" "$cur" )
       )
     }
 
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to