Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang

<!-- towncrier release notes start -->

## [1.20.1](https://github.com/opsmill/infrahub-sdk-python/tree/v1.20.1) - 2026-05-20

### Added

- Added SHA-1 idempotency primitives for `CoreFileObject` nodes:

- `InfrahubNode.matches_local_checksum(source)` / sync variant — compare a local `bytes | Path | BinaryIO` source against the node's server-stored checksum without invoking a transfer.
- `InfrahubNode.upload_if_changed(source, name=None)` / sync variant — stage + save only when the local source differs from the server, returning an `UploadResult(was_uploaded, checksum)` dataclass.
- `download_file(..., skip_if_unchanged=True)` — short-circuit the download when `dest` already exists on disk with a matching SHA-1. Returns `0` bytes written when skipped.

A shared `sha1_of_source` helper (streaming, 64 KiB chunks) centralises the hashing convention in `infrahub_sdk.file_handler`.

### Fixed

- Skip mandatory field validation during object loading when `object_profile` is specified. ([#908](https://github.com/opsmill/infrahub-sdk-python/issues/908))
- Render schema rejections originating in an `extensions:` block as a readable one-line message in `infrahubctl schema load`, instead of crashing with `ValueError: invalid literal for int()`. ([#1007](https://github.com/opsmill/infrahub-sdk-python/issues/1007))
- Add `MERGING` branch status so that a merging branch can still be correctly retrieved. ([#1037](https://github.com/opsmill/infrahub-sdk-python/issues/1037))

## [1.20.0](https://github.com/opsmill/infrahub-sdk-python/tree/v1.20.0) - 2026-04-24

### Removed
Expand Down
7 changes: 0 additions & 7 deletions changelog/+idempotent-file-ops.added.md

This file was deleted.

1 change: 0 additions & 1 deletion changelog/1007.fixed.md

This file was deleted.

1 change: 1 addition & 0 deletions changelog/224.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change default value of `sync_with_git` parameter in `branch.create()` from `True` to `False` to match UI behavior.
1 change: 0 additions & 1 deletion changelog/908.fixed.md

This file was deleted.

56 changes: 28 additions & 28 deletions docs/docs/infrahubctl/infrahubctl-branch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,28 @@ $ infrahubctl branch [OPTIONS] COMMAND [ARGS]...

**Commands**:

* `list`: List all existing branches.
* `create`: Create a new branch.
* `delete`: Delete a branch.
* `list`: List all existing branches.
* `merge`: Merge a Branch with main.
* `rebase`: Rebase a Branch with main.
* `report`: Generate branch cleanup status report.
* `merge`: Merge a Branch with main.
* `validate`: Validate if a branch has some conflict and...
* `report`: Generate branch cleanup status report.

## `infrahubctl branch list`

List all existing branches.

**Usage**:

```console
$ infrahubctl branch list [OPTIONS]
```

**Options**:

* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl branch create`

Expand Down Expand Up @@ -66,16 +81,20 @@ $ infrahubctl branch delete [OPTIONS] BRANCH_NAME
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl branch list`
## `infrahubctl branch rebase`

List all existing branches.
Rebase a Branch with main.

**Usage**:

```console
$ infrahubctl branch list [OPTIONS]
$ infrahubctl branch rebase [OPTIONS] BRANCH_NAME
```

**Arguments**:

* `BRANCH_NAME`: [required]

**Options**:

* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
Expand All @@ -100,14 +119,14 @@ $ infrahubctl branch merge [OPTIONS] BRANCH_NAME
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl branch rebase`
## `infrahubctl branch validate`

Rebase a Branch with main.
Validate if a branch has some conflict and is passing all the tests (NOT IMPLEMENTED YET).

**Usage**:

```console
$ infrahubctl branch rebase [OPTIONS] BRANCH_NAME
$ infrahubctl branch validate [OPTIONS] BRANCH_NAME
```

**Arguments**:
Expand Down Expand Up @@ -138,22 +157,3 @@ $ infrahubctl branch report [OPTIONS] BRANCH_NAME
* `--update-diff`: Update diff before generating report
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl branch validate`

Validate if a branch has some conflict and is passing all the tests (NOT IMPLEMENTED YET).

**Usage**:

```console
$ infrahubctl branch validate [OPTIONS] BRANCH_NAME
```

**Arguments**:

* `BRANCH_NAME`: [required]

**Options**:

* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.
124 changes: 62 additions & 62 deletions docs/docs/infrahubctl/infrahubctl-object.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,53 @@ $ infrahubctl object [OPTIONS] COMMAND [ARGS]...

**Commands**:

* `get`: Query and display Infrahub objects.
* `create`: Create a new object in Infrahub.
* `update`: Update an existing object in Infrahub.
* `delete`: Delete an Infrahub object.
* `get`: Query and display Infrahub objects.
* `load`: Load one or multiple objects files into...
* `update`: Update an existing object in Infrahub.
* `validate`: Validate one or multiple objects files.

## `infrahubctl object get`

Query and display Infrahub objects.

When IDENTIFIER is omitted the command lists all objects of the given
KIND. When IDENTIFIER is provided it displays a single object in
detail view. Empty columns are hidden by default (use --all-columns).

Examples:
infrahubctl object get InfraDevice
infrahubctl object get InfraDevice spine01
infrahubctl object get InfraDevice --filter name__value=spine01
infrahubctl object get InfraDevice --output json
infrahubctl object get InfraDevice --output yaml &gt; backup.yml

Exit codes: 0 = results found, 1 = error (including not found in detail
mode), 80 = list query succeeded but returned zero objects.

**Usage**:

```console
$ infrahubctl object get [OPTIONS] KIND [IDENTIFIER]
```

**Arguments**:

* `KIND`: Infrahub schema kind to query [required]
* `[IDENTIFIER]`: UUID, name, or HFID (use / for multi-part, for example: Cisco/NX-OS)

**Options**:

* `--filter TEXT`: Filter in attr__value=x format
* `-o, --output [table|json|csv|yaml]`: Output format
* `-b, --branch TEXT`: Target branch
* `--limit INTEGER`: Maximum results
* `--offset INTEGER`: Skip first N results
* `--all-columns`: Show all columns including empty ones
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl object create`

Create a new object in Infrahub.
Expand Down Expand Up @@ -53,21 +93,22 @@ $ infrahubctl object create [OPTIONS] KIND
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl object delete`
## `infrahubctl object update`

Delete an Infrahub object.
Update an existing object in Infrahub.

Fetches the object by KIND and IDENTIFIER, then deletes it.
Unless --yes is provided, a confirmation prompt is shown first.
Fetches the object by KIND and IDENTIFIER, applies the requested
changes, and saves back to the server. Use --set or --file.

Examples:
infrahubctl object delete InfraDevice spine01
infrahubctl object delete InfraDevice spine01 --yes
infrahubctl object update InfraDevice spine01 --set status=active
infrahubctl object update InfraDevice spine01 --set location=DC1
infrahubctl object update InfraDevice spine01 --file updates.yml

**Usage**:

```console
$ infrahubctl object delete [OPTIONS] KIND IDENTIFIER
$ infrahubctl object update [OPTIONS] KIND IDENTIFIER
```

**Arguments**:
Expand All @@ -77,48 +118,38 @@ $ infrahubctl object delete [OPTIONS] KIND IDENTIFIER

**Options**:

* `-y, --yes`: Skip confirmation prompt
* `--set TEXT`: Field value in key=value format
* `-f, --file PATH`: JSON or YAML file with update data
* `-b, --branch TEXT`: Target branch
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl object get`
## `infrahubctl object delete`

Query and display Infrahub objects.
Delete an Infrahub object.

When IDENTIFIER is omitted the command lists all objects of the given
KIND. When IDENTIFIER is provided it displays a single object in
detail view. Empty columns are hidden by default (use --all-columns).
Fetches the object by KIND and IDENTIFIER, then deletes it.
Unless --yes is provided, a confirmation prompt is shown first.

Examples:
infrahubctl object get InfraDevice
infrahubctl object get InfraDevice spine01
infrahubctl object get InfraDevice --filter name__value=spine01
infrahubctl object get InfraDevice --output json
infrahubctl object get InfraDevice --output yaml > backup.yml

Exit codes: 0 = results found, 1 = error (including not found in detail
mode), 80 = list query succeeded but returned zero objects.
infrahubctl object delete InfraDevice spine01
infrahubctl object delete InfraDevice spine01 --yes

**Usage**:

```console
$ infrahubctl object get [OPTIONS] KIND [IDENTIFIER]
$ infrahubctl object delete [OPTIONS] KIND IDENTIFIER
```

**Arguments**:

* `KIND`: Infrahub schema kind to query [required]
* `[IDENTIFIER]`: UUID, name, or HFID (use / for multi-part, for example: Cisco/NX-OS)
* `KIND`: Infrahub schema kind [required]
* `IDENTIFIER`: UUID, name, or HFID (use / for multi-part, for example: Cisco/NX-OS) [required]

**Options**:

* `--filter TEXT`: Filter in attr__value=x format
* `-o, --output [table|json|csv|yaml]`: Output format
* `-y, --yes`: Skip confirmation prompt
* `-b, --branch TEXT`: Target branch
* `--limit INTEGER`: Maximum results
* `--offset INTEGER`: Skip first N results
* `--all-columns`: Show all columns including empty ones
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

Expand All @@ -143,37 +174,6 @@ $ infrahubctl object load [OPTIONS] PATHS...
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl object update`

Update an existing object in Infrahub.

Fetches the object by KIND and IDENTIFIER, applies the requested
changes, and saves back to the server. Use --set or --file.

Examples:
infrahubctl object update InfraDevice spine01 --set status=active
infrahubctl object update InfraDevice spine01 --set location=DC1
infrahubctl object update InfraDevice spine01 --file updates.yml

**Usage**:

```console
$ infrahubctl object update [OPTIONS] KIND IDENTIFIER
```

**Arguments**:

* `KIND`: Infrahub schema kind [required]
* `IDENTIFIER`: UUID, name, or HFID (use / for multi-part, for example: Cisco/NX-OS) [required]

**Options**:

* `--set TEXT`: Field value in key=value format
* `-f, --file PATH`: JSON or YAML file with update data
* `-b, --branch TEXT`: Target branch
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl object validate`

Validate one or multiple objects files.
Expand Down
20 changes: 10 additions & 10 deletions docs/docs/infrahubctl/infrahubctl-repository.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ $ infrahubctl repository [OPTIONS] COMMAND [ARGS]...
**Commands**:

* `add`: Add a new repository.
* `init`: Initialize a new Infrahub repository.
* `list`
* `init`: Initialize a new Infrahub repository.

## `infrahubctl repository add`

Expand Down Expand Up @@ -48,31 +48,31 @@ $ infrahubctl repository add [OPTIONS] NAME LOCATION
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl repository init`

Initialize a new Infrahub repository.
## `infrahubctl repository list`

**Usage**:

```console
$ infrahubctl repository init [OPTIONS]
$ infrahubctl repository list [OPTIONS]
```

**Options**:

* `--branch TEXT`: Branch on which to list repositories.
* `--debug / --no-debug`: [default: no-debug]
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.

## `infrahubctl repository list`
## `infrahubctl repository init`

Initialize a new Infrahub repository.

**Usage**:

```console
$ infrahubctl repository list [OPTIONS]
$ infrahubctl repository init [OPTIONS]
```

**Options**:

* `--branch TEXT`: Branch on which to list repositories.
* `--debug / --no-debug`: [default: no-debug]
* `--config-file TEXT`: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
* `--help`: Show this message and exit.
Loading