On Fri, Aug 18, 2006 at 10:02:18PM +0200, Henning Sprang wrote:
> > --add-vars "foo=bar\nx = ['test', 'test2']"
> >
> > Which would add that text literally. But with your example we'd
> > need to parse out the different options to know where to place
> > them. (eg. mac has to go inside the "vif" section.)
>
> I don't understand the problem here. Why does xen-create-image need
> to know where to place the values of a variable? It (or: the template
> language)replaces variables at every occurence in the template.
(Well ultimately xen-create-image doesn't care. The template
is processed in xt-create-xen-config, which gets its knowlege
from the environment it inherits.)
> What we have now in the templates is that I have some simple key/value
> pairs, and the template language even gives the possibility to make
> parts of the template conditional.
Sure, and that works generally.
However if you've got "key=value", "key2=value" and you've got
a template which reads:
--
blah={$key2}
baz={$key}
--
That works out fine. But consider the case in your example
you suggested:
"macaddr=xx:xxx:xx:xx:x foo=bar baz=bar"
In that case the template has to look like this:
vif = [ 'ip=xxx', {if ( $mac ) { $OUT .= "'mac=$macaddr'" } ]
That gets complex because it means we need to add conditionals
everywhere where it could concievably make sense to allow somebody
to specify something.
If we only allow the script to subtitute a couple of values it
can be done easily enough, but to allow *everything* to be conditional
it just gets too complex too fast. The templates should be simple
as far as I'm concerned.
Converting from "--extra="macc=xxx:xx bar=baz" into the correct
interpolation will be complex to manage, and I'm not convinced it
is useful.
> I determine where the value of mac has to go by placing the string
> {$mac} into the template. The correct place for a config file to
> function is a vif entry, but that has to be done right by the template
> writer, not xen-create-image..
True .. but I don't want the templates I supply to be so full
of conditionals as to be hard to modify.
*right now* if you run:
foo=bar xen-create-image --args
The value of "${foo}" will be set in the environment and can
be used in a template file. (Since the xt-create-xen-config
inserts all the values of the environment into its template if
they are used.)
> > I *will* add the --mac processing. (Presumably you'd want that
> > for every IP address?)
>
> I can imagine people doing static IP's will need that - for now, I
> mainly do dhcp.
If you're using DHCP why do you need the mac address at all?!
Steve
--
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]