Skip to content

Commit cb4e0ff

Browse files
authored
Merge pull request #204 from opsmill/develop
Pre Release
2 parents cc8fbf9 + ce2570d commit cb4e0ff

File tree

5 files changed

+247
-192
lines changed

5 files changed

+247
-192
lines changed

docs/_templates/readme.mdx.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ These are the plugins in the `opsmill.infrahub` collection:
3030

3131
<!-- vale off -->
3232
{% for plugin in plugins.modules %}
33-
* [{{ plugin.name }}](./references/plugins/{{ plugin.name }}_module){% if plugin.documentation.get('short_description') %} – {{ plugin.documentation.get('short_description') }}{% endif %}
33+
* [{{ plugin.name }}](./references/plugins/{{ plugin.name }}_module.mdx){% if plugin.documentation.get('short_description') %} – {{ plugin.documentation.get('short_description') }}{% endif %}
3434
{%- endfor %}
3535

3636
<!-- vale on -->
3737

3838
#### Inventory
3939

40-
{% for plugin in plugins.inventory %}* [{{ plugin.name }}](./references/plugins/{{ plugin.name }}_inventory){% if plugin.documentation.get('short_description') %} – {{ plugin.documentation.get('short_description') }}{% endif %}{% endfor %}
40+
{% for plugin in plugins.inventory %}* [{{ plugin.name }}](./references/plugins/{{ plugin.name }}_inventory.mdx){% if plugin.documentation.get('short_description') %} – {{ plugin.documentation.get('short_description') }}{% endif %}{% endfor %}
4141

4242
#### Lookup
4343

44-
{% for plugin in plugins.lookup %}* [{{ plugin.name }}](./references/plugins/{{ plugin.name }}_lookup){% if plugin.documentation.get('short_description') %} – {{ plugin.documentation.get('short_description') }}{% endif %}{% endfor %}
44+
{% for plugin in plugins.lookup %}* [{{ plugin.name }}](./references/plugins/{{ plugin.name }}_lookup.mdx){% if plugin.documentation.get('short_description') %} – {{ plugin.documentation.get('short_description') }}{% endif %}{% endfor %}
4545

4646
### Roles
4747

4848
These are the roles in the `opsmill.infrahub` collection:
4949

50-
{% for role in roles %}* [{{ role.name }}](./references/roles/{{ role.name }}){% if role.description %} – {{ role.description }}{% endif %}{% endfor %}
50+
{% for role in roles %}* [{{ role.name }}](./references/roles/{{ role.name }}.mdx){% if role.description %} – {{ role.description }}{% endif %}{% endfor %}

plugins/module_utils/infrahub_utils.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
InfrahubNodeSync,
2323
RelatedNodeSync,
2424
RelationshipManagerSync,
25-
generate_relationship_property,
2625
)
2726
from infrahub_sdk.schema import (
2827
GenericSchemaAPI,
@@ -1092,29 +1091,35 @@ def _update_object(self, data: dict) -> tuple[InfrahubNodeSync, dict]:
10921091
# https://github.com/opsmill/infrahub-sdk-python/issues/272
10931092
for attr_name in data:
10941093
if attr_name in tmp_obj._schema.attribute_names:
1095-
attr_schema = next(attr for attr in tmp_obj._schema.attributes if attr.name == attr_name)
1094+
attr_schema = next(attr for attr in self.infrahub_node._schema.attributes if attr.name == attr_name)
10961095
attr_data = data.get(attr_name)
10971096
new_attr = Attribute(name=attr_name, schema=attr_schema, data=attr_data)
10981097
setattr(tmp_obj, attr_name, new_attr)
10991098
elif attr_name in tmp_obj._schema.relationship_names:
1100-
rel_schema = next(rel for rel in self._schema.relationships if rel.name == attr_name)
1099+
rel_schema = next(rel for rel in self.infrahub_node._schema.relationships if rel.name == attr_name)
11011100
rel_data = data.get(attr_name)
11021101
if rel_schema.cardinality == RelationshipCardinality.ONE:
11031102
setattr(tmp_obj, f"_{attr_name}", None)
11041103
setattr(
11051104
tmp_obj,
11061105
attr_name,
1107-
generate_relationship_property(name=attr_name, node=tmp_obj),
1106+
RelatedNodeSync(
1107+
name=attr_name,
1108+
client=self.infrahub_node._client,
1109+
branch=self.infrahub_node._branch,
1110+
schema=rel_schema,
1111+
data=rel_data,
1112+
),
11081113
)
11091114
elif rel_schema.cardinality == RelationshipCardinality.MANY:
11101115
setattr(
11111116
tmp_obj,
11121117
attr_name,
11131118
RelationshipManagerSync(
11141119
name=attr_name,
1115-
client=tmp_obj._client,
1120+
client=self.infrahub_node._client,
11161121
node=tmp_obj,
1117-
branch=tmp_obj._branch,
1122+
branch=self.infrahub_node._branch,
11181123
schema=rel_schema,
11191124
data=rel_data,
11201125
),

0 commit comments

Comments
 (0)