Re: [PATCH] virsh: Allow users to reedit rejected XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 09, 2012 at 03:36:26PM +0200, Michal Privoznik wrote:
> If users {net-,pool-,}edit but make a mistake in XML all changes
> are permanently lost. However, if virsh is running in interactive
> mode we can as user if he wants to re-edit the file and correct
> the mistakes.
> ---

> +    dom_edited = virDomainDefineXML(ctl->conn, doc_edited);
> +    if (!dom_edited) {
> +        /* Redefine failed. If we are in interactive mode ask user
> +         * if he wants to re-edit the XML. */
> +        if (!ctl->imode ||
> +            vshMakeStdinRaw(&ttyattr, false) < 0)
> +            goto cleanup;

I don't see why this has to be restricted to interactive mode
only. I almost always just run

   virsh edit foo

and there's no reason why we can't prompt to re-edit here too.

What you want to check is isatty(STDIN) so you can distinguish
batch scripting.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]