Install driver¶
xcore_agent.agent.install_driver — filesystem install/snapshot/rollback,
plus the Supervisor and Provisioner protocols.
xcore_agent.agent.install_driver
¶
Executes individual install.yaml steps against a target host.
Filesystem operations (installing/configuring plugins, writing env files) are
implemented for real against a local directory layout. Process supervision
(start/stop/restart/healthcheck) is intentionally left as a Supervisor
protocol: which init system or orchestrator runs the actual processes
(systemd, Docker, Dockploy, k8s...) is the client's infrastructure choice,
not something xcore-agent should hardcode. NullSupervisor is provided for
tests and dry runs.
logger = logging.getLogger(__name__)
module-attribute
¶
Provisioner = Callable[[ProvisionStep], None]
module-attribute
¶
Notifier = Callable[[NotifyStep], None]
module-attribute
¶
Layout
dataclass
¶
On-disk layout for one deployed project.
Mirrors xcore's own convention of keeping secrets host-side, never inside
the artifact: <project_root>/plugins/<plugin>.env.
Source code in xcore_agent/agent/install_driver.py
project_root: Path
instance-attribute
¶
extracted_root: Path
instance-attribute
¶
plugins_dirname: str = 'plugins'
class-attribute
instance-attribute
¶
plugins_dir: Path
property
¶
snapshots_dir: Path
property
¶
extensions_dir: Path
property
¶
__init__(project_root: Path, extracted_root: Path, plugins_dirname: str = 'plugins') -> None
¶
plugin_dir(plugin_id: str) -> Path
¶
plugin_env_file(plugin_id: str) -> Path
¶
Supervisor
¶
Bases: Protocol
Source code in xcore_agent/agent/install_driver.py
NullSupervisor
¶
No-op supervisor for dry runs and tests.
Source code in xcore_agent/agent/install_driver.py
SnapshotRecord
dataclass
¶
Source code in xcore_agent/agent/install_driver.py
InstallDriver
¶
Executes filesystem-touching install.yaml steps for real, with
snapshot/rollback support for any step marked snapshot: true.
Source code in xcore_agent/agent/install_driver.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
layout = layout
instance-attribute
¶
manifest = manifest
instance-attribute
¶
__init__(layout: Layout, supervisor: Supervisor | None = None, *, provisioners: dict[str, Provisioner] | None = None, notifiers: dict[str, Notifier] | None = None, manifest: ProjectManifest | None = None, plugin_secret_key: bytes | None = None) -> None
¶
Source code in xcore_agent/agent/install_driver.py
snapshot_before(step_id: str, plugin_id: str, *, kind: str = 'plugin') -> None
¶
Source code in xcore_agent/agent/install_driver.py
rollback(*, to_step_id: str | None = None) -> None
¶
Restore snapshots in reverse order, optionally stopping once
to_step_id is reached (exclusive) instead of rolling back everything.
A step that had no prior state (fresh install) is undone by deleting
what it created, not by restoring a copy that never existed.
Source code in xcore_agent/agent/install_driver.py
provision(step: ProvisionStep) -> None
¶
Source code in xcore_agent/agent/install_driver.py
notify(step: NotifyStep) -> None
¶
Best-effort, unlike provision: notifying is a side channel, not
part of what makes a deployment succeed or fail (same reasoning as
MarketplaceClient.report_deployment — see its docstring) — a missing
or failing notifier is logged and swallowed, never raised.