Skip to content

Commit

Permalink
Merge pull request #15009 from SimonRichardson/allow-repl-via-juju-ssh
Browse files Browse the repository at this point in the history
[JUJU-2353] Allow repl access for all substrates
  • Loading branch information
juanmanuel-tirado committed Jan 3, 2023
2 parents d798238 + 1081f9b commit 42d17be
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions scripts/dqlite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,10 @@ musl-install-if-missing:
# Accessing the dqlite repl on a given controller for debugging purposes.
################################################################################

JUJU_CONTROLLER_BOX ?= $(shell juju status -m controller --format=json | jq -r '.machines | .["0"] | .["instance-id"]')

juju-dqlite-repl-deps-on-controller:
@lxc exec -t ${JUJU_CONTROLLER_BOX} -- bash -c 'which rlwrap &>/dev/null || apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install rlwrap'
@lxc exec -t ${JUJU_CONTROLLER_BOX} -- bash -c 'which socat &>/dev/null || apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install socat'
@juju exec -m controller --machine=0 'sudo which rlwrap &>/dev/null || sudo apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install rlwrap'
@juju exec -m controller --machine=0 'sudo which socat &>/dev/null || sudo apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install socat'

juju-dqlite-repl: juju-dqlite-repl-deps-on-controller
@echo "[+] Connecting to REPL interface on controller: ${JUJU_CONTROLLER_BOX}"
@lxc exec -t ${JUJU_CONTROLLER_BOX} -- bash -c 'rlwrap -H /root/.dqlite_repl.history socat - /var/lib/juju/dqlite/juju.sock'
@echo "[+] Connecting to REPL interface to controller machine 0"
@juju ssh -m controller 0 'sudo rlwrap -H /root/.dqlite_repl.history socat - /var/lib/juju/dqlite/juju.sock'

0 comments on commit 42d17be

Please sign in to comment.