Skip to content

Commit

Permalink
Lint YAML files
Browse files Browse the repository at this point in the history
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
  • Loading branch information
adrienverge committed Jun 3, 2016
1 parent 46d01aa commit e9d9662
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
10 changes: 10 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -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 changes: 1 addition & 1 deletion hot/barbican/container_generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion hot/barbican/order.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 2 additions & 2 deletions hot/barbican/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 0 additions & 1 deletion hot/lbaasv2/lb_group.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ resources:
outputs:

lburl:
description: URL of the loadbalancer
value:
str_replace:
template: http://IP_ADDRESS:PORT
Expand Down
3 changes: 1 addition & 2 deletions hot/senlin/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -93,4 +93,3 @@ outputs:
template: curl -X POST LINK
params:
LINK: {get_attr: [receiver_scale_in, channel, alarm_url]}

1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ commands = bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi'

[testenv:pep8]
commands = flake8
yamllint .

[testenv:venv]
commands = {posargs}
Expand Down

0 comments on commit e9d9662

Please sign in to comment.