refactor(backend): pass Bottle to provisioners instead of target #179
Reference in New Issue
Block a user
Delete Branch "issue-178-bottle-provision"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #178.
Summary
BottleBackend.provisionand everyprovision_*sub-method now receive aBottlehandle instead of a rawtarget: str. Provisioner modules usebottle.exec/bottle.cp_inin place of inlinedsubprocess.run(["docker", "exec"/"cp", ...])calls (docker backend) and direct_smolvm.machine_cp/machine_execcalls (smolmachines backend).launch.pyconstructs theBottlehandle before callingprovision; the in-container prompt path returned byprovision_promptis wired back onto the bottle's_prompt_pathafter provisioning completes.Changes (1 commit)
bot_bottle/backend/__init__.py—BottleBackend.provision*signatures takebottle: Bottle.bot_bottle/backend/{docker,smolmachines}/backend.py— delegate to provisioner modules with the bottle.bot_bottle/backend/{docker,smolmachines}/launch.py— build the bottle before provision, set prompt path after.bot_bottle/backend/docker/provision/*.py— usebottle.exec/bottle.cp_in(chmod + chown folded into single shell scripts where the original ran them as back-to-back execs).bot_bottle/backend/smolmachines/provision/*.py— same;_install_canow takes aBottleand returns the bottle'sExecResultdirectly. The smolmachinesgit_userprovisioner drops the manualrunuser/env HOME=...plumbing sinceSmolmachinesBottle.exec(user="node")already handles uid switch + HOME wiring.tests/unit/test_{docker_provision_git_user,docker_provision_provider_auth,smolmachines_provision}.py— assert onbottle.exec/bottle.cp_inmocks instead of rawsubprocess.run/_smolvmpatches.Test plan
python3 -m unittest discover tests/unit— 844 tests passstartrun end-to-end (covered by canaries on merge)starton macOS (covered by smolmachines smoke on merge)