On Tuesday 07 January 2014 15:24:51 Pino Toscano wrote:
On Tuesday 07 January 2014 12:12:43 Richard W.M. Jones wrote:
> On Tue, Jan 07, 2014 at 11:16:08AM +0100, Pino Toscano wrote:
> > On Friday 27 December 2013 10:58:15 you wrote:
> > > virt-sysprep either runs with all default operations or a
> > > selected
> > > list of operations with the --enable argument. A few times I've
> > > found I'd like to use the default list, but minus one or two
> > > operations in particular, however there's no easy way to specify
> > > this.
> > >
> > > A --disable argument that took the default operation list and
> > > skipped
> > > selected operations would be useful.
> >
> > A rough idea I had about this is adding a new --operations
> > parameter,
> > which would take a a comma-separated list of operations (just like
> > the current --enable), but with the following differences:
> > - a leading minus would disable the specified operation
> > - it would recognize the meta-keywords "all" (for all the
> > available
> >
> > operations) and "defaults" (for the ones enabled by default)
> >
> > Processing the list of operations would add/remove them from the
> > current set of operations, bailing out whether the resulting set
> > is
> > empty (just like right now --enable rejects an empty string).
> >
> > This way, you could write e.g.:
> > - --operations defaults,-hostname,user-account
> >
> > runs the default ones but not "hostname", and the non-default
> > "user-account"
> >
> > - --operations all
> >
> > easy shortcut to run all the available operations
> >
> > and so on.
> >
> > --enable could just be an alias for --operations, or this new
> > syntax
> > could be added directly to --enable directly.
> >
> > Maybe I'm over-engineering, but IMHO seems a better way than
> > potentially adding a --disable argument and deal with the order of
> > --enable & --disable and their interactions.
>
> Seems reasonable.
Attached there is a first PoC for --operations, implementing the idea I
outlined with your hints too.
Possibly not the best ocaml code ever (my first long-ish ocaml code,
actually), but seems to work fine; maybe the various functions added in
Sysprep_operations could be simplified in one with a label as parameter
(eg `All | `Defaults).
--
Pino Toscano