Skip to content

Commit 0b36f8b

Browse files
committed
Rebase
2 parents 772310b + c3315c7 commit 0b36f8b

File tree

27 files changed

+848
-459
lines changed

27 files changed

+848
-459
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
python-version: ${{ matrix.python-version }}
142142
- name: "Setup environment"
143143
run: |
144-
pipx install poetry
144+
pipx install poetry==1.8.5
145145
poetry config virtualenvs.prefer-active-python true
146146
pip install invoke toml codecov
147147
- name: "Install Package"
@@ -192,7 +192,7 @@ jobs:
192192
python-version: "3.12"
193193
- name: "Setup environment"
194194
run: |
195-
pipx install poetry
195+
pipx install poetry==1.8.5
196196
poetry config virtualenvs.prefer-active-python true
197197
pip install invoke toml codecov
198198
- name: "Install Package"

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
- name: "Install Poetry"
4242
uses: "snok/install-poetry@v1"
4343
with:
44+
version: 1.8.5
4445
virtualenvs-create: true
4546
virtualenvs-in-project: true
4647
installer-parallel: true

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
- name: "Install Poetry"
3131
uses: "snok/install-poetry@v1"
3232
with:
33+
version: 1.8.5
3334
virtualenvs-create: true
3435
virtualenvs-in-project: true
3536
installer-parallel: true
@@ -56,7 +57,7 @@ jobs:
5657
| jq -r '.tag_name') >> "$GITHUB_OUTPUT"
5758
5859
- name: Check tag version
59-
if: github.event.release.tag_name != format('infrahub-v{0}', steps.release.outputs.version)
60+
if: github.event.release.tag_name != format('v{0}', steps.release.outputs.version)
6061
run: |
6162
echo "Tag version does not match python project version"
6263
exit 1

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang
1111

1212
<!-- towncrier release notes start -->
1313

14+
## [1.4.1](https://github.com/opsmill/infrahub-sdk-python/tree/v1.3.0) - 2025-01-05
15+
16+
### Fixed
17+
18+
- Fixes an issue introduced in 1.4 that would prevent a node with relationship of cardinality one from being updated.
19+
20+
## [1.4.0](https://github.com/opsmill/infrahub-sdk-python/tree/v1.4.0) - 2025-01-03
21+
22+
### Changed
23+
24+
- The inclusion of properties for Attribute and Relationships by default has been disabled when querying nodes from Infrahub.
25+
it can be enabled by using the parameter `property` in `client.get|all|filters` method ([#191](https://github.com/opsmill/infrahub-sdk-python/issues/191))
26+
- Fix an issue with python-transform-unit-process failing to run ([#198](https://github.com/opsmill/infrahub-sdk-python/issues/198))
27+
- Add processing of nodes when no variable are passed into the command to run generators ([#176](https://github.com/opsmill/infrahub-sdk-python/issues/176))
28+
1429
## [1.3.0](https://github.com/opsmill/infrahub-sdk-python/tree/v1.3.0) - 2024-12-30
1530

1631
### Added

changelog/191.changed.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

infrahub_sdk/branch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class BranchData(BaseModel):
4040

4141

4242
MUTATION_QUERY_DATA = {"ok": None, "object": BRANCH_DATA}
43+
MUTATION_QUERY_TASK = {"ok": None, "task": {"id": None}}
4344

4445
QUERY_ALL_BRANCHES_DATA = {"Branch": BRANCH_DATA}
4546

@@ -119,13 +120,14 @@ async def create(
119120
},
120121
}
121122

122-
query = Mutation(mutation="BranchCreate", input_data=input_data, query=MUTATION_QUERY_DATA)
123+
mutation_query = MUTATION_QUERY_TASK if background_execution else MUTATION_QUERY_DATA
124+
query = Mutation(mutation="BranchCreate", input_data=input_data, query=mutation_query)
123125
response = await self.client.execute_graphql(query=query.render(), tracker="mutation-branch-create")
124126

125127
# Make sure server version is recent enough to support background execution, as previously
126128
# using background_execution=True had no effect.
127129
if background_execution and "task" in response["BranchCreate"]:
128-
return BranchData(**response["BranchCreate"]["task"]["id"])
130+
return response["BranchCreate"]["task"]["id"]
129131
return BranchData(**response["BranchCreate"]["object"])
130132

131133
async def delete(self, branch_name: str) -> bool:

infrahub_sdk/checks.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@
1212

1313
from infrahub_sdk.repository import GitRepoManager
1414

15-
from .exceptions import InfrahubCheckNotFoundError, UninitializedError
15+
from .exceptions import UninitializedError
1616

1717
if TYPE_CHECKING:
18-
from pathlib import Path
19-
2018
from . import InfrahubClient
21-
from .schema.repository import InfrahubCheckDefinitionConfig
2219

2320
INFRAHUB_CHECK_VARIABLE_TO_IMPORT = "INFRAHUB_CHECKS"
2421

@@ -176,27 +173,3 @@ async def run(self, data: dict | None = None) -> bool:
176173
self.log_info("Check succesfully completed")
177174

178175
return self.passed
179-
180-
181-
def get_check_class_instance(
182-
check_config: InfrahubCheckDefinitionConfig, search_path: Path | None = None
183-
) -> InfrahubCheck:
184-
if check_config.file_path.is_absolute() or search_path is None:
185-
search_location = check_config.file_path
186-
else:
187-
search_location = search_path / check_config.file_path
188-
189-
try:
190-
spec = importlib.util.spec_from_file_location(check_config.class_name, search_location)
191-
module = importlib.util.module_from_spec(spec) # type: ignore[arg-type]
192-
spec.loader.exec_module(module) # type: ignore[union-attr]
193-
194-
# Get the specified class from the module
195-
check_class = getattr(module, check_config.class_name)
196-
197-
# Create an instance of the class
198-
check_instance = check_class()
199-
except (FileNotFoundError, AttributeError) as exc:
200-
raise InfrahubCheckNotFoundError(name=check_config.name) from exc
201-
202-
return check_instance

infrahub_sdk/client.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@
5858
from types import TracebackType
5959

6060

61-
# pylint: disable=redefined-builtin disable=too-many-lines
62-
6361
SchemaType = TypeVar("SchemaType", bound=CoreNode)
6462
SchemaTypeSync = TypeVar("SchemaTypeSync", bound=CoreNodeSync)
6563

@@ -711,7 +709,7 @@ async def filters(
711709
fragment=fragment,
712710
prefetch_relationships=prefetch_relationships,
713711
partial_match=partial_match,
714-
# property=property,
712+
property=property,
715713
)
716714
query = Query(query=query_data)
717715
response = await self.execute_graphql(
@@ -1147,7 +1145,7 @@ async def allocate_next_ip_address(
11471145
async def allocate_next_ip_address(
11481146
self,
11491147
resource_pool: CoreNode,
1150-
kind: type[SchemaType] | None = None, # pylint: disable=unused-argument
1148+
kind: type[SchemaType] | None = None, # noqa: ARG002
11511149
identifier: str | None = None,
11521150
prefix_length: int | None = None,
11531151
address_type: str | None = None,
@@ -1297,7 +1295,7 @@ async def allocate_next_ip_prefix(
12971295
async def allocate_next_ip_prefix(
12981296
self,
12991297
resource_pool: CoreNode,
1300-
kind: type[SchemaType] | None = None, # pylint: disable=unused-argument
1298+
kind: type[SchemaType] | None = None, # noqa: ARG002
13011299
identifier: str | None = None,
13021300
prefix_length: int | None = None,
13031301
member_type: str | None = None,
@@ -2181,7 +2179,7 @@ def allocate_next_ip_address(
21812179
def allocate_next_ip_address(
21822180
self,
21832181
resource_pool: CoreNodeSync,
2184-
kind: type[SchemaTypeSync] | None = None, # pylint: disable=unused-argument
2182+
kind: type[SchemaTypeSync] | None = None, # noqa: ARG002
21852183
identifier: str | None = None,
21862184
prefix_length: int | None = None,
21872185
address_type: str | None = None,
@@ -2327,7 +2325,7 @@ def allocate_next_ip_prefix(
23272325
def allocate_next_ip_prefix(
23282326
self,
23292327
resource_pool: CoreNodeSync,
2330-
kind: type[SchemaTypeSync] | None = None, # pylint: disable=unused-argument
2328+
kind: type[SchemaTypeSync] | None = None, # noqa: ARG002
23312329
identifier: str | None = None,
23322330
prefix_length: int | None = None,
23332331
member_type: str | None = None,

infrahub_sdk/ctl/branch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def create(
8383
sync_with_git: bool = typer.Option(
8484
False, help="Extend the branch to Git and have Infrahub create the branch in connected repositories."
8585
),
86-
isolated: bool = typer.Option(True, hidden=True, help="Set the branch to isolated mode (deprecated)"), # pylint: disable=unused-argument
86+
isolated: bool = typer.Option(True, hidden=True, help="Set the branch to isolated mode (deprecated)"), # noqa: ARG001
8787
_: str = CONFIG_PARAM,
8888
) -> None:
8989
"""Create a new branch."""

infrahub_sdk/ctl/cli_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def transform(
308308
None, help="Variables to pass along with the query. Format key=value key=value."
309309
),
310310
branch: str = typer.Option(None, help="Branch on which to run the transformation"),
311-
debug: bool = False,
311+
debug: bool = False, # noqa: ARG001
312312
_: str = CONFIG_PARAM,
313313
list_available: bool = typer.Option(False, "--list", help="Show available transforms"),
314314
out: str = typer.Option(None, help="Path to a file to save the result."),

0 commit comments

Comments
 (0)