1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

ifupdown2: syntax-check: exit with 1 if syntax errors

Ticket: CM-7995
Reviewed By: CCR-3850
Testing Done: Tested exit code on syntax errors

This patch adds members 'errors' and 'warns' to networkinterfaces.py
to track errors and warns during parsing interfaces file.

This patch also adds --syntax-check option to ifreload
given people seem to use ifreload more than ifup these days.

$ ifreload --syntax-check -a
error: /etc/network/interfaces: iface swp1.200: unsupported keyword (roopa-attr)
$ echo $?
1

(cherry picked from commit e643a136fcf5d387ff0f9a31cb6a6af4983e1012)
This commit is contained in:
Roopa Prabhu
2015-11-22 16:26:14 -08:00
committed by Sam Tannous
parent ff28a49e7d
commit cfa06db648
5 changed files with 54 additions and 12 deletions

View File

@@ -14,7 +14,7 @@ reload network interface configuration
SYNOPSIS
========
ifreload [-h] (-a|-c) [-v] [-d] [-f] [-n]
ifreload [-h] (-a|-c) [-v] [-d] [-f] [-n] [-s]
DESCRIPTION
===========
@@ -61,6 +61,8 @@ OPTIONS
then each dependent interface must be specified in order
to be excluded.
-s, --syntax-check Only run the interfaces file parser
EXAMPLES
========

View File

@@ -22,7 +22,7 @@ SYNOPSIS
========
ifup [-h] [-a] [-v] [-d] [--allow CLASS] [--with-depends]
**[-X EXCLUDEPATS] [-f] [-n] [--print-dependency {list,dot}]**
**[-X EXCLUDEPATS] [-f] [-n] [-s] [--print-dependency {list,dot}]**
**[IFACE [IFACE ...]]**
ifdown [-h] [-a] [-v] [-d] [--allow CLASS] [--with-depends]
@@ -115,6 +115,8 @@ OPTIONS
your state file is corrupted or you want down to use
the latest from the interfaces file
-s, --syntax-check Only run the interfaces file parser
EXAMPLES
========
# bringing up all interfaces