<p dir="ltr">Perhaps you can even turn that into a bash alias.</p>
<div class="gmail_extra"><br><div class="gmail_quote">Op 10 nov. 2016 18:33 schreef "Ingo Baab" <<a href="mailto:ib@baab.de">ib@baab.de</a>>:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<p>Andriy, (meanwhile) you can help yourself with (doing that
sequentially)..<br>
<br>
<tt>for container in `lxc list mysql-rep --format=json | jq
.[].name | tr -d '"'`; do lxc exec $container -- apt update;
done</tt><font color="#888888"><br>
</font></p><font color="#888888">
<p>-Ingo</p></font><div class="elided-text">
<p><br>
</p>
<div class="m_-2007050786237914780moz-cite-prefix">Am 10.11.2016 um 15:36 schrieb Andriy
Tovstik:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Thanks, Stéphane, i'm very inattentive... Now it
looks better. Additional output format seems to be more
comfortable than additional tools. But it insignificantly.
<div><br>
</div>
<div>And what do you think about the second question about
ability to run commands on multiplie containers simultaneously
using regexps as container name ? Is this feature looks
useful?</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div class="gmail_quote">
<div dir="ltr">чт, 10 нояб. 2016 г. в 15:25, Stéphane Graber
<<a href="mailto:stgraber@ubuntu.com" target="_blank">stgraber@ubuntu.com</a>>:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">stgraber@castiana:~$
lxc list --format=json | jq .[].name<br class="m_-2007050786237914780gmail_msg">
"android"<br class="m_-2007050786237914780gmail_msg">
"lxd"<br class="m_-2007050786237914780gmail_msg">
"snapcraft"<br class="m_-2007050786237914780gmail_msg">
"test"<br class="m_-2007050786237914780gmail_msg">
"ubuntu-core"<br class="m_-2007050786237914780gmail_msg">
"ubuntu-zesty"<br class="m_-2007050786237914780gmail_msg">
"xen"<br class="m_-2007050786237914780gmail_msg">
"yak"<br class="m_-2007050786237914780gmail_msg">
<br class="m_-2007050786237914780gmail_msg">
On Thu, Nov 10, 2016 at 12:31:01PM +0000, Andriy Tovstik
wrote:<br class="m_-2007050786237914780gmail_msg">
> Hi, Janjaap Bos!<br class="m_-2007050786237914780gmail_msg">
><br class="m_-2007050786237914780gmail_msg">
> I tried jq. But as i have already wrote, some useful
fileds like container<br class="m_-2007050786237914780gmail_msg">
> name are missing in json output...<br class="m_-2007050786237914780gmail_msg">
><br class="m_-2007050786237914780gmail_msg">
> чт, 10 нояб. 2016 г. в 14:27, Janjaap Bos <<a href="mailto:janjaapbos@gmail.com" class="m_-2007050786237914780gmail_msg" target="_blank">janjaapbos@gmail.com</a>>:<br class="m_-2007050786237914780gmail_msg">
><br class="m_-2007050786237914780gmail_msg">
> > You can pipe the json through jq.<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > See: <a href="https://stedolan.github.io/jq/tutorial" rel="noreferrer" class="m_-2007050786237914780gmail_msg" target="_blank">https://stedolan.github.io/jq/<wbr>tutorial</a><br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > 2016-11-10 11:17 GMT+01:00 Andriy Tovstik <<a href="mailto:andriy.tovstik@gmail.com" class="m_-2007050786237914780gmail_msg" target="_blank">andriy.tovstik@gmail.com</a>>:<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > Hi all!<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > During LXD learning i encountered with lack of
some features.<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > The first one is "raw" output format of lxc
list. Currently lxc list<br class="m_-2007050786237914780gmail_msg">
> > supports two formats: table and json.
Unfortunately both formats are<br class="m_-2007050786237914780gmail_msg">
> > unusable for scripting.<br class="m_-2007050786237914780gmail_msg">
> > It is very difficult to pass to script output
likes:<br class="m_-2007050786237914780gmail_msg">
> > # lxc list --format table -c n<br class="m_-2007050786237914780gmail_msg">
> > +------------+<br class="m_-2007050786237914780gmail_msg">
> > | NAME |<br class="m_-2007050786237914780gmail_msg">
> > +------------+<br class="m_-2007050786237914780gmail_msg">
> > | mysql-rep1 |<br class="m_-2007050786237914780gmail_msg">
> > +------------+<br class="m_-2007050786237914780gmail_msg">
> > | mysql-rep2 |<br class="m_-2007050786237914780gmail_msg">
> > +------------+<br class="m_-2007050786237914780gmail_msg">
> > | mysql-rep3 |<br class="m_-2007050786237914780gmail_msg">
> > +------------+<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > When i try to use json format i see that useful
fields like container name<br class="m_-2007050786237914780gmail_msg">
> > are missing in output. May be it will be useful
to implement feature like:<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > # lxc list --format raw -c n --no-header<br class="m_-2007050786237914780gmail_msg">
> > mysql-rep1<br class="m_-2007050786237914780gmail_msg">
> > mysql-rep2<br class="m_-2007050786237914780gmail_msg">
> > mysql-rep3<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > The second feature looks useful is ability run
commands on multiplie<br class="m_-2007050786237914780gmail_msg">
> > containers simultaneously. For example:<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > # lxc exec web-node* -- apt update<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > What do you think about it?<br class="m_-2007050786237914780gmail_msg">
> > --<br class="m_-2007050786237914780gmail_msg">
> > WBR, Andriy Tovstik<br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > ______________________________<wbr>_________________<br class="m_-2007050786237914780gmail_msg">
> > lxc-users mailing list<br class="m_-2007050786237914780gmail_msg">
> > <a href="mailto:lxc-users@lists.linuxcontainers.org" class="m_-2007050786237914780gmail_msg" target="_blank">lxc-users@lists.<wbr>linuxcontainers.org</a><br class="m_-2007050786237914780gmail_msg">
> > <a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" class="m_-2007050786237914780gmail_msg" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a><br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> ><br class="m_-2007050786237914780gmail_msg">
> > ______________________________<wbr>_________________<br class="m_-2007050786237914780gmail_msg">
> > lxc-users mailing list<br class="m_-2007050786237914780gmail_msg">
> > <a href="mailto:lxc-users@lists.linuxcontainers.org" class="m_-2007050786237914780gmail_msg" target="_blank">lxc-users@lists.<wbr>linuxcontainers.org</a><br class="m_-2007050786237914780gmail_msg">
> > <a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" class="m_-2007050786237914780gmail_msg" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a><br class="m_-2007050786237914780gmail_msg">
><br class="m_-2007050786237914780gmail_msg">
> --<br class="m_-2007050786237914780gmail_msg">
> WBR, Andriy Tovstik<br class="m_-2007050786237914780gmail_msg">
<br class="m_-2007050786237914780gmail_msg">
> ______________________________<wbr>_________________<br class="m_-2007050786237914780gmail_msg">
> lxc-users mailing list<br class="m_-2007050786237914780gmail_msg">
> <a href="mailto:lxc-users@lists.linuxcontainers.org" class="m_-2007050786237914780gmail_msg" target="_blank">lxc-users@lists.<wbr>linuxcontainers.org</a><br class="m_-2007050786237914780gmail_msg">
> <a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" class="m_-2007050786237914780gmail_msg" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a><br class="m_-2007050786237914780gmail_msg">
<br class="m_-2007050786237914780gmail_msg">
<br class="m_-2007050786237914780gmail_msg">
--<br class="m_-2007050786237914780gmail_msg">
Stéphane Graber<br class="m_-2007050786237914780gmail_msg">
Ubuntu developer<br class="m_-2007050786237914780gmail_msg">
<a href="http://www.ubuntu.com" rel="noreferrer" class="m_-2007050786237914780gmail_msg" target="_blank">http://www.ubuntu.com</a><br class="m_-2007050786237914780gmail_msg">
______________________________<wbr>_________________<br class="m_-2007050786237914780gmail_msg">
lxc-users mailing list<br class="m_-2007050786237914780gmail_msg">
<a href="mailto:lxc-users@lists.linuxcontainers.org" class="m_-2007050786237914780gmail_msg" target="_blank">lxc-users@lists.<wbr>linuxcontainers.org</a><br class="m_-2007050786237914780gmail_msg">
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" class="m_-2007050786237914780gmail_msg" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a></blockquote>
</div>
</div>
</div>
<div dir="ltr">-- <br>
</div>
<div data-smartmail="gmail_signature">
<div dir="ltr">WBR, Andriy Tovstik</div>
</div>
<br>
<fieldset class="m_-2007050786237914780mimeAttachmentHeader"></fieldset>
<br>
<pre>______________________________<wbr>_________________
lxc-users mailing list
<a class="m_-2007050786237914780moz-txt-link-abbreviated" href="mailto:lxc-users@lists.linuxcontainers.org" target="_blank">lxc-users@lists.<wbr>linuxcontainers.org</a>
<a class="m_-2007050786237914780moz-txt-link-freetext" href="http://lists.linuxcontainers.org/listinfo/lxc-users" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a></pre>
</blockquote>
<br>
</div></div>
<br>______________________________<wbr>_________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.<wbr>linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a><br></blockquote></div><br></div>