dib-lint: use yamllint to parse YAML files
This gives us better linting of YAML files that just opening them. This would have detected the duplicate keys in I34e27d821fbefe274e7b007f37b0bd34db2e1d26. The .yamllint is taken from zuul-jobs where it is also used as a fairly sane set of default rules. A few minor newline fixes are added. Change-Id: I96d6644ae24f7deb84fa50fefbda0f0d33e0e009
This commit is contained in:
parent
6e549c33ac
commit
6ee2995214
20
.yamllint
Normal file
20
.yamllint
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
extends: default
|
||||||
|
ignore: |
|
||||||
|
.tox
|
||||||
|
|
||||||
|
rules:
|
||||||
|
braces:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
level: error
|
||||||
|
brackets:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
level: error
|
||||||
|
document-start: disable
|
||||||
|
empty-lines:
|
||||||
|
max: 1
|
||||||
|
max-end: 2
|
||||||
|
indentation:
|
||||||
|
level: error
|
||||||
|
indent-sequences: consistent
|
||||||
|
line-length: disable
|
||||||
|
truthy: false
|
12
bin/dib-lint
12
bin/dib-lint
@ -276,17 +276,7 @@ fi
|
|||||||
echo "Checking YAML parsing..."
|
echo "Checking YAML parsing..."
|
||||||
for i in $(find $ELEMENTS_DIR -type f -name '*.yaml'); do
|
for i in $(find $ELEMENTS_DIR -type f -name '*.yaml'); do
|
||||||
echo "Parsing $i"
|
echo "Parsing $i"
|
||||||
py_check="
|
yamllint -s -f parsable $i
|
||||||
import yaml
|
|
||||||
import sys
|
|
||||||
try:
|
|
||||||
objs = yaml.safe_load(open('$i'))
|
|
||||||
except yaml.parser.ParserError:
|
|
||||||
sys.exit(1)
|
|
||||||
"
|
|
||||||
if ! python -c "$py_check"; then
|
|
||||||
error "$i is not a valid YAML file"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
echo "Checking pkg-map files..."
|
echo "Checking pkg-map files..."
|
||||||
for i in $(find $ELEMENTS_DIR -type f \
|
for i in $(find $ELEMENTS_DIR -type f \
|
||||||
|
@ -1 +1 @@
|
|||||||
dib-utils:
|
dib-utils:
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
growpart:
|
growpart:
|
||||||
e2fsprogs:
|
e2fsprogs:
|
||||||
|
@ -17,4 +17,4 @@ linux-firmware-whence:
|
|||||||
# mirrors the default packages installed in upstream cloud images
|
# mirrors the default packages installed in upstream cloud images
|
||||||
# to facilitate a basic network.
|
# to facilitate a basic network.
|
||||||
NetworkManager:
|
NetworkManager:
|
||||||
dhcp-client:
|
dhcp-client:
|
||||||
|
@ -12,3 +12,5 @@ testrepository>=0.0.18 # Apache-2.0/BSD
|
|||||||
testtools>=2.2.0 # MIT
|
testtools>=2.2.0 # MIT
|
||||||
|
|
||||||
coverage!=4.4,>=4.0 # Apache-2.0
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
|
|
||||||
|
yamllint>=1.23.0
|
||||||
|
Loading…
Reference in New Issue
Block a user