diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..1cc8c26
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,68 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: '[BUG] '
+labels: 'bug'
+assignees: ''
+
+---
+
+
+
+## Your setup
+### Formula commit hash / release tag
+
+
+
+
+### Versions reports (master & minion)
+
+
+
+
+### Pillar / config used
+
+
+
+
+---
+
+## Bug details
+### Describe the bug
+
+
+
+
+### Steps to reproduce the bug
+
+
+
+
+
+
+### Expected behaviour
+
+
+
+
+### Attempts to fix the bug
+
+
+
+
+### Additional context
+
+
+
+
+---
+
+### Meta: How can this template be improved?
+
+
+
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..be8be36
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,42 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: '[FEATURE] '
+labels: 'enhancement'
+assignees: ''
+
+---
+
+
+
+### Is your feature request related to a problem?
+
+
+
+
+### Describe the solution you'd like
+
+
+
+
+### Describe alternatives you've considered
+
+
+
+
+### Additional context
+
+
+
+
+---
+
+### Meta: How can this template be improved?
+
+
+
diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 0000000..5e836b3
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
+# General overrides used across formulas in the org
+Metrics/LineLength:
+ # Increase from default of `80`
+ # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
+ Max: 88
+
+# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config`
+Metrics/BlockLength:
+ Max: 55
diff --git a/.salt-lint b/.salt-lint
new file mode 100644
index 0000000..a539954
--- /dev/null
+++ b/.salt-lint
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+# vim: ft=yaml
+---
+exclude_paths: []
+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
diff --git a/.travis.yml b/.travis.yml
index 7239ea1..ad1855a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,56 +1,70 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
-stages:
- - test
- - lint
- - name: release
- if: branch = master AND type != pull_request
-
+## Machine config
+dist: bionic
sudo: required
-cache: bundler
-language: ruby
-dist: xenial
-
services:
- docker
-# Make sure the instances listed below match up with
-# the `platforms` defined in `kitchen.yml`
-env:
- matrix:
- - INSTANCE: repositories-debian-9-develop-py3
- - INSTANCE: preferences-debian-9-develop-py3
- # - INSTANCE: repositories-ubuntu-1804-develop-py3
- # - INSTANCE: preferences-ubuntu-1804-develop-py3
- - INSTANCE: repositories-debian-9-2019-2-py3
- - INSTANCE: preferences-debian-9-2019-2-py3
- - INSTANCE: repositories-ubuntu-1804-2019-2-py3
- - INSTANCE: preferences-ubuntu-1804-2019-2-py3
+## Language and cache config
+language: ruby
+cache: bundler
+## Script to run for the test stage
script:
- - bin/kitchen verify ${INSTANCE}
+ - bin/kitchen verify "${INSTANCE}"
+## Stages and jobs matrix
+stages:
+ - test
+ - name: release
+ if: branch = master AND type != pull_request
jobs:
include:
- # Define the `lint` stage (runs `yamllint` and `commitlint`)
- - stage: lint
- language: node_js
+ ## Define the test stage that runs the linters (and testing matrix, if applicable)
+
+ # Run all of the linters in a single job
+ - language: node_js
node_js: lts/*
+ env: Lint
+ name: 'Lint: salt-lint, yamllint, rubocop & commitlint'
before_install: skip
script:
+ # Install and run `salt-lint`
+ - pip install --user salt-lint
+ - git ls-files | grep '\.sls$\|\.jinja$\|\.j2$\|\.tmpl$'
+ | xargs -I {} salt-lint {}
# Install and run `yamllint`
- - pip install --user yamllint
- # yamllint disable-line rule:line-length
- - yamllint -s . .yamllint pillar.example test/salt/pillar/repositories.pillar.sls test/salt/pillar/preferences.pillar.sls
+ # Need at least `v1.17.0` for the `yaml-files` setting
+ - pip install --user yamllint>=1.17.0
+ - yamllint -s .
+ # Install and run `rubocop`
+ - gem install rubocop
+ - rubocop -d
# Install and run `commitlint`
- npm install @commitlint/config-conventional -D
- npm install @commitlint/travis-cli -D
- commitlint-travis
- # Define the release stage that runs `semantic-release`
+
+ ## Define the rest of the matrix based on Kitchen testing
+ # Make sure the instances listed below match up with
+ # the `platforms` defined in `kitchen.yml`
+ - env: INSTANCE=repositories-debian-10-develop-py3
+ # - env: INSTANCE=preferences-debian-10-develop-py3
+ # - env: INSTANCE=repositories-ubuntu-1804-develop-py3
+ # - env: INSTANCE=preferences-ubuntu-1804-develop-py3
+ - env: INSTANCE=repositories-debian-9-2019-2-py3
+ - env: INSTANCE=preferences-debian-9-2019-2-py3
+ - env: INSTANCE=repositories-ubuntu-1804-2019-2-py3
+ - env: INSTANCE=preferences-ubuntu-1804-2019-2-py3
+
+ ## Define the release stage that runs `semantic-release`
- stage: release
language: node_js
node_js: lts/*
+ env: Release
+ name: 'Run semantic-release inc. file updates to AUTHORS, CHANGELOG & FORMULA'
before_install: skip
script:
# Update `AUTHORS.md`
diff --git a/.yamllint b/.yamllint
index 3a90f57..740beca 100644
--- a/.yamllint
+++ b/.yamllint
@@ -6,11 +6,31 @@ extends: default
# Files to ignore completely
# 1. All YAML files under directory `node_modules/`, introduced during the Travis run
+# 2. Any SLS files under directory `test/`, which are actually state files
+# 3. Any YAML files under directory `.kitchen/`, introduced during local testing
ignore: |
node_modules/
+ test/**/states/**/*.sls
+ .kitchen/
+
+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
diff --git a/AUTHORS.md b/AUTHORS.md
index 2fd3855..91eaa6c 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -5,13 +5,13 @@ This list is sorted by the number of commits per contributor in _descending_ ord
Avatar|Contributor|Contributions
:-:|---|:-:
|[@javierbertoli](https://github.com/javierbertoli)|26
+
|[@myii](https://github.com/myii)|19
|[@gravyboat](https://github.com/gravyboat)|12
|[@bmcclure](https://github.com/bmcclure)|8
-
|[@myii](https://github.com/myii)|8
|[@arthurlogilab](https://github.com/arthurlogilab)|7
+
|[@aboe76](https://github.com/aboe76)|7
|[@nmadhok](https://github.com/nmadhok)|7
|[@boltronics](https://github.com/boltronics)|5
-
|[@aboe76](https://github.com/aboe76)|5
|[@jdkelleher](https://github.com/jdkelleher)|5
|[@westurner](https://github.com/westurner)|4
|[@daschatten](https://github.com/daschatten)|4
@@ -22,7 +22,8 @@ Avatar|Contributor|Contributions
|[@rpatterson](https://github.com/rpatterson)|1
|[@simonclausen](https://github.com/simonclausen)|1
|[@babilen5](https://github.com/babilen5)|1
+
|[@daks](https://github.com/daks)|1
---
-Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2019-08-07.
+Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2019-10-09.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b2d9956..ac0387d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,22 @@
# Changelog
+## [0.9.1](https://github.com/saltstack-formulas/apt-formula/compare/v0.9.0...v0.9.1) (2019-10-09)
+
+
+### Bug Fixes
+
+* **rubocop:** add fixes using `rubocop --safe-auto-correct` ([](https://github.com/saltstack-formulas/apt-formula/commit/67de777))
+* **rubocop:** fix remaining errors manually ([](https://github.com/saltstack-formulas/apt-formula/commit/62d20bc))
+
+
+### Continuous Integration
+
+* **kitchen:** change `log_level` to `debug` instead of `info` ([](https://github.com/saltstack-formulas/apt-formula/commit/78a2a91))
+* **kitchen+travis:** replace EOL pre-salted images ([](https://github.com/saltstack-formulas/apt-formula/commit/04847bb))
+* **travis:** use `dist: bionic` ([](https://github.com/saltstack-formulas/apt-formula/commit/2ca242a))
+* **yamllint:** add rule `empty-values` & use new `yaml-files` setting ([](https://github.com/saltstack-formulas/apt-formula/commit/55212e0))
+* merge travis matrix, add `salt-lint` & `rubocop` to `lint` job ([](https://github.com/saltstack-formulas/apt-formula/commit/b50ef71))
+
# [0.9.0](https://github.com/saltstack-formulas/apt-formula/compare/v0.8.1...v0.9.0) (2019-08-07)
diff --git a/FORMULA b/FORMULA
index 4028edf..bca4a2a 100644
--- a/FORMULA
+++ b/FORMULA
@@ -1,7 +1,7 @@
name: apt
os: Debian, Ubuntu, Raspbian
os_family: Debian
-version: 0.9.0
+version: 0.9.1
release: 1
minimum_version: 2017.7
summary: Apt formula
diff --git a/Gemfile b/Gemfile
index 3b36de3..5a232b6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +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'
diff --git a/bin/kitchen b/bin/kitchen
index 1cd44f3..dcfdb4c 100755
--- a/bin/kitchen
+++ b/bin/kitchen
@@ -8,22 +8,25 @@
# 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.")
+ 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.'
+ )
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')
diff --git a/docs/AUTHORS.rst b/docs/AUTHORS.rst
index eef6b8c..f489c83 100644
--- a/docs/AUTHORS.rst
+++ b/docs/AUTHORS.rst
@@ -16,27 +16,27 @@ This list is sorted by the number of commits per contributor in *descending* ord
* - :raw-html-m2r:`
`
- `@javierbertoli `_
- 26
+ * - :raw-html-m2r:`
`
+ - `@myii `_
+ - 19
* - :raw-html-m2r:`
`
- `@gravyboat `_
- 12
* - :raw-html-m2r:`
`
- `@bmcclure `_
- 8
- * - :raw-html-m2r:`
`
- - `@myii `_
- - 8
* - :raw-html-m2r:`
`
- `@arthurlogilab `_
- 7
+ * - :raw-html-m2r:`
`
+ - `@aboe76 `_
+ - 7
* - :raw-html-m2r:`
`
- `@nmadhok `_
- 7
* - :raw-html-m2r:`
`
- `@boltronics `_
- 5
- * - :raw-html-m2r:`
`
- - `@aboe76 `_
- - 5
* - :raw-html-m2r:`
`
- `@jdkelleher `_
- 5
@@ -67,8 +67,11 @@ This list is sorted by the number of commits per contributor in *descending* ord
* - :raw-html-m2r:`
`
- `@babilen5 `_
- 1
+ * - :raw-html-m2r:`
`
+ - `@daks `_
+ - 1
----
-Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2019-08-07.
+Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2019-10-09.
diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst
index 21cfab1..0321dc9 100644
--- a/docs/CHANGELOG.rst
+++ b/docs/CHANGELOG.rst
@@ -2,6 +2,26 @@
Changelog
=========
+`0.9.1 `_ (2019-10-09)
+-----------------------------------------------------------------------------------------------------
+
+Bug Fixes
+^^^^^^^^^
+
+
+* **rubocop:** add fixes using ``rubocop --safe-auto-correct`` (\ ` `_\ )
+* **rubocop:** fix remaining errors manually (\ ` `_\ )
+
+Continuous Integration
+^^^^^^^^^^^^^^^^^^^^^^
+
+
+* **kitchen:** change ``log_level`` to ``debug`` instead of ``info`` (\ ` `_\ )
+* **kitchen+travis:** replace EOL pre-salted images (\ ` `_\ )
+* **travis:** use ``dist: bionic`` (\ ` `_\ )
+* **yamllint:** add rule ``empty-values`` & use new ``yaml-files`` setting (\ ` `_\ )
+* merge travis matrix, add ``salt-lint`` & ``rubocop`` to ``lint`` job (\ ` `_\ )
+
`0.9.0 `_ (2019-08-07)
-----------------------------------------------------------------------------------------------------
diff --git a/kitchen.yml b/kitchen.yml
index 0753908..3b06985 100644
--- a/kitchen.yml
+++ b/kitchen.yml
@@ -12,9 +12,9 @@ driver:
# the `env.matrix` instances defined in `.travis.yml`
platforms:
## SALT `develop`
- - name: debian-9-develop-py3
+ - name: debian-10-develop-py3
driver:
- image: netmanagers/salt-develop-py3:debian-9
+ image: netmanagers/salt-develop-py3:debian-10
provision_command:
- curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com
- sh bootstrap-salt.sh -XdPbfrq -x python3 git develop
@@ -35,7 +35,7 @@ platforms:
provisioner:
name: salt_solo
- log_level: info
+ log_level: debug
salt_install: none
require_chef: false
formula: apt
diff --git a/test/integration/preferences/controls/preferences_spec.rb b/test/integration/preferences/controls/preferences_spec.rb
index 148cd1f..e2d2f99 100644
--- a/test/integration/preferences/controls/preferences_spec.rb
+++ b/test/integration/preferences/controls/preferences_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
control 'Apt preferences' do
title 'should be configured'
@@ -18,7 +20,11 @@
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
- its(:content) { should match("Package: rspamd\nPin: origin rspamd.com\nPin-Priority: 650\n") }
+ its(:content) do
+ should match(
+ "Package: rspamd\nPin: origin rspamd.com\nPin-Priority: 650\n"
+ )
+ end
end
describe file('/etc/apt/preferences.d/01-all') do
@@ -26,7 +32,11 @@
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
- its(:content) { should match("Package: *\nPin: release stable\nPin-Priority: 610\n") }
+ its(:content) do
+ should match(
+ "Package: *\nPin: release stable\nPin-Priority: 610\n"
+ )
+ end
end
describe file('/etc/apt/preferences.d/02-all') do
@@ -34,7 +44,11 @@
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
- its(:content) { should match("Package: *\nPin: release testing\nPin-Priority: 600\n") }
+ its(:content) do
+ should match(
+ "Package: *\nPin: release testing\nPin-Priority: 600\n"
+ )
+ end
end
describe file('/etc/apt/preferences.d/03-all') do
@@ -42,6 +56,10 @@
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
- its(:content) { should match("Package: *\nPin: release unstable\nPin-Priority: 50\n") }
+ its(:content) do
+ should match(
+ "Package: *\nPin: release unstable\nPin-Priority: 50\n"
+ )
+ end
end
end
diff --git a/test/integration/repositories/controls/repositories_spec.rb b/test/integration/repositories/controls/repositories_spec.rb
index 3031d22..8935a27 100644
--- a/test/integration/repositories/controls/repositories_spec.rb
+++ b/test/integration/repositories/controls/repositories_spec.rb
@@ -1,11 +1,13 @@
+# frozen_string_literal: true
+
control 'Apt repositories' do
title 'should be configured'
- if os[:name] == 'ubuntu'
- keyring_package = 'ubuntu-keyring'
- else
- keyring_package = 'debian-archive-keyring'
- end
+ keyring_package = if os[:name] == 'ubuntu'
+ 'ubuntu-keyring'
+ else
+ 'debian-archive-keyring'
+ end
describe package(keyring_package) do
it { should be_installed }
@@ -28,7 +30,11 @@
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
- its(:content) { should match(%r{deb \[arch=amd64\] http://repository.spotify.com stable non-free}) }
+ its(:content) do
+ should match(
+ %r{deb \[arch=amd64\] http://repository.spotify.com stable non-free}
+ )
+ end
end
describe file('/etc/apt/sources.list.d/heroku-binary.list') do
@@ -36,6 +42,10 @@
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
- its(:content) { should match(%r{deb \[arch=amd64\] https://cli-assets.heroku.com/apt ./}) }
+ its(:content) do
+ should match(
+ %r{deb \[arch=amd64\] https://cli-assets.heroku.com/apt ./}
+ )
+ end
end
end