Skip to content

Commit d9bfef9

Browse files
authored
Merge pull request #365 from opsmill/stable
Merge stable into develop
2 parents 7b264c2 + f3a6b8d commit d9bfef9

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

docs/_templates/sdk_template_reference.j2

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,15 @@ The following Jinja2 filters from <a href="https://netutils.readthedocs.io">Netu
2525
| {{ filter.name }} | {% if filter.trusted %}{% else %}{% endif %} |
2626
{% endfor %}
2727
<!-- vale on -->
28+
29+
## Known issues
30+
31+
### Unable to combine the map and sort filters (https://github.com/pallets/jinja/issues/2081)
32+
33+
When using the `map` filter with the `sort` filter, you may encounter the following error:
34+
35+
```python
36+
TypeError: 'async_generator' object is not iterable
37+
```
38+
39+
**As a workaround you can use the `list` filter between `map` and `sort` filter.**

docs/docs/python-sdk/guides/create_update_delete.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ nodes:
6767
6868
A node can be created using the `create` method. The `create` method will first construct a `InfrahubNode` object in memory. This `InfrahubNode` object will then need to be saved into Infrahub using the `save` method.
6969

70-
The attributes and relationships of the `InfrahubNode` you want to create can be passed as arguments to the `create` method, or you can pass then using a dictionary.
70+
The attributes and relationships of the `InfrahubNode` you want to create can be passed as arguments to the `create` method, or you can pass them using a dictionary.
7171

7272
<Tabs groupId="async-sync">
7373
<TabItem value="Async" default>
@@ -138,7 +138,7 @@ The attributes and relationships of the `InfrahubNode` you want to create can be
138138
<TabItem value="Async" default>
139139

140140
```python
141-
interfaces = await client.get(kind="TestInterface", name__values=["Ethernet1", "Ethernet2"])
141+
interfaces = await client.filters(kind="TestInterface", name__values=["Ethernet1", "Ethernet2"])
142142
device = await client.create(kind="TestDevice", name="atl1-edge1", interfaces=interfaces)
143143
await device.save()
144144
```
@@ -147,7 +147,7 @@ The attributes and relationships of the `InfrahubNode` you want to create can be
147147
<TabItem value="Sync" default>
148148

149149
```python
150-
interfaces = client.get(kind="TestInterface", name__values=["Ethernet1", "Ethernet2"])
150+
interfaces = client.filters(kind="TestInterface", name__values=["Ethernet1", "Ethernet2"])
151151
device = client.create(kind="TestDevice", name="atl1-edge1", interfaces=interfaces)
152152
device.save()
153153
```
@@ -222,7 +222,7 @@ Adding a single relation:
222222
<TabItem value="Sync" default>
223223

224224
```python
225-
interface = client.get(kind="TestInterface", name__values="Ethernet1")
225+
interface = client.get(kind="TestInterface", name__value="Ethernet1")
226226
device = client.get(kind="TestDevice", name__value="atl1-edge1")
227227
device.interfaces.add(interface)
228228
device.save()
@@ -236,7 +236,7 @@ Adding multiple relations:
236236
<TabItem value="Async" default>
237237

238238
```python
239-
interfaces = await client.filters(kind="TestInterface", name__value=["Ethernet1", "Ethernet2"])
239+
interfaces = await client.filters(kind="TestInterface", name__values=["Ethernet1", "Ethernet2"])
240240
device = await client.get(kind="TestDevice", name__value="atl1-edge1")
241241
device.interfaces.extend(interfaces)
242242
await device.save()
@@ -246,7 +246,7 @@ Adding multiple relations:
246246
<TabItem value="Sync" default>
247247

248248
```python
249-
interfaces = client.filters(kind="TestInterface", name__value=["Ethernet1", "Ethernet2"])
249+
interfaces = client.filters(kind="TestInterface", name__values=["Ethernet1", "Ethernet2"])
250250
device = client.get(kind="TestDevice", name__value="atl1-edge1")
251251
device.interfaces.extend(interfaces)
252252
device.save()

docs/docs/python-sdk/reference/templating.mdx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,16 @@ The following Jinja2 filters from <a href="https://netutils.readthedocs.io">Netu
150150
| vlanconfig_to_list | |
151151
| vlanlist_to_config | |
152152
| wildcardmask_to_netmask | |
153-
<!-- vale on -->
153+
<!-- vale on -->
154+
155+
## Known issues
156+
157+
### Unable to combine the map and sort filters (https://github.com/pallets/jinja/issues/2081)
158+
159+
When using the `map` filter with the `sort` filter, you may encounter the following error:
160+
161+
```python
162+
TypeError: 'async_generator' object is not iterable
163+
```
164+
165+
**As a workaround you can use the `list` filter between `map` and `sort` filter.**

0 commit comments

Comments
 (0)