Re: [Libguestfs] virt-customize
On Fri, Feb 18, 2022 at 07:01:22PM +0100, Lukáš Doktor wrote:
Hello Rich,
by any chance do you know whether it's possible to escape ':' in "virt-customize" command? I'm trying to upload a file:
--upload '/etc/yum.repos.d/_copr\:copr.devel.redhat.com\:ndokos\:pbench.repo:/etc/yum.repos.d/'
tried various combinations of doubling the ':' or escaping them and so on, but it always considers the first ':' as splitter.
It's not possible because the function always splits on the first ':'... https://github.com/libguestfs/libguestfs-common/blob/41126802097f0a864cab867... ... but there's several workarounds. * Make a local copy of the file; you can still give the full name when you upload: $ cp /etc/yum.repos.d/_copr:copr.devel.redhat.com:ndokos:pbench.repo tmp.repo $ virt-customize .. --upload tmp.repo:/etc/yum.repos.d/full:name:including:colons.repo * If the file is small, --write + --move. * Use --copy-in (if you can copy the whole directory). * Use guestfish or the API. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
That was quick, thank you Rich. Temporarily I used the "cp" approach, but escaping possibility would be IMO useful, especially for automated setups where "--upload" args are generated automatically (my case). Regards, Lukáš Dne 18. 02. 22 v 20:00 Richard W.M. Jones napsal(a):
On Fri, Feb 18, 2022 at 07:01:22PM +0100, Lukáš Doktor wrote:
Hello Rich,
by any chance do you know whether it's possible to escape ':' in "virt-customize" command? I'm trying to upload a file:
--upload '/etc/yum.repos.d/_copr\:copr.devel.redhat.com\:ndokos\:pbench.repo:/etc/yum.repos.d/'
tried various combinations of doubling the ':' or escaping them and so on, but it always considers the first ':' as splitter.
It's not possible because the function always splits on the first ':'...
https://github.com/libguestfs/libguestfs-common/blob/41126802097f0a864cab867...
... but there's several workarounds.
* Make a local copy of the file; you can still give the full name when you upload:
$ cp /etc/yum.repos.d/_copr:copr.devel.redhat.com:ndokos:pbench.repo tmp.repo
$ virt-customize .. --upload tmp.repo:/etc/yum.repos.d/full:name:including:colons.repo
* If the file is small, --write + --move.
* Use --copy-in (if you can copy the whole directory).
* Use guestfish or the API.
Rich.
participants (2)
-
Lukáš Doktor -
Richard W.M. Jones