From 0de3567b5c8e640351efd66c306bae8bf2f7538d Mon Sep 17 00:00:00 2001 From: dann frazier Date: Tue, 14 Aug 2018 17:19:51 -0600 Subject: Add test for predictable network names Fixes: LP:#1783133 Signed-off-by: dann frazier --- bin/network_predictable_names | 45 +++++++++++++++++++++++++++++++++++++++++++ units/networking/jobs.pxu | 6 ++++++ 2 files changed, 51 insertions(+) create mode 100755 bin/network_predictable_names diff --git a/bin/network_predictable_names b/bin/network_predictable_names new file mode 100755 index 0000000..a3c3e5b --- /dev/null +++ b/bin/network_predictable_names @@ -0,0 +1,45 @@ +#!/bin/sh + +set -e + +# Script to verify that all network interfaces have predictable names +# +# Copyright (c) 2018 Canonical Ltd. +# +# Authors +# dann frazier +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3, +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# The purpose of this script is to identify any network interfaces +# that do not have a predictable name. See: +# https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ +# +# Usage: +# network_predictable_names +# +# Parameters: +# None + +failed=0 + +for iface in /sys/class/net/*; do + iface=${iface##*/} + + if [ "${iface}" != "${iface#eth}" ]; then + echo "** Error: Network interface $iface is not a predictable name" + failed=1 + fi +done + +exit $failed diff --git a/units/networking/jobs.pxu b/units/networking/jobs.pxu index 92eadd4..0efefa2 100644 --- a/units/networking/jobs.pxu +++ b/units/networking/jobs.pxu @@ -77,3 +77,9 @@ requires: package.name == 'cups-client' command: network_printer_test -s $CHECKBOX_SERVER _description: Try to enable a remote printer on the network and print a test page. +plugin: shell +category_id: com.canonical.plainbox::networking +id: networking/predictable_names +command: network_predictable_names +_description: Verify that all network interfaces have predictable names. + -- cgit v1.2.3 From af9b81fff29d12264c1b595dc4bb283775e93f1f Mon Sep 17 00:00:00 2001 From: dann frazier Date: Wed, 15 Aug 2018 10:20:05 -0600 Subject: Whitespace cleanup Signed-off-by: dann frazier --- bin/network_predictable_names | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/network_predictable_names b/bin/network_predictable_names index a3c3e5b..20c52df 100755 --- a/bin/network_predictable_names +++ b/bin/network_predictable_names @@ -35,7 +35,7 @@ failed=0 for iface in /sys/class/net/*; do iface=${iface##*/} - + if [ "${iface}" != "${iface#eth}" ]; then echo "** Error: Network interface $iface is not a predictable name" failed=1 -- cgit v1.2.3 From afc106cf7bf2367e434697e024bd668d58cb5d0d Mon Sep 17 00:00:00 2001 From: dann frazier Date: Wed, 15 Aug 2018 10:21:01 -0600 Subject: network/predictable_names: Add _summary field Just duplicate the _description field. Signed-off-by: dann frazier --- units/networking/jobs.pxu | 1 + 1 file changed, 1 insertion(+) diff --git a/units/networking/jobs.pxu b/units/networking/jobs.pxu index 0efefa2..360aaf2 100644 --- a/units/networking/jobs.pxu +++ b/units/networking/jobs.pxu @@ -81,5 +81,6 @@ plugin: shell category_id: com.canonical.plainbox::networking id: networking/predictable_names command: network_predictable_names +_summary: Verify that all network interfaces have predictable names. _description: Verify that all network interfaces have predictable names. -- cgit v1.2.3