From 1abcb7293d450ea9dae7861aaedfb23a5afd025a Mon Sep 17 00:00:00 2001 From: Sergey Lukjanov Date: Fri, 16 Sep 2016 19:43:50 -0700 Subject: [PATCH] Yaml linter execution and config improved Change-Id: Ie4aedfb4f4a76d20f0d0432fe6c3a4665501e167 --- .../service-rendered-example-custom.yaml | 10 ++++----- .../service-rendered-example-default.yaml | 10 ++++----- .../component/service/service-example.yaml | 4 +++- tools/registry/registry-pod.yaml | 10 ++++----- tools/yamllint.sh | 5 +++++ tools/yamllint.yaml | 21 +++++++++++++++++++ tox.ini | 4 ++++ 7 files changed, 48 insertions(+), 16 deletions(-) create mode 100755 tools/yamllint.sh create mode 100644 tools/yamllint.yaml diff --git a/fuel_ccp/tests/common/service-rendered-example-custom.yaml b/fuel_ccp/tests/common/service-rendered-example-custom.yaml index 4b2a05eb..64d71423 100644 --- a/fuel_ccp/tests/common/service-rendered-example-custom.yaml +++ b/fuel_ccp/tests/common/service-rendered-example-custom.yaml @@ -10,10 +10,10 @@ service: readiness: "true" liveness: "true" volumes: - - name: keystone-logs - path: "/var/log/ccp/keystone" - type: host - readOnly: False + - name: keystone-logs + path: "/var/log/ccp/keystone" + type: host + readOnly: False pre: - name: chown-logs-dir command: "sudo /bin/chown keystone:keystone /var/log/ccp/keystone" @@ -65,4 +65,4 @@ files: content: keystone.conf.j2 wsgi-keystone-conf: path: /etc/apache2/conf-enabled/wsgi-keystone.conf -content: wsgi-keystone.conf.j2 \ No newline at end of file +content: wsgi-keystone.conf.j2 diff --git a/fuel_ccp/tests/common/service-rendered-example-default.yaml b/fuel_ccp/tests/common/service-rendered-example-default.yaml index f2a6c940..fbbef9c2 100644 --- a/fuel_ccp/tests/common/service-rendered-example-default.yaml +++ b/fuel_ccp/tests/common/service-rendered-example-default.yaml @@ -10,10 +10,10 @@ service: readiness: "true" liveness: "true" volumes: - - name: keystone-logs - path: "/var/log/ccp/keystone" - type: host - readOnly: False + - name: keystone-logs + path: "/var/log/ccp/keystone" + type: host + readOnly: False pre: - name: chown-logs-dir command: "sudo /bin/chown keystone:keystone /var/log/ccp/keystone" @@ -65,4 +65,4 @@ files: content: keystone.conf.j2 wsgi-keystone-conf: path: /etc/apache2/conf-enabled/wsgi-keystone.conf -content: wsgi-keystone.conf.j2 \ No newline at end of file +content: wsgi-keystone.conf.j2 diff --git a/fuel_ccp/tests/common/test_repo_dir/component/service/service-example.yaml b/fuel_ccp/tests/common/test_repo_dir/component/service/service-example.yaml index 2c8c3bbe..d72d636b 100644 --- a/fuel_ccp/tests/common/test_repo_dir/component/service/service-example.yaml +++ b/fuel_ccp/tests/common/test_repo_dir/component/service/service-example.yaml @@ -1,3 +1,4 @@ +# yamllint disable service: name: {{ service_name }} ports: @@ -65,4 +66,5 @@ files: content: {{ service_name }}.conf.j2 wsgi-{{ service_name }}-conf: path: /etc/apache2/conf-enabled/wsgi-{{ service_name }}.conf -content: wsgi-{{ service_name }}.conf.j2 \ No newline at end of file +content: wsgi-{{ service_name }}.conf.j2 +# yamllint enable diff --git a/tools/registry/registry-pod.yaml b/tools/registry/registry-pod.yaml index 0daddd96..2b6db0d4 100644 --- a/tools/registry/registry-pod.yaml +++ b/tools/registry/registry-pod.yaml @@ -13,8 +13,8 @@ spec: - containerPort: 5000 hostPort: 5000 readinessProbe: - httpGet: - path: /v2/_catalog - port: 5000 - initialDelaySeconds: 3 - timeoutSeconds: 1 + httpGet: + path: /v2/_catalog + port: 5000 + initialDelaySeconds: 3 + timeoutSeconds: 1 diff --git a/tools/yamllint.sh b/tools/yamllint.sh new file mode 100755 index 00000000..6e844451 --- /dev/null +++ b/tools/yamllint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -ex + +workdir=$(dirname $0) +yamllint -c $workdir/yamllint.yaml $(find . -not -path '*/\.*' -type f -name '*.yaml') diff --git a/tools/yamllint.yaml b/tools/yamllint.yaml new file mode 100644 index 00000000..6c2e4a79 --- /dev/null +++ b/tools/yamllint.yaml @@ -0,0 +1,21 @@ +extends: default + +rules: + braces: + max-spaces-inside: 1 + comments: + level: error + comments-indentation: + level: warning + document-end: + present: no + document-start: + level: error + present: no + empty-lines: + max: 1 + max-start: 0 + max-end: 0 + line-length: + level: warning + max: 120 diff --git a/tox.ini b/tox.ini index ac3321fc..3b1e1fc7 100644 --- a/tox.ini +++ b/tox.ini @@ -19,6 +19,10 @@ commands = bash -c "find {toxinidir} -type f -name '*.sh' -not -path '*/.tox/*' -exec bashate -v \{\} \;" flake8 {posargs} +[testenv:linters] +deps = yamllint +commands = {toxinidir}/tools/yamllint.sh + [testenv:venv] commands = {posargs}