Skip to content

Commit 1b354fa

Browse files
authored
Merge pull request #208 from myii/chore/standardise-structure
feat(yamllint): include for this repo and apply rules throughout
2 parents c5a5e3e + fa6210d commit 1b354fa

File tree

6 files changed

+81
-53
lines changed

6 files changed

+81
-53
lines changed

.travis.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
---
44
stages:
55
- test
6-
- commitlint
6+
- lint
77
- name: release
88
if: branch = master AND type != pull_request
99

@@ -49,16 +49,21 @@ script:
4949

5050
jobs:
5151
include:
52-
# Define the commitlint stage
53-
- stage: commitlint
52+
# Define the `lint` stage (runs `yamllint` and `commitlint`)
53+
- stage: lint
5454
language: node_js
5555
node_js: lts/*
5656
before_install: skip
5757
script:
58+
# Install and run `yamllint`
59+
- pip install --user yamllint
60+
# yamllint disable-line rule:line-length
61+
- yamllint -s . .yamllint pillar.example test/salt/pillar/default.sls
62+
# Install and run `commitlint`
5863
- npm install @commitlint/config-conventional -D
5964
- npm install @commitlint/travis-cli -D
6065
- commitlint-travis
61-
# Define the release stage that runs semantic-release
66+
# Define the release stage that runs `semantic-release`
6267
- stage: release
6368
language: node_js
6469
node_js: lts/*

.yamllint

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
# Extend the `default` configuration provided by `yamllint`
5+
extends: default
6+
7+
# Files to ignore completely
8+
# 1. All YAML files under directory `node_modules/`, introduced during the Travis run
9+
ignore: |
10+
node_modules/
11+
12+
rules:
13+
line-length:
14+
# Increase from default of `80`
15+
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
16+
max: 88

pillar.example

+40-38
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# vim: ft=yaml
33
---
44
users-formula:
5-
use_vim_formula: True
5+
use_vim_formula: true
66
lookup: # override the defauls in map.jinja
77
root_group: root
88

@@ -11,19 +11,19 @@ groups:
1111
foo:
1212
state: present
1313
gid: 1500
14-
system: False
14+
system: false
1515
badguys:
16-
absent: True
16+
absent: true
1717
niceguys:
1818
gid: 4242
19-
system: False
19+
system: false
2020
addusers: root
2121
delusers: toor
2222
ssl-cert:
23-
system: True
23+
system: true
2424
members:
25-
- www-data
26-
- openldap
25+
- www-data
26+
- openldap
2727

2828
users:
2929
## Minimal required pillar values
@@ -34,29 +34,29 @@ users:
3434
buser:
3535
fullname: B User
3636
password: $6$w.............
37-
enforce_password: True
38-
# WARNING: If 'empty_password' is set to True, the 'password' statement
37+
enforce_password: true
38+
# WARNING: If 'empty_password' is set to true, the 'password' statement
3939
# will be ignored by enabling password-less login for the user.
40-
empty_password: False
41-
hash_password: False
42-
system: False
40+
empty_password: false
41+
hash_password: false
42+
system: false
4343
home: /custom/buser
4444
homedir_owner: buser
4545
homedir_group: primarygroup
4646
user_dir_mode: 750
47-
createhome: True
47+
createhome: true
4848
roomnumber: "A-1"
4949
workphone: "(555) 555-5555"
5050
homephone: "(555) 555-5551"
51-
manage_vimrc: False
52-
allow_gid_change: False
53-
manage_bashrc: False
54-
manage_profile: False
51+
manage_vimrc: false
52+
allow_gid_change: false
53+
manage_bashrc: false
54+
manage_profile: false
5555
expire: 16426
5656
# Disables user management except sudo rules.
5757
# Useful for setting sudo rules for system accounts created by package instalation
58-
sudoonly: False
59-
sudouser: True
58+
sudoonly: false
59+
sudouser: true
6060
# sudo_rules doesn't need the username as a prefix for the rule
6161
# this is added automatically by the formula.
6262
# ----------------------------------------------------------------------
@@ -70,9 +70,9 @@ users:
7070
sudo_defaults:
7171
- '!requiretty'
7272
# enable polkitadmin to make user an AdminIdentity for polkit
73-
polkitadmin: True
73+
polkitadmin: true
7474
shell: /bin/bash
75-
remove_groups: False
75+
remove_groups: false
7676
prime_group:
7777
name: primarygroup
7878
gid: 1501
@@ -82,10 +82,10 @@ users:
8282
- some_groups_that_might
8383
- not_exist_on_all_minions
8484
ssh_key_type: rsa
85-
# You can inline the private keys ...
8685
ssh_keys:
87-
privkey: PRIVATEKEY
88-
pubkey: PUBLICKEY
86+
# You can inline the private keys ...
87+
# privkey: PRIVATEKEY
88+
# pubkey: PUBLICKEY
8989
# or you can provide path to key on Salt fileserver
9090
privkey: salt://path_to_PRIVATEKEY
9191
pubkey: salt://path_to_PUBLICKEY
@@ -114,15 +114,15 @@ users:
114114
ssh_auth_sources:
115115
- salt://keys/buser.id_rsa.pub
116116
ssh_auth_sources.absent:
117-
- salt://keys/deleteduser.id_rsa.pub # PUBLICKEY_FILE_TO_BE_REMOVED
117+
- salt://keys/deleteduser.id_rsa.pub # PUBLICKEY_FILE_TO_BE_REMOVED
118118
# Manage the ~/.ssh/config file
119119
ssh_known_hosts:
120120
importanthost:
121121
port: 22
122122
fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
123123
key: PUBLICKEY
124124
enc: ssh-rsa
125-
hash_known_hosts: True
125+
hash_known_hosts: true
126126
timeout: 5
127127
fingerprint_hash_type: sha256
128128
ssh_known_hosts.absent:
@@ -150,7 +150,7 @@ users:
150150
- push.default
151151
- color\..+
152152

153-
google_2fa: True
153+
google_2fa: true
154154
google_auth:
155155
sshd: |
156156
SOMEGAUTHHASHVAL
@@ -163,31 +163,33 @@ users:
163163
33333333
164164
44444444
165165
55555555
166-
# unique: True allows user to have non unique uid
167-
unique: False
166+
# unique: true allows user to have non unique uid
167+
unique: false
168168
uid: 1001
169169

170170
user_files:
171-
enabled: True
172-
# 'source' allows you to define an arbitrary directory to sync, useful to use for default files.
171+
enabled: true
172+
# 'source' allows you to define an arbitrary directory to sync,
173+
# useful to use for default files.
173174
# should be a salt fileserver path either with or without 'salt://'
174175
# if not present, it defaults to 'salt://users/files/user/<username>
175176
source: users/files
176177
# template: jinja
177-
# You can specify octal mode for files and symlinks that will be copied. Since version 2016.11.0
178-
# it's possible to use 'keep' for file_mode, to preserve file original mode, thus you can save
179-
# execution bit for example.
178+
# You can specify octal mode for files and symlinks that will be copied.
179+
# Since version 2016.11.0 it's possible to use 'keep' for file_mode,
180+
# to preserve file original mode, thus you can save execution bit for example.
180181
file_mode: keep
181-
# You can specify octal mode for directories as well. This won't work on Windows minions
182+
# You can specify octal mode for directories as well.
183+
# This won't work on Windows minions
182184
# dir_mode: 775
183185
sym_mode: 640
184186
exclude_pat: "*.gitignore"
185187

186188
## Absent user
187189
cuser:
188-
absent: True
189-
purge: True
190-
force: True
190+
absent: true
191+
purge: true
192+
force: true
191193

192194

193195
## Old syntax of absent_users still supported

test/integration/default/inspec.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
name: default
25
title: users formula
36
maintainer: SaltStack Formulas

test/salt/pillar/default.sls

+9-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ groups:
2222
ssl-cert:
2323
system: true
2424
members:
25-
# *TODO*: run groups after all users created and then use `auser` and `buser` instead
25+
# *TODO*: run groups after all users created and then use `auser` and
26+
# `buser` instead
2627
- root
2728
- sshd
2829
# - bin
@@ -172,16 +173,18 @@ users:
172173

173174
user_files:
174175
enabled: true
175-
# 'source' allows you to define an arbitrary directory to sync, useful to use for default files.
176+
# 'source' allows you to define an arbitrary directory to sync,
177+
# useful to use for default files.
176178
# should be a salt fileserver path either with or without 'salt://'
177179
# if not present, it defaults to 'salt://users/files/user/<username>
178180
source: users/files
179181
# template: jinja
180-
# You can specify octal mode for files and symlinks that will be copied. Since version 2016.11.0
181-
# it's possible to use 'keep' for file_mode, to preserve file original mode, thus you can save
182-
# execution bit for example.
182+
# You can specify octal mode for files and symlinks that will be copied.
183+
# Since version 2016.11.0 it's possible to use 'keep' for file_mode,
184+
# to preserve file original mode, thus you can save execution bit for example.
183185
file_mode: keep
184-
# You can specify octal mode for directories as well. This won't work on Windows minions
186+
# You can specify octal mode for directories as well.
187+
# This won't work on Windows minions
185188
# dir_mode: 775
186189
sym_mode: 640
187190
exclude_pat: "*.gitignore"

users/defaults.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=yaml
3-
3+
---
44
users-formula:
5-
use_vim_formula: False
5+
use_vim_formula: false
66

77
users:
8-
allow_gid_change: True
9-
createhome: True
10-
8+
allow_gid_change: true
9+
createhome: true

0 commit comments

Comments
 (0)