Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
# These are supported funding model platforms

github: mattLLVW
Expand Down
78 changes: 78 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
ci:
autofix_commit_msg: |
ci(pre-commit.ci): apply auto fixes from pre-commit.com hooks
For more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: |
ci(pre-commit.ci): perform `pre-commit` autoupdate
autoupdate_schedule: quarterly
skip: []
submodules: false
default_stages: [commit]
repos:
- repo: https://github.com/dafyddj/commitlint-pre-commit-hook
rev: v2.3.0
hooks:
- id: commitlint
name: Check commit message using commitlint
description: Lint commit message against @commitlint/config-conventional rules
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
- id: commitlint-travis
stages: [manual]
additional_dependencies: ['@commitlint/config-conventional@8.3.4']
always_run: true
- repo: https://github.com/rubocop-hq/rubocop
rev: v1.30.1
hooks:
- id: rubocop
name: Check Ruby files with rubocop
args: [--debug]
always_run: true
pass_filenames: false
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
hooks:
- id: shellcheck
name: Check shell scripts with shellcheck
files: ^.*\.(sh|bash|ksh)$
types: []
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
hooks:
- id: yamllint
name: Check YAML syntax with yamllint
args: [--strict, '.']
always_run: true
pass_filenames: false
- repo: https://github.com/warpnet/salt-lint
rev: v0.8.0
hooks:
- id: salt-lint
name: Check Salt files using salt-lint
files: ^.*\.(sls|jinja|j2|tmpl|tst)$
- repo: https://github.com/myint/rstcheck
rev: 3f929574
hooks:
- id: rstcheck
name: Check reST files using rstcheck
exclude: 'docs/CHANGELOG.rst'
- repo: https://github.com/saltstack-formulas/mirrors-rst-lint
rev: v1.3.2
hooks:
- id: rst-lint
name: Check reST files using rst-lint
exclude: |
(?x)^(
docs/CHANGELOG.rst|
docs/TOFS_pattern.rst|
docs/CONTRIBUTING_DOCS.rst|
docs/index.rst|
)$
additional_dependencies: [pygments==2.9.0]
23 changes: 23 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
# General overrides used across formulas in the org
Layout/LineLength:
# Increase from default of `80`
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
Max: 88
Metrics/BlockLength:
IgnoredMethods:
- control
- describe
# Increase from default of `25`
Max: 30
Security/YAMLLoad:
Exclude:
- test/integration/**/_mapdata.rb

# General settings across all cops in this formula
AllCops:
NewCops: enable

# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config`
14 changes: 14 additions & 0 deletions .salt-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
exclude_paths: []
rules: {}
skip_list:
# Using `salt-lint` for linting other files as well, such as Jinja macros/templates
- 205 # Use ".sls" as a Salt State file extension
# Skipping `207` and `208` because `210` is sufficient, at least for the time-being
# I.e. Allows 3-digit unquoted codes to still be used, such as `644` and `755`
- 207 # File modes should always be encapsulated in quotation marks
- 208 # File modes should always contain a leading zero
tags: []
verbosity: 1
43 changes: 43 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- 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 `.bundle/`, introduced if gems are installed locally
# 2. All YAML files under directory `.cache/`, introduced during the CI run
# 3. All YAML files under directory `.git/`
# 4. All YAML files under directory `node_modules/`, introduced during the CI run
# 5. Any SLS files under directory `test/`, which are actually state files
# 6. Any YAML files under directory `.kitchen/`, introduced during local testing
# 7. `kitchen.vagrant.yml`, which contains Embedded Ruby (ERB) template syntax
ignore: |
.bundle/
.cache/
.git/
node_modules/
test/**/states/**/*.sls
.kitchen/
kitchen.vagrant.yml
yaml-files:
# Default settings
- '*.yaml'
- '*.yml'
- .salt-lint
- .yamllint
# SaltStack Formulas additional settings
- '*.example'
- test/**/*.sls

rules:
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
line-length:
# Increase from default of `80`
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
max: 88
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
source "https://rubygems.org"
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'kitchen-docker', '>= 2.9'
gem 'kitchen-salt', '>= 0.6.0'
gem 'kitchen-inspec', '>= 1.1'
gem 'kitchen-salt', '>= 0.6.0'
2 changes: 1 addition & 1 deletion alcali/config/file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ alcali-config-file-file-managed:
- name: {{ alcali.deploy.directory }}/.env
- user: {{ alcali.deploy.user }}
- group: {{ alcali.deploy.group }}
- mode: 0400
- mode: "0400"
- contents: |
# Salt managed configuration
{%- for entry, value in alcali.config.items() %}
Expand Down
4 changes: 2 additions & 2 deletions alcali/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ alcali:
group: alcali
directory: /opt/alcali
runtime: python3
force_reset: False
force_reset: false
service:
name: alcali
init_delay: null
gunicorn:
name: 'config.wsgi:application'
host: '0.0.0.0'
port: 5000
workers: {{ grains['num_cpus'] }}
workers: 4
timeout: 300
# All the items under this section will be converted into an environment file.
config:
Expand Down
10 changes: 5 additions & 5 deletions alcali/files/alcali.rc.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
name="alcali"
rcvar=alcali_enable
pidfile="{{ directory }}/alcali.pid"
alcali_user={{ user }}
alcali_group={{ group }}
alcali_chdir={{ directory }}/code
alcali_env_file={{ directory }}/.env
alcali_user={{ user }}
alcali_group={{ group }}
alcali_chdir={{ directory }}/code
alcali_env_file={{ directory }}/.env
procname={{ directory }}/.venv/bin/python
command={{ directory }}/.venv/bin/gunicorn
command_args="{{ name }} --daemon -p ${pidfile} --bind {{ host }}:{{ port }} -w {{ workers }} -t {{ timeout }}"
command_args="{{ name }} --daemon -p ${pidfile} --bind {{ host }}:{{ port }} -w {{ workers }} -t {{ timeout }}"
load_rc_config ${name}
run_rc_command "$1"
2 changes: 1 addition & 1 deletion alcali/files/alcali.service.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ EnvironmentFile={{ directory }}/.env
SyslogIdentifier={{ service }}
User={{ user }}
Group={{ group }}
ExecStart={{ directory }}/.venv/bin/gunicorn {{ name }} --bind {{ host }}:{{ port }} -w {{ workers }} -t {{ timeout }}
ExecStart={{ directory }}/.venv/bin/gunicorn {{ name }} --bind {{ host }}:{{ port }} -w {{ workers }} -t {{ timeout }}
WorkingDirectory={{ directory }}/code
Restart=always

Expand Down
2 changes: 1 addition & 1 deletion alcali/package/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# vim: ft=sls

include:
- .install
- .install
17 changes: 9 additions & 8 deletions bin/kitchen
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("../bundle", __FILE__)
bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
Replace `bin/bundle` by running `bundle binstubs bundler --force`,
then run this command again.")
end
end

require "rubygems"
require "bundler/setup"
require 'rubygems'
require 'bundler/setup'

load Gem.bin_path("test-kitchen", "kitchen")
load Gem.bin_path('test-kitchen', 'kitchen')
7 changes: 3 additions & 4 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ alcali:
deploy:
repository: https://github.com/latenighttales/alcali.git
rev: v3003.1.0 # You can specify branch or tag
force_reset: False
force_reset: false
user: alcali
group: alcali
directory: /opt/alcali
Expand All @@ -17,8 +17,8 @@ alcali:
name: 'config.wsgi:application'
host: '0.0.0.0'
port: 5000
workers: {{ grains['num_cpus'] }}
timeout: 300
workers: 4

# All the items under this section will be converted into an environment file.
config:
allowed_hosts: '*'
Expand Down Expand Up @@ -58,4 +58,3 @@ alcali:
# auth_ldap_user_attr_map_first_name: givenName
# auth_ldap_user_attr_map_last_name: sn
# auth_ldap_user_attr_map_email: mail

12 changes: 8 additions & 4 deletions test/integration/default/controls/packages_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# frozen_string_literal: true

# Overide by OS
package_name = 'bash'
if os[:name] == 'centos' and os[:release].start_with?('6')
package_name = 'cronie'
end
package_name =
if os[:name] == 'centos' && os[:release].start_with?('6')
'cronie'
else
'bash'
end

control 'alcali package' do
title 'should be installed'
Expand Down