A command-line utility that checks for best practices in SaltStack.
Project description
Salt-lint
salt-lint checks Salt state files (SLS) for practices and behaviour that could potentially be improved.
The project is heavily based on ansible-lint, which was created by Will Thames and is now maintained as part of the Ansible by Red Hat project.
Installing
From Source
pip install git+https://github.com/roaldnefs/salt-lint.git
Usage
Command Line Options
The following is the output from salt-lint --help, providing an overview of the basic command line options:
Usage: salt-lint [options] init.sls [state ...]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-L list all the rules
-t TAGS only check rules whose id/tags match these values
-v Increase verbosity level
-x SKIP_LIST only check rules whose id/tags do not match these
values
--nocolor disable colored output
--force-color Try force colored output (relying on salt's code)
--exclude=EXCLUDE_PATHS
path to directories or files to skip. This option is
repeatable.
-c C Specify configuration file to use. Defaults to
".salt-lint"
Linting Salt state files
It’s important to note tat salt-lint accepts a list of Salt state files or a list of directories.
Configuring
Configuration File
Salt-lint supports local confguration via a .salt-lint configuration file. Salt-lint check the working directory for the presence of this file and applies any configuration found there. The configuration file location can also be overridden via the -c path/to/file CLI flag.
If a value is provided on both the command line and via a config file, the values will be merged (if a list like exclude_paths), or the True value will be preferred, in the case of something like quiet.
Pre-commit Setup
To use salt-lint with pre-commit, just add the following to your local repo’s .pre-commit-config.yaml file. Prior to version 0.12.0 of pre-commit the file was hooks.yaml (now .pre-commit-config.yaml).
---
# For use with pre-commit.
# See usage instructions at http://pre-commit.com
- id: salt-lint
name: Salt-lint
description: This hook runs salt-lint.
entry: salt-lint
language: python
files: \.(sls)$
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file salt-lint-0.0.1.tar.gz.
File metadata
- Download URL: salt-lint-0.0.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
979e25e1177cbe2074cbbb66ecce1b8e7548db5f406ee4bcfd91c2143fd3faad
|
|
| MD5 |
dc143ff4a02285b55f8fd32366b0ea76
|
|
| BLAKE2b-256 |
f9bd09c026e994e0339076b3675ae731be0889fb41f76f91e94d92850302d581
|
File details
Details for the file salt_lint-0.0.1-py3-none-any.whl.
File metadata
- Download URL: salt_lint-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5092e1fcfd11029639168c64a955b916496cf6eaa6a759d28ec5247bd8f35a8b
|
|
| MD5 |
e45d7002dae5e42d024ea89fba816244
|
|
| BLAKE2b-256 |
f66f86fff22841445468b41a4f16d68fb9cdbd7ada0f8274edf6c9baf331e796
|