feat(yamllint): include for this repo and apply rules throughout

* Semi-automated using `ssf-formula` (v0.5.0)
* Fix errors shown below:

```bash
users-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:")
./users/defaults.yaml
  4:1       warning  missing document start "---"  (document-start)
  5:20      warning  truthy value should be one of [false, true]  (truthy)
  8:21      warning  truthy value should be one of [false, true]  (truthy)
  9:15      warning  truthy value should be one of [false, true]  (truthy)
  10:1      error    too many blank lines (1 > 0)  (empty-lines)

pillar.example
  5:20      warning  truthy value should be one of [false, true]  (truthy)
  14:13     warning  truthy value should be one of [false, true]  (truthy)
  16:13     warning  truthy value should be one of [false, true]  (truthy)
  19:13     warning  truthy value should be one of [false, true]  (truthy)
  23:13     warning  truthy value should be one of [false, true]  (truthy)
  25:5      error    wrong indentation: expected 6 but found 4  (indentation)
  37:23     warning  truthy value should be one of [false, true]  (truthy)
  40:21     warning  truthy value should be one of [false, true]  (truthy)
  41:20     warning  truthy value should be one of [false, true]  (truthy)
  42:13     warning  truthy value should be one of [false, true]  (truthy)
  47:17     warning  truthy value should be one of [false, true]  (truthy)
  51:19     warning  truthy value should be one of [false, true]  (truthy)
  52:23     warning  truthy value should be one of [false, true]  (truthy)
  53:20     warning  truthy value should be one of [false, true]  (truthy)
  54:21     warning  truthy value should be one of [false, true]  (truthy)
  58:15     warning  truthy value should be one of [false, true]  (truthy)
  59:15     warning  truthy value should be one of [false, true]  (truthy)
  73:18     warning  truthy value should be one of [false, true]  (truthy)
  75:20     warning  truthy value should be one of [false, true]  (truthy)
  90:7      error    duplication of key "privkey" in mapping  (key-duplicates)
  91:7      error    duplication of key "pubkey" in mapping  (key-duplicates)
  117:44    warning  too few spaces before comment  (comments)
  125:27    warning  truthy value should be one of [false, true]  (truthy)
  153:17    warning  truthy value should be one of [false, true]  (truthy)
  167:13    warning  truthy value should be one of [false, true]  (truthy)
  171:16    warning  truthy value should be one of [false, true]  (truthy)
  172:89    error    line too long (102 > 88 characters)  (line-length)
  177:89    error    line too long (102 > 88 characters)  (line-length)
  178:89    error    line too long (100 > 88 characters)  (line-length)
  181:89    error    line too long (94 > 88 characters)  (line-length)
  188:13    warning  truthy value should be one of [false, true]  (truthy)
  189:12    warning  truthy value should be one of [false, true]  (truthy)
  190:12    warning  truthy value should be one of [false, true]  (truthy)

test/salt/pillar/default.sls
  25:89     error    line too long (91 > 88 characters)  (line-length)
  175:89    error    line too long (102 > 88 characters)  (line-length)
  180:89    error    line too long (102 > 88 characters)  (line-length)
  181:89    error    line too long (100 > 88 characters)  (line-length)
  184:89    error    line too long (94 > 88 characters)  (line-length)
```
This commit is contained in:
Imran Iqbal 2019-08-07 17:37:06 +01:00
parent c5a5e3e484
commit fa6210dc5b
No known key found for this signature in database
GPG Key ID: 6D8629439D2B7819
6 changed files with 81 additions and 53 deletions

View File

@ -3,7 +3,7 @@
--- ---
stages: stages:
- test - test
- commitlint - lint
- name: release - name: release
if: branch = master AND type != pull_request if: branch = master AND type != pull_request
@ -49,16 +49,21 @@ script:
jobs: jobs:
include: include:
# Define the commitlint stage # Define the `lint` stage (runs `yamllint` and `commitlint`)
- stage: commitlint - stage: lint
language: node_js language: node_js
node_js: lts/* node_js: lts/*
before_install: skip before_install: skip
script: script:
# Install and run `yamllint`
- pip install --user yamllint
# yamllint disable-line rule:line-length
- yamllint -s . .yamllint pillar.example test/salt/pillar/default.sls
# Install and run `commitlint`
- npm install @commitlint/config-conventional -D - npm install @commitlint/config-conventional -D
- npm install @commitlint/travis-cli -D - npm install @commitlint/travis-cli -D
- commitlint-travis - commitlint-travis
# Define the release stage that runs semantic-release # Define the release stage that runs `semantic-release`
- stage: release - stage: release
language: node_js language: node_js
node_js: lts/* node_js: lts/*

16
.yamllint Normal file
View File

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
# Extend the `default` configuration provided by `yamllint`
extends: default
# Files to ignore completely
# 1. All YAML files under directory `node_modules/`, introduced during the Travis run
ignore: |
node_modules/
rules:
line-length:
# Increase from default of `80`
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
max: 88

View File

@ -2,7 +2,7 @@
# vim: ft=yaml # vim: ft=yaml
--- ---
users-formula: users-formula:
use_vim_formula: True use_vim_formula: true
lookup: # override the defauls in map.jinja lookup: # override the defauls in map.jinja
root_group: root root_group: root
@ -11,16 +11,16 @@ groups:
foo: foo:
state: present state: present
gid: 1500 gid: 1500
system: False system: false
badguys: badguys:
absent: True absent: true
niceguys: niceguys:
gid: 4242 gid: 4242
system: False system: false
addusers: root addusers: root
delusers: toor delusers: toor
ssl-cert: ssl-cert:
system: True system: true
members: members:
- www-data - www-data
- openldap - openldap
@ -34,29 +34,29 @@ users:
buser: buser:
fullname: B User fullname: B User
password: $6$w............. password: $6$w.............
enforce_password: True enforce_password: true
# WARNING: If 'empty_password' is set to True, the 'password' statement # WARNING: If 'empty_password' is set to true, the 'password' statement
# will be ignored by enabling password-less login for the user. # will be ignored by enabling password-less login for the user.
empty_password: False empty_password: false
hash_password: False hash_password: false
system: False system: false
home: /custom/buser home: /custom/buser
homedir_owner: buser homedir_owner: buser
homedir_group: primarygroup homedir_group: primarygroup
user_dir_mode: 750 user_dir_mode: 750
createhome: True createhome: true
roomnumber: "A-1" roomnumber: "A-1"
workphone: "(555) 555-5555" workphone: "(555) 555-5555"
homephone: "(555) 555-5551" homephone: "(555) 555-5551"
manage_vimrc: False manage_vimrc: false
allow_gid_change: False allow_gid_change: false
manage_bashrc: False manage_bashrc: false
manage_profile: False manage_profile: false
expire: 16426 expire: 16426
# Disables user management except sudo rules. # Disables user management except sudo rules.
# Useful for setting sudo rules for system accounts created by package instalation # Useful for setting sudo rules for system accounts created by package instalation
sudoonly: False sudoonly: false
sudouser: True sudouser: true
# sudo_rules doesn't need the username as a prefix for the rule # sudo_rules doesn't need the username as a prefix for the rule
# this is added automatically by the formula. # this is added automatically by the formula.
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@ -70,9 +70,9 @@ users:
sudo_defaults: sudo_defaults:
- '!requiretty' - '!requiretty'
# enable polkitadmin to make user an AdminIdentity for polkit # enable polkitadmin to make user an AdminIdentity for polkit
polkitadmin: True polkitadmin: true
shell: /bin/bash shell: /bin/bash
remove_groups: False remove_groups: false
prime_group: prime_group:
name: primarygroup name: primarygroup
gid: 1501 gid: 1501
@ -82,10 +82,10 @@ users:
- some_groups_that_might - some_groups_that_might
- not_exist_on_all_minions - not_exist_on_all_minions
ssh_key_type: rsa ssh_key_type: rsa
# You can inline the private keys ...
ssh_keys: ssh_keys:
privkey: PRIVATEKEY # You can inline the private keys ...
pubkey: PUBLICKEY # privkey: PRIVATEKEY
# pubkey: PUBLICKEY
# or you can provide path to key on Salt fileserver # or you can provide path to key on Salt fileserver
privkey: salt://path_to_PRIVATEKEY privkey: salt://path_to_PRIVATEKEY
pubkey: salt://path_to_PUBLICKEY pubkey: salt://path_to_PUBLICKEY
@ -122,7 +122,7 @@ users:
fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48 fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
key: PUBLICKEY key: PUBLICKEY
enc: ssh-rsa enc: ssh-rsa
hash_known_hosts: True hash_known_hosts: true
timeout: 5 timeout: 5
fingerprint_hash_type: sha256 fingerprint_hash_type: sha256
ssh_known_hosts.absent: ssh_known_hosts.absent:
@ -150,7 +150,7 @@ users:
- push.default - push.default
- color\..+ - color\..+
google_2fa: True google_2fa: true
google_auth: google_auth:
sshd: | sshd: |
SOMEGAUTHHASHVAL SOMEGAUTHHASHVAL
@ -163,31 +163,33 @@ users:
33333333 33333333
44444444 44444444
55555555 55555555
# unique: True allows user to have non unique uid # unique: true allows user to have non unique uid
unique: False unique: false
uid: 1001 uid: 1001
user_files: user_files:
enabled: True enabled: true
# 'source' allows you to define an arbitrary directory to sync, useful to use for default files. # 'source' allows you to define an arbitrary directory to sync,
# useful to use for default files.
# should be a salt fileserver path either with or without 'salt://' # should be a salt fileserver path either with or without 'salt://'
# if not present, it defaults to 'salt://users/files/user/<username> # if not present, it defaults to 'salt://users/files/user/<username>
source: users/files source: users/files
# template: jinja # template: jinja
# You can specify octal mode for files and symlinks that will be copied. Since version 2016.11.0 # You can specify octal mode for files and symlinks that will be copied.
# it's possible to use 'keep' for file_mode, to preserve file original mode, thus you can save # Since version 2016.11.0 it's possible to use 'keep' for file_mode,
# execution bit for example. # to preserve file original mode, thus you can save execution bit for example.
file_mode: keep file_mode: keep
# You can specify octal mode for directories as well. This won't work on Windows minions # You can specify octal mode for directories as well.
# This won't work on Windows minions
# dir_mode: 775 # dir_mode: 775
sym_mode: 640 sym_mode: 640
exclude_pat: "*.gitignore" exclude_pat: "*.gitignore"
## Absent user ## Absent user
cuser: cuser:
absent: True absent: true
purge: True purge: true
force: True force: true
## Old syntax of absent_users still supported ## Old syntax of absent_users still supported

View File

@ -1,3 +1,6 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
name: default name: default
title: users formula title: users formula
maintainer: SaltStack Formulas maintainer: SaltStack Formulas

View File

@ -22,7 +22,8 @@ groups:
ssl-cert: ssl-cert:
system: true system: true
members: members:
# *TODO*: run groups after all users created and then use `auser` and `buser` instead # *TODO*: run groups after all users created and then use `auser` and
# `buser` instead
- root - root
- sshd - sshd
# - bin # - bin
@ -172,16 +173,18 @@ users:
user_files: user_files:
enabled: true enabled: true
# 'source' allows you to define an arbitrary directory to sync, useful to use for default files. # 'source' allows you to define an arbitrary directory to sync,
# useful to use for default files.
# should be a salt fileserver path either with or without 'salt://' # should be a salt fileserver path either with or without 'salt://'
# if not present, it defaults to 'salt://users/files/user/<username> # if not present, it defaults to 'salt://users/files/user/<username>
source: users/files source: users/files
# template: jinja # template: jinja
# You can specify octal mode for files and symlinks that will be copied. Since version 2016.11.0 # You can specify octal mode for files and symlinks that will be copied.
# it's possible to use 'keep' for file_mode, to preserve file original mode, thus you can save # Since version 2016.11.0 it's possible to use 'keep' for file_mode,
# execution bit for example. # to preserve file original mode, thus you can save execution bit for example.
file_mode: keep file_mode: keep
# You can specify octal mode for directories as well. This won't work on Windows minions # You can specify octal mode for directories as well.
# This won't work on Windows minions
# dir_mode: 775 # dir_mode: 775
sym_mode: 640 sym_mode: 640
exclude_pat: "*.gitignore" exclude_pat: "*.gitignore"

View File

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=yaml # vim: ft=yaml
---
users-formula: users-formula:
use_vim_formula: False use_vim_formula: false
users: users:
allow_gid_change: True allow_gid_change: true
createhome: True createhome: true