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
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list