Enable linting for the repo
This change creates necessary configuration for running lint
against the changes sent to this repository. Outcomes of all
checks are currently disabled since the repository is currently
empty. They will be enabled once we start moving stuff into
this repository.
ansible-lint, yamllint, and shellcheck are enabled for the repo.
Change-Id: Iad7726464c7983a8dacf456742238351fe93af75
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9a27f6a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,65 @@
+# Packages
+# it's better to unpack these files and commit the raw source
+# git has its own built in compression methods
+*.7z
+*.dmg
+*.gz
+*.iso
+*.jar
+*.rar
+*.tar
+*.zip
+
+# OS generated files
+.DS_Store
+.DS_Store?
+._*
+.Spotlight-V100
+.Trashes
+ehthumbs.db
+Thumbs.db
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+.venv
+venv/
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+
+# Logs and other temporary files
+*.log
+*.retry
+*.swp
+
+# track these files, if they exist
+!.gitignore
+
+# engine temporary files
+engine/inventory/inventory.ini
+engine/inventory/bifrost_inventory.py
+engine/inventory/group_vars/all/pdf.yaml
+engine/inventory/group_vars/all/idf.yaml
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..00d7db8
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.nordix.org
+port=29418
+project=infra/installer/kubespray.git
+defaultbranch=master
diff --git a/.yamllint b/.yamllint
new file mode 100644
index 0000000..fb924d7
--- /dev/null
+++ b/.yamllint
@@ -0,0 +1,32 @@
+---
+yaml-files:
+ - '*.yaml'
+ - '*.yml'
+ - '.yamllint'
+
+rules:
+ braces: enable
+ brackets: enable
+ colons: enable
+ commas: enable
+ comments:
+ level: warning
+ comments-indentation:
+ level: warning
+ document-end: disable
+ document-start:
+ level: warning
+ empty-lines: enable
+ empty-values: disable
+ hyphens: enable
+ indentation: enable
+ key-duplicates: enable
+ key-ordering: disable
+ line-length: disable
+ new-line-at-end-of-file: enable
+ new-lines: enable
+ octal-values: disable
+ quoted-strings: disable
+ trailing-spaces: enable
+ truthy:
+ level: error
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..1c180ac
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,15 @@
+[metadata]
+name = engine
+summary = An automation framework
+description-file =
+ README.md
+author = Nordix Infra
+author-email = infra@nordix.org
+home-page = https://www.nordix.org/
+classifier =
+ Environment :: Cloud Infra
+ Intended Audience :: Information Technology
+ Intended Audience :: System Administrators
+ License :: OSI Approved :: Apache Software License
+ Operating System :: POSIX :: Linux
+ Programming Language :: Python
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..566d844
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,29 @@
+# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
+import setuptools
+
+# In python < 2.7.4, a lazy loading of package `pbr` will break
+# setuptools if some other modules registered functions in `atexit`.
+# solution from: http://bugs.python.org/issue15881#msg170215
+try:
+ import multiprocessing # noqa
+except ImportError:
+ pass
+
+setuptools.setup(
+ setup_requires=['pbr>=2.0.0'],
+ pbr=True)
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 0000000..13213c7
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,10 @@
+#-------------------------------------------------------------------------------
+# This file contains engine python requirement version pins.
+# Changing versions might have side effects!
+#-------------------------------------------------------------------------------
+
+# NOTE: engine test requirements
+tox==3.14.3
+ansible-lint==4.1.0
+yamllint==1.19.0
+shellcheck-py==0.7.0.1
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..98912c6
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,26 @@
+[tox]
+basepython = py36
+minversion = 2.5
+skipsdist = true
+envlist = ansible-lint, shellcheck, yamllint
+install_command = pip install {opts} {packages}
+deps = -r{toxinidir}/test-requirements.txt
+
+[testenv:ansible-lint]
+whitelist_externals = bash
+commands =
+ bash -c "find {toxinidir}/kubespray -type f -regex '.*.ya?ml' ! -regex '.*heat-template.*' -print0 | \
+ xargs -t -n1 -0 ansible-lint --nocolor"
+
+[testenv:yamllint]
+whitelist_externals = bash
+commands =
+ bash -c "find {toxinidir}/kubespray -type f -regex '.*.ya?ml' -print0 | \
+ xargs -t -n1 -0 yamllint --format standard --strict"
+
+[testenv:shellcheck]
+whitelist_externals = bash
+commands =
+ bash -c "find {toxinidir}/kubespray -type f -name '*.sh' -print0 | \
+ xargs -t -n1 -0 shellcheck --color=never --source-path={toxinidir}/kubespray \
+ --external-sources --format=tty"