Merge ~jocave/plainbox-provider-checkbox:add-check-static into plainbox-provider-checkbox:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Jonathan Cave
Approved revision: 70931cb246037be34723a6de424bf91f3ddf7214
Merged at revision: d546e8a546b28471b8897aa889ea611e55943c7a
Proposed branch: ~jocave/plainbox-provider-checkbox:add-check-static
Merge into: plainbox-provider-checkbox:master
Diff against target: 34 lines (+28/-0)
1 file modified
bin/check_static (+28/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+357622@code.launchpad.net

Description of the change

Import the check_static script to go with the test that is now in this provider

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

+1, we could revisit merging the two providers if we continue migrating jobs and scripts to p-p-c

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/check_static b/bin/check_static
2new file mode 100755
3index 0000000..dc649d5
4--- /dev/null
5+++ b/bin/check_static
6@@ -0,0 +1,28 @@
7+#!/bin/bash
8+
9+IFACE="$1"
10+
11+if [ "$IFACE" = "" ]; then
12+ echo "No interface specified"
13+ exit 1
14+fi
15+
16+CARRIER=$(nmcli -t --fields WIRED-PROPERTIES.CARRIER d show $IFACE | cut -d ":" -f 2)
17+if [ "$CARRIER" = "off" ]; then
18+ echo "No cable present"
19+ exit 1
20+fi
21+
22+CONN_NAME=$(nmcli -t --fields GENERAL.CONNECTION d show $IFACE | cut -d ":" -f 2)
23+if [ "$CONN_NAME" = "--" ]; then
24+ echo "No connection active on $IFACE"
25+ exit 1
26+fi
27+echo "Connection active on $IFACE is $CONN_NAME"
28+
29+CONN_METHOD=$(nmcli -t --fields ipv4.method c show "$CONN_NAME" | cut -d ":" -f 2)
30+if [ "$CONN_METHOD" = "auto" ]; then
31+ echo "FAIL: $CONN_METHOD"
32+ exit 1
33+fi
34+echo "PASS: $CONN_METHOD"

Subscribers

People subscribed via source and target branches