Upgrade pydantic to >=2.4.2 (to match the version where the cause of the issue was located).
Convert code via bump-pydantic to upgrade from v1 to v2 of Pydantic.
Work-around issues regarding _max_workspace_events (of type pydantic.fields.ModelPrivateAttr) not being coerced to an int anymore as part of the deque(..., maxlen=cls._max_workspace_events) return value from WorkspaceEvents.validate_events() by using cls._max_workspace_events.default, and specifying # type: ignore to silence VSCode thinking it's not valid.
Cause spawning issue:
11:55:44 + exec boardwalk init --limit
11:55:44 Traceback (most recent call last):
11:55:44 File "/home/****/.local/bin/boardwalk", line 5, in <module>
11:55:44 from boardwalk.cli import cli
11:55:44 File "/home/****/.local/lib/python3.10/site-packages/boardwalk/__init__.py", line 5, in <module>
11:55:44 from .manifest import (
11:55:44 File "/home/****/.local/lib/python3.10/site-packages/boardwalk/manifest.py", line 15, in <module>
11:55:44 from boardwalk.state import LocalState
11:55:44 File "/home/****/.local/lib/python3.10/site-packages/boardwalk/state.py", line 6, in <module>
11:55:44 from boardwalk.host import Host
11:55:44 File "/home/****/.local/lib/python3.10/site-packages/boardwalk/host.py", line 25, in <module>
11:55:44 class Host(BaseModel, extra=Extra.forbid):
11:55:44 File "/home/****/.local/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 104, in __new__
11:55:44 private_attributes = inspect_namespace(
11:55:44 File "/home/****/.local/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 370, in inspect_namespace
11:55:44 raise PydanticUserError(
11:55:44 pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `remote_mutex_path = '/opt/boardwalk.mutex'`. All model fields require a type annotation; if `remote_mutex_path` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.
11:55:44
11:55:44 For further information visit https://errors.pydantic.dev/2.4/u/model-field-missing-annotation
Main required change: add str type hint to Host class in boardwalk/host.py:
remote_mutex_path: str = "/opt/boardwalk.mutex"
remote_alert_msg: str = "ALERT: Boardwalk is running a workflow against this host. Services may be interrupted"
remote_alert_string_formatted: str = f"$(tput -T xterm bold)$(tput -T xterm setaf 1)'{remote_alert_msg}'$(tput -T xterm sgr0)"
remote_alert_motd: str = f"#!/bin/sh\necho {remote_alert_string_formatted}"
remote_alert_motd_path: str = "/etc/update-motd.d/99-boardwalk-alert"
remote_alert_wall_cmd: str = f"wall {remote_alert_string_formatted}"
Relates to #57.
bump-pydantic
to upgrade from v1 to v2 of Pydantic._max_workspace_events
(of typepydantic.fields.ModelPrivateAttr
) not being coerced to anint
anymore as part of thedeque(..., maxlen=cls._max_workspace_events)
return value fromWorkspaceEvents.validate_events()
by usingcls._max_workspace_events.default
, and specifying# type: ignore
to silence VSCode thinking it's not valid.Cause spawning issue:
Main required change: add
str
type hint toHost
class inboardwalk/host.py
: