Merge ~cjwatson/launchpad-bastion-scripts:in-model into launchpad-bastion-scripts:main

Proposed by Colin Watson
Status: Merged
Merged at revision: 0b763b2f9d75b940acdd6d58232973f8518defb2
Proposed branch: ~cjwatson/launchpad-bastion-scripts:in-model
Merge into: launchpad-bastion-scripts:main
Diff against target: 18 lines (+12/-0)
1 file modified
in-model (+12/-0)
Reviewer Review Type Date Requested Status
Guruprasad Approve
Review via email: mp+450689@code.launchpad.net

Commit message

Add in-model script

Description of the change

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

To post a comment you must log in.
Revision history for this message
Guruprasad (lgp171188) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/in-model b/in-model
2new file mode 100755
3index 0000000..8c7df41
4--- /dev/null
5+++ b/in-model
6@@ -0,0 +1,12 @@
7+#! /bin/sh
8+set -e
9+
10+# Run a command in a particular model.
11+
12+model="$1"
13+shift
14+
15+# shellcheck disable=SC1090
16+. "$HOME/.mojorc.$model"
17+
18+exec "$@"

Subscribers

People subscribed via source and target branches