Revert "dib-lint: use yamllint to parse YAML files"

This reverts commit 6ee2995214 and
e85c2a6f03.

I missed that if you pip install and then run dib-lint, it's not going
to pick up the .yamllint file shipped here.  Thus it gives spurious
errors.

The reason for this was simply better duplicate key detection in yaml
files, which caused us problems with the kernel installs.  However, at
this point it seems just the old "does it load" test from pyyaml will
be enough.

Change-Id: I87a9fc9bb119cfeffad48fc0fa0df31f0181825d
This commit is contained in:
Ian Wienand 2020-05-28 16:41:01 +10:00
parent d2eaaaf622
commit 0c94eef7be
8 changed files with 17 additions and 31 deletions

View File

@ -1,20 +0,0 @@
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

View File

@ -276,7 +276,17 @@ 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"
yamllint -s -f parsable $i py_check="
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 \

View File

@ -1 +1 @@
dib-utils: dib-utils:

View File

@ -1,2 +1,2 @@
growpart: growpart:
e2fsprogs: e2fsprogs:

View File

@ -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:

View File

@ -1,5 +0,0 @@
---
fixes:
- |
A dependency on ``yamllint`` was added because it is now
required by dib-lint.

View File

@ -8,6 +8,5 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0
PyYAML>=3.12 # MIT PyYAML>=3.12 # MIT
six>=1.10.0 # MIT six>=1.10.0 # MIT
stevedore>=1.20.0 # Apache-2.0 stevedore>=1.20.0 # Apache-2.0
# NOTE(ianw) in here because dib-lint uses flake8 and yamllint # NOTE(ianw) in here because dib-lint uses flake8
flake8<4.0.0,>=3.6.0 # MIT flake8<4.0.0,>=3.6.0 # MIT
yamllint>=1.23.0

View File

@ -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