taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

commit d972d3f6cb770dc7977a93d1a54b3973b9813d6d
parent d9ad5c2e410ba4c2182ca16370b614e12279c6b0
Author: Florian Dold <florian.dold@gmail.com>
Date:   Sat,  2 Nov 2019 15:53:54 +0100

switch via taler-deployment

Diffstat:
Mbin/taler-deployment | 15+++++++++++++++
Dbin/taler-deployment-switch-demo-blue | 15---------------
Dbin/taler-deployment-switch-demo-green | 15---------------
3 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/bin/taler-deployment b/bin/taler-deployment @@ -386,6 +386,21 @@ def build() -> None: @cli.command() +@click.argument("color", metavar="COLOR", type=click.Choice(["blue", "green"])) +def switch_demo(color) -> None: + """Switch deployment color of demo.""" + if os.environ["USER"] != "demo": + print("Command should be executed as the demo user only.") + sys.exit(1) + active_home = Path.home() / "active-home" + try: + active_home.unlink() + except e: + pass + active_home.symlink_to(f"/home/demo-{color}") + + +@cli.command() def bootstrap() -> None: """Bootstrap a GNU Taler deployment.""" diff --git a/bin/taler-deployment-switch-demo-blue b/bin/taler-deployment-switch-demo-blue @@ -1,15 +0,0 @@ -#!/bin/bash - -if ! test $(whoami) = demo; then - echo Please run as the 'demo' user. Exiting. - exit 1 -fi - -rm /home/demo/sockets || true -rm /home/demo/landing || true -rm /home/demo/auditor || true -ln -s /home/demo-blue/sockets /home/demo/sockets -ln -s /home/demo-blue/landing /home/demo/landing -ln -s /home/demo-blue/auditor /home/demo/auditor -echo "demo-blue" > /home/demo/active -echo "demo-green" > /home/demo/nonactive diff --git a/bin/taler-deployment-switch-demo-green b/bin/taler-deployment-switch-demo-green @@ -1,15 +0,0 @@ -#!/bin/bash - -if ! test $(whoami) = demo; then - echo Please run as the 'demo' user. Exiting. - exit 1 -fi - -rm /home/demo/sockets || true -rm /home/demo/landing || true -rm /home/demo/auditor || true -ln -s /home/demo-green/sockets /home/demo/sockets -ln -s /home/demo-green/landing /home/demo/landing -ln -s /home/demo-green/auditor /home/demo/auditor -echo "demo-green" > /home/demo/active -echo "demo-blue" > /home/demo/nonactive