forked from hswaw/hscloud
Merge "clustercfg: show diff before switching to new configuration"
commit
bfe2fe6455
|
@ -205,8 +205,7 @@ def nodestrap(args, nocerts=False):
|
||||||
subprocess.check_call(["nix", "run",
|
subprocess.check_call(["nix", "run",
|
||||||
"-f", os.path.join(local_root, "cluster/nix/default.nix"),
|
"-f", os.path.join(local_root, "cluster/nix/default.nix"),
|
||||||
"provision",
|
"provision",
|
||||||
"-c", "provision-{}".format(fqdn.split('.')[0]),
|
"-c", "provision-{}".format(fqdn.split('.')[0])])
|
||||||
"switch"])
|
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
|
|
|
@ -20,7 +20,16 @@ let
|
||||||
remote=root@${machine.fqdn}
|
remote=root@${machine.fqdn}
|
||||||
echo "Configuration for ${machine.fqdn} is ${configuration.toplevel}"
|
echo "Configuration for ${machine.fqdn} is ${configuration.toplevel}"
|
||||||
nix copy --no-check-sigs -s --to ssh://$remote ${configuration.toplevel}
|
nix copy --no-check-sigs -s --to ssh://$remote ${configuration.toplevel}
|
||||||
ssh $remote ${configuration.toplevel}/bin/switch-to-configuration $1
|
echo "/etc/systemd/system diff:"
|
||||||
|
ssh $remote diff -ur /var/run/current-system/etc/systemd/system ${configuration.toplevel}/etc/systemd/system || true
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
ssh $remote ${configuration.toplevel}/bin/switch-to-configuration dry-activate
|
||||||
|
read -p "Do you want to switch to this configuration? " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
ssh $remote ${configuration.toplevel}/bin/switch-to-configuration switch
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
machineProvisioners = builtins.listToAttrs (map (machine: {
|
machineProvisioners = builtins.listToAttrs (map (machine: {
|
||||||
|
|
Loading…
Reference in New Issue