You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function `stub` yields the value of a dedicated field found in the first upstream stub defining it.
1308
+
1309
+
e.g.:
1310
+
1311
+
**template.yml**
1312
+
```yaml
1313
+
value: (( stub(foo.bar) ))
1314
+
```
1315
+
merged with stub
1316
+
1317
+
**stub.yml**
1318
+
```yaml
1319
+
foo:
1320
+
bar: foobar
1321
+
```
1322
+
1323
+
evaluates to
1324
+
1325
+
```yaml
1326
+
value: foobar
1327
+
```
1328
+
1329
+
The argument passed to this function must either be a reference literal or an expression evaluating to a string denoting a reference. If no argument is given, the actual field path is used.
1330
+
1331
+
Alternatively the `merge` operation could be used, for example `merge foo.bar`. The difference is that `stub` does not merge, therefore the field will still be merged (with the original path in the document).
1332
+
1333
+
1159
1334
### `(( exec( "command", arg1, arg2) ))`
1160
1335
1161
1336
Execute a command. Arguments can be any dynaml expressions including reference expressions evaluated to lists or maps. Lists or maps are passed as single arguments containing a yaml document with the given fragment.
@@ -1382,6 +1557,41 @@ networks:
1382
1557
static_ips: (( static_ips([1..5]) ))
1383
1558
```
1384
1559
1560
+
### `(( ipset(ranges, 3, 3,4,5,6) ))`
1561
+
1562
+
While the function [static_ips](#-static_ips0-1-3-) for historical reasons
1563
+
relies on the structure of a bosh manifest
1564
+
and works only at dedicated locations in the manifest, the function *ipset*
1565
+
offers a similar calculation purely based on its arguments. So, the available
1566
+
ip ranges and the required numbers of IPs are passed as arguments.
1567
+
1568
+
The first (ranges) argument can be a single range as a simple string or a
1569
+
list of strings. Every string might be
1570
+
- a single IP address
1571
+
- an explicit IP range described by two IP addresses separated by a dash (-)
1572
+
- a CIDR
1573
+
1574
+
The second argument specifies the requested number of IP addresses in the
1575
+
result set.
1576
+
1577
+
The additional arguments specify the indices of the IPs to choose (starting
1578
+
from 0) in the given ranges. Here again lists of indices might be used.
1579
+
1580
+
e.g.:
1581
+
1582
+
```yaml
1583
+
ranges:
1584
+
- 10.0.0.0 - 10.0.0.255
1585
+
- 10.0.2.0/24
1586
+
ipset: (( ipset(ranges,3,[256..260]) ))
1587
+
```
1588
+
1589
+
resolves *ipset* to `[ 10.0.2.0, 10.0.2.1, 10.0.2.2 ]`.
1590
+
1591
+
If no IP indices are specified (only two arguments), the IPs are chosen
1592
+
starting from the beginning of the first range up to the end of the last
1593
+
given range, without indirection.
1594
+
1385
1595
### `(( list_to_map(list, "key") ))`
1386
1596
1387
1597
A list of map entries with explicit name/key fields will be mapped to a map with the dedicated keys. By default the key field `name` is used, which can changed by the optional second argument. An explicitly denoted key field in the list will also be taken into account.
@@ -1602,6 +1812,10 @@ data:
1602
1812
1603
1813
The temporary marker can be combined with the [template marker](#templates) to omit templates from the final output.
1604
1814
1815
+
The marker `&local` acts similar to `&temporary` but local nodes are always
1816
+
removed from a stub directly after resolving dynaml expressions. Such nodes
1817
+
are therefore not available for merging.
1818
+
1605
1819
## Mappings
1606
1820
1607
1821
Mappings are used to produce a new list from the entries of a _list_ or _map_ containing the entries processed by a dynaml expression. The expression is given by a [lambda function](#-lambda-x-x--port-). There are two basic forms of the mapping function: It can be inlined as in `(( map[list|x|->x ":" port] ))`, or it can be determined by a regular dynaml expression evaluating to a lambda function as in `(( map[list|mapping.expression))` (here the mapping is taken from the property `mapping.expression`, which should hold an approriate lambda function).
0 commit comments