Browse Source

Lint YAML files

Currently most OpenStack code is linted, but YAML files are not. As a
result, sometimes YAML problems enter the code base (e.g., the key
duplicate fixed in change I7f2369adfb152fd2a74b9b105e969e653e592922).

This patch enables YAML linting in tox linting tests, using the
yamllint tool [1]. It checks syntax errors, key duplicates, and
cosmetic problems.

[1]: http://yamllint.readthedocs.org/

EDIT: It also fixes six errors (including key duplicates) that entered
the code base after the first fix change was merged.
(I7f2369adfb152fd2a74b9b105e969e653e592922)

Change-Id: Ie746230f28fe3ed0cf218201d5a3810f7bc44070
changes/55/276755/5
Adrien Vergé 6 years ago
parent
commit
e9d9662bb6
  1. 10
      .yamllint
  2. 2
      hot/barbican/container_generic.yaml
  3. 2
      hot/barbican/order.yaml
  4. 4
      hot/barbican/secret.yaml
  5. 1
      hot/lbaasv2/lb_group.yaml
  6. 3
      hot/senlin/cluster.yaml
  7. 1
      test-requirements.txt
  8. 1
      tox.ini

10
.yamllint

@ -0,0 +1,10 @@
---
extends: default
rules:
braces: {min-spaces-inside: 0, max-spaces-inside: 1}
brackets: {min-spaces-inside: 0, max-spaces-inside: 1}
comments: disable
comments-indentation: disable
document-start: disable
indentation: disable
line-length: disable

2
hot/barbican/container_generic.yaml

@ -34,4 +34,4 @@ outputs:
value: { get_attr: [container, secret_refs] }
consumers:
description: The URIs to container consumers.
value: { get_attr: [container, consumers] }
value: { get_attr: [container, consumers] }

2
hot/barbican/order.yaml

@ -65,4 +65,4 @@ outputs:
value: { get_attr: [order, order_ref] }
secret_ref:
description: The URI to the created secret.
value: { get_attr: [order, secret_ref] }
value: { get_attr: [order, secret_ref] }

4
hot/barbican/secret.yaml

@ -69,9 +69,9 @@ outputs:
secret_status:
description: The status of the secret.
value: { get_attr: [secret, status] }
secret_status:
secret_payload:
description: The decrypted secret payload.
value: { get_attr: [secret, status] }
secret_ref:
description: Reference for created secret.
value: { get_resource: secret }
value: { get_resource: secret }

1
hot/lbaasv2/lb_group.yaml

@ -156,7 +156,6 @@ resources:
outputs:
lburl:
description: URL of the loadbalancer
value:
str_replace:
template: http://IP_ADDRESS:PORT

3
hot/senlin/cluster.yaml

@ -25,7 +25,7 @@ resources:
profile:
type: OS::Senlin::Profile
properties:
type: os.nova.server-1.0
type: os.nova.server-1.0
properties:
flavor: {get_param: flavor}
image: {get_param: image}
@ -93,4 +93,3 @@ outputs:
template: curl -X POST LINK
params:
LINK: {get_attr: [receiver_scale_in, channel, alarm_url]}

1
test-requirements.txt

@ -11,6 +11,7 @@ salt
testrepository>=0.0.18
testscenarios>=0.4
testtools>=0.9.34
yamllint>=1.2.0
python-heatclient>=1.2.0
python-keystoneclient>=0.10.0

1
tox.ini

@ -12,6 +12,7 @@ commands = bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi'
[testenv:pep8]
commands = flake8
yamllint .
[testenv:venv]
commands = {posargs}

Loading…
Cancel
Save