Skip to content

Commit

Permalink
Merge pull request #4324 from opsmill/dga-stable-release-016
Browse files Browse the repository at this point in the history
Pull latest changes from stable into release-0.16 and resolve conflicts
  • Loading branch information
dgarros authored Sep 11, 2024
2 parents 0dad8bb + ac1e9c1 commit 70c08aa
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

git pull
invoke demo.start
invoke demo.start --wait
1 change: 1 addition & 0 deletions backend/infrahub/core/schema/definitions/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@
"attributes": [
{
"name": "name",
"regex": "^[^/]*$",
"kind": "Text",
"unique": True,
"branch": BranchSupportType.AGNOSTIC.value,
Expand Down
15 changes: 15 additions & 0 deletions backend/tests/integration/sdk/test_node_create_constraint.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from typing import Any, Dict

import pytest
Expand All @@ -7,6 +8,7 @@
from infrahub.core import registry
from infrahub.core.node import Node
from infrahub.database import InfrahubDatabase
from infrahub.exceptions import ValidationError
from tests.helpers.test_app import TestInfrahubApp

from ..shared import load_schema
Expand Down Expand Up @@ -287,3 +289,16 @@ async def test_step_03_add_node_failure(
await new_car.save()

assert "owner-nbr_seats" in exc.value.message

async def test_create_repository_with_slash_failure(self, db: InfrahubDatabase, initial_dataset):
repo = await Node.init(schema="CoreRepository", db=db)
with pytest.raises(
ValidationError, match=re.escape("repo/name must be conform with the regex: '^[^/]*$' at name")
):
await repo.new(db=db, name="repo/name", location="dummy")

repo = await Node.init(schema="CoreReadOnlyRepository", db=db)
with pytest.raises(
ValidationError, match=re.escape("repo/name must be conform with the regex: '^[^/]*$' at name")
):
await repo.new(db=db, name="repo/name", location="dummy")
2 changes: 1 addition & 1 deletion development/docker-compose-database-neo4j.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
test: wget http://localhost:7474 || exit 1
interval: 2s
timeout: 10s
retries: 20
retries: 40
start_period: 3s
labels:
infrahub_role: "database"
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ cd ~/source/infrahub/
Next, clone the `stable` branch of the Infrahub GitHub repository into the current directory. (This branch always holds the current stable release)

```bash
git clone -b stable --depth 1 git@github.com:opsmill/infrahub.git .
git clone -b stable --depth 1 https://github.com/opsmill/infrahub.git
```

:::note
Expand Down
5 changes: 3 additions & 2 deletions docs/docs/topics/schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The `kind` of a model is generated by concatenating the `namespace` and the `nam
- `TextArea`: Long-form Text that can span multiple lines
- `Boolean`: Flag that can be either True or False
- `DateTime`: A Data and a Time
- `Dropdown`: A list of choices, each choice can have a color and description
- `Email`: Email address
- `Password`: A Text String that should be obfuscated
- `URL`: An URL to a website or a resource over HTTP
Expand Down Expand Up @@ -186,8 +187,8 @@ Having a human friendly way to identify an object is very important to build rob

In the network industry:

- the `hfid` of a device will be could be its `name` : `atl1-edge01`
- the `hfid` of an interface will be the combination of the name of the device and the name of the interface: (`atl1-edge01`, `Ethernet1`)
- the `hfid` of a device could be its `name` : `atl1-edge01`
- the `hfid` of an interface could be the combination of the name of the device and the name of the interface: (`atl1-edge01`, `Ethernet1`)

:::

Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion python_sdk/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion python_sdk/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "infrahub-sdk"
version = "0.13.0b1"
version = "0.13.0"
description = "Python Client to interact with Infrahub"
authors = ["OpsMill <info@opsmill.com>"]
readme = "README.md"
Expand Down
7 changes: 3 additions & 4 deletions tasks/container_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ def show_service_status(context: Context, database: str, namespace: str) -> None
execute_command(context=context, command=command)


def start_services(context: Context, database: str, namespace: str) -> None:
def start_services(context: Context, database: str, namespace: str, wait: bool) -> None:
with context.cd(ESCAPED_REPO_PATH):
compose_files_cmd = build_compose_files_cmd(database=database, namespace=namespace)
command = (
f"{get_env_vars(context, namespace=namespace)} docker compose {compose_files_cmd} -p {BUILD_NAME} up -d"
)
should_wait = " --wait" if wait else ""
command = f"{get_env_vars(context, namespace=namespace)} docker compose {compose_files_cmd} -p {BUILD_NAME} up -d{should_wait}"
execute_command(context=context, command=command)


Expand Down
4 changes: 2 additions & 2 deletions tasks/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def pull(context: Context, database: str = INFRAHUB_DATABASE):


@task(optional=["database"])
def start(context: Context, database: str = INFRAHUB_DATABASE):
def start(context: Context, database: str = INFRAHUB_DATABASE, wait: bool = False):
"""Start a local instance of Infrahub within docker compose."""
start_services(context=context, database=database, namespace=NAMESPACE)
start_services(context=context, database=database, namespace=NAMESPACE, wait=wait)


@task(optional=["database"])
Expand Down
4 changes: 2 additions & 2 deletions tasks/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ def status(context: Context, database: str = INFRAHUB_DATABASE):


@task(optional=["database"])
def start(context: Context, database: str = INFRAHUB_DATABASE):
def start(context: Context, database: str = INFRAHUB_DATABASE, wait: bool = False):
"""Start a local instance of Infrahub within docker compose."""
start_services(context=context, database=database, namespace=NAMESPACE)
start_services(context=context, database=database, namespace=NAMESPACE, wait=wait)


@task(optional=["database"])
Expand Down

0 comments on commit 70c08aa

Please sign in to comment.