Creating multiple instances with Buildout macros
As of version 1.4 of zc.buildout
, it is possible to extend sections (except for the buildout
section) with the use of the special <
parameter. So, to create a macro, create a section with whatever you parameters you want in it, for example foo
:
[foo] bar = baz
Then create another section or sections such as foo1
and foo2
and set the <
parameter with the value of the section you want to copy:
[foo1] < = foo [foo2] < = foo
So foo1
and foo2
now contain:
bar = baz
You can now override and add whatever parameters you like:
[foo3] < = foo # bar gets bilge, instead of baz bar = bilge # car gets baz car = ${foo:bar}
And so on.
That means we can now define a base instance section (which we did in buildout.cfg
) and use it as a macro to create additional instance sections.
To demonstrate this, we will create two additional instances, based on the instance section in buildout.cfg
.
In 06-deployment-optimization-macros.cfg
, we have:
[buildout] extends...