launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #30433
[Merge] ~cjwatson/launchpad-bastion-scripts:in-model into launchpad-bastion-scripts:main
Colin Watson has proposed merging ~cjwatson/launchpad-bastion-scripts:in-model into launchpad-bastion-scripts:main.
Commit message:
Add in-model script
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-bastion-scripts/+git/launchpad-bastion-scripts/+merge/450689
The way that we have multiple Juju models accessible from a single `stg-launchpad` user is inconvenient in some ways: it makes it hard to write shell one-liners that do something on the bastion, because you always have to source `~/.mojorc.qastaging` or `~/.mojorc.staging` first.
Add an `in-model` script that makes it easier to compose this sort of thing. For example, this allows running:
ssh -t launchpad-bastion-ps5.internal sudo -iu stg-launchpad in-model qastaging juju status
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-bastion-scripts:in-model into launchpad-bastion-scripts:main.
diff --git a/in-model b/in-model
new file mode 100755
index 0000000..8c7df41
--- /dev/null
+++ b/in-model
@@ -0,0 +1,12 @@
+#! /bin/sh
+set -e
+
+# Run a command in a particular model.
+
+model="$1"
+shift
+
+# shellcheck disable=SC1090
+. "$HOME/.mojorc.$model"
+
+exec "$@"