Skip to content

Commit

Permalink
Merge pull request #1352 from cole-h/deploy-boot
Browse files Browse the repository at this point in the history
Add --boot flag to deploy and correct ratchet script
  • Loading branch information
adisbladis committed Jun 11, 2020
2 parents cbda25d + 9ec1efc commit ebc78be
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ci/mypy-ratchet.sh
Expand Up @@ -17,7 +17,7 @@ base=origin/${GITHUB_BASE_REF:-master}

git fetch origin

echo "Checking base branch at %s, then PR at %s...\n" "$base" "$head"
printf "Checking base branch at %s, then PR at %s...\n" "$base" "$head"

git checkout "$base"
nix-shell shell.nix --run "$scratch/run-ratchet.sh $scratch base"
Expand Down
5 changes: 5 additions & 0 deletions nixops/__main__.py
Expand Up @@ -209,6 +209,11 @@ def hook(_type: Type[BaseException], value: BaseException, tb: TracebackType):
action="store_true",
help="build and activate the new configuration; do not enable it in the bootloader. Rebooting the system will roll back automatically.",
)
subparser.add_argument(
"--boot",
action="store_true",
help="build the new configuration and enable it in the bootloader; do not activate it. Upon reboot, the system will use the new configuration.",
)
subparser.add_argument(
"--repair", action="store_true", help="use --repair when calling nix-build (slow)"
)
Expand Down
6 changes: 5 additions & 1 deletion nixops/deployment.py
Expand Up @@ -860,6 +860,7 @@ def activate_configs( # noqa: C901
always_activate: bool,
dry_activate: bool,
test: bool,
boot: bool,
max_concurrent_activate: int,
) -> None:
"""Activate the new configuration on a machine."""
Expand Down Expand Up @@ -902,7 +903,7 @@ def set_profile():

m.send_keys()

if force_reboot or m.state == m.RESCUE:
if boot or force_reboot or m.state == m.RESCUE:
switch_method = "boot"
elif dry_activate:
switch_method = "dry-activate"
Expand Down Expand Up @@ -1144,6 +1145,7 @@ def _deploy( # noqa: C901
self,
dry_run: bool = False,
test: bool = False,
boot: bool = False,
plan_only: bool = False,
build_only: bool = False,
create_only: bool = False,
Expand Down Expand Up @@ -1321,6 +1323,7 @@ def worker(r: nixops.resources.GenericResourceState):
always_activate=always_activate,
dry_activate=dry_activate,
test=test,
boot=boot,
max_concurrent_activate=max_concurrent_activate,
)

Expand Down Expand Up @@ -1449,6 +1452,7 @@ def _rollback(
always_activate=True,
dry_activate=False,
test=False,
boot=False,
max_concurrent_activate=max_concurrent_activate,
)

Expand Down
1 change: 1 addition & 0 deletions nixops/script_defs.py
Expand Up @@ -588,6 +588,7 @@ def op_deploy(args):
depl.deploy(
dry_run=args.dry_run,
test=args.test,
boot=args.boot,
build_only=args.build_only,
plan_only=args.plan_only,
create_only=args.create_only,
Expand Down

0 comments on commit ebc78be

Please sign in to comment.