Re: "Macro" expansion
Matt Holgate <[email protected]> Sun, 27 May 2001 21:38:04 +0100 (BST)
| Newsgroups | gmane.comp.sysutils.ark.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 24 May 2001, Will Partain wrote:
> > 2) Currently we can look up into certain tables ...
> > . It would be Really Nice if we could do this for any
> > arbitrary table field, not just ark-dirs.
>
> You can. See example below.
Won't this only work for teams and hosts (not packages etc.)?
> You'll help me write the semantics part of the ARK conf-lang
> for this :-?
;-)
I notice Jonathan is looking at bashing at this code, so it might be worth
discussing what could be done. I was thinking of something along the lines
of:
@<object-type|param>:<field-name>[:<index>[:<separator>]]@
Soooh....for hosts:
@host:PERL@ : would return the string in the PERL *string*
field
@host:ip-addresses:0@ : would return the string in item 0 of the
ip_addresses *list* field
@host:ip-addresses:*:,@ : would return a comma separated list of all the
items in the ip_addresses *list* field
@host:ark-dirs:FOO@ : would return the string in entry indexed by
'FOO' in the ark-dirs *table* field
Of course all these evaluations are subject to the usual constraints
rules. If you really scary semantics (maybe not a good idea):
@host:describe()@ : would return the output (or evaluate??) the
describe method.
Maybe even better would be a syntax with a different opening and closing
symbol (eg. @{blah}@) would be better as it would allow one to nest
macros:
@{host:run-level-dir:@{param:RUN_LEVEL}@}@
Scary stuff...
Matt