forked fromalphagov/fabric-scripts
- Notifications
You must be signed in to change notification settings - Fork0
Commitcba250f
committed
Check whether locksmithctl is installed
When running tasks that depend on it. The package is uninstalled by Puppetwhen `govuk_unattended_reboots::enabled` is false (default). This results inthe following output when a task is run: (fabric)➜ fabric-scripts git:(master) fab preview locksmith.status [etcd-1.management] run: /usr/bin/locksmithctl -endpoint='http://etcd-1.management:4001,http://etcd-2.management:4001,http://etcd-3.management:4001' status [etcd-1.management] out: /bin/bash: /usr/bin/locksmithctl: No such file or directory [etcd-1.management] out: Fatal error: run() received nonzero return code 127 while executing! Requested: /usr/bin/locksmithctl -endpoint='http://etcd-1.management:4001,http://etcd-2.management:4001,http://etcd-3.management:4001' status Executed: /bin/bash -l -c "/usr/bin/locksmithctl -endpoint='http://etcd-1.management:4001,http://etcd-2.management:4001,http://etcd-3.management:4001' status" Aborting. Disconnecting from etcd-1.management... done. Disconnecting from jumpbox.preview.alphagov.co.uk... done.By checking whether the command is present first we can provide a simplererror with more context: (fabric)➜ fabric-scripts git:(check_locksmithctl_installed) fab preview locksmith.status Fatal error: locksmithctl is not installed. Perhaps unattended_reboots are disabled? Aborting. Disconnecting from etcd-1.management... done. Disconnecting from jumpbox.preview.alphagov.co.uk... done.I thought about decorating this with `@runs_once` but actually we probablywon't call locksmith multiple times in the same run, we'd want to check forevery machine it's run on, and it's pretty cheap to check.1 parent43c8289 commitcba250f
1 file changed
+11
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
5 | 12 | | |
6 | 13 | | |
7 | 14 | | |
8 | 15 | | |
9 | 16 | | |
10 | | - | |
| 17 | + | |
| 18 | + | |
11 | 19 | | |
12 | 20 | | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
16 | | - | |
| 24 | + | |
| 25 | + | |
0 commit comments
Comments
(0)