diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..bdae9aa --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,10 @@ +# -*- 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` diff --git a/.salt-lint b/.salt-lint new file mode 100644 index 0000000..3715677 --- /dev/null +++ b/.salt-lint @@ -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 diff --git a/.travis.yml b/.travis.yml index 43180fa..3149075 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,17 +54,6 @@ jobs: ## 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` - # NOTE: Please try to select up to six instances that add some meaningful - # testing of the formula's behaviour. If possible, try to refrain from - # the classical "chosing all the instances because I want to test on - # another/all distro/s" trap: it will just add time to the testing (see - # the discussion on #121). As an example, the set chosen below covers - # the most used distros families, systemd and non-systemd and the latest - # three supported Saltstack versions with python2 and 3. - # As for `kitchen.yml`, that should still contain all of the platforms, - # to allow for comprehensive local testing - # Ref: https://github.com/saltstack-formulas/template-formula/issues/118 - # Ref: https://github.com/saltstack-formulas/template-formula/issues/121 - env: INSTANCE=default-debian-10-master-py3 # - env: INSTANCE=default-ubuntu-1804-master-py3 # - env: INSTANCE=default-centos-8-master-py3 @@ -115,8 +104,9 @@ jobs: @semantic-release/git@7 deploy: provider: 'script' - # Using deprecated `skip_cleanup` until `cleanup: false` works reliably - # cleanup: false - skip_cleanup: true + # Opt-in to `dpl v2` to complete the Travis build config validation (beta) + # * https://docs.travis-ci.com/user/build-config-validation + # Deprecated `skip_cleanup` can now be avoided, `cleanup: false` is by default + edge: true # Run `semantic-release` script: 'npx semantic-release@15' diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..740beca --- /dev/null +++ b/.yamllint @@ -0,0 +1,36 @@ +# -*- 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 +# 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/kitchen.yml b/kitchen.yml index 86e1563..edb920c 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -177,8 +177,6 @@ verifier: suites: - name: default - excludes: - - centos-6-2017-7-py2 provisioner: state_top: base: diff --git a/nfs/client.sls b/nfs/client.sls index 4e910fb..ec99dca 100644 --- a/nfs/client.sls +++ b/nfs/client.sls @@ -4,4 +4,4 @@ nfs-client: pkg.installed: - pkgs: {{ nfs.pkgs_client|json }} -{% endif %} +{% endif %} diff --git a/nfs/defaults.yaml b/nfs/defaults.yaml index 901e81c..a920b24 100644 --- a/nfs/defaults.yaml +++ b/nfs/defaults.yaml @@ -1,8 +1,9 @@ +--- nfs: - mount_opts: None - mkmnt: True - persist_mount: True - persist_unmount: False + mount_opts: None + mkmnt: true + persist_mount: true + persist_unmount: false exports_file: '/etc/exports' export_template: 'salt://nfs/files/exports' # for most Linux distributions: diff --git a/nfs/map.jinja b/nfs/map.jinja index 24ef1d3..bd681a4 100644 --- a/nfs/map.jinja +++ b/nfs/map.jinja @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # vim: ft=jinja -{## Start with defaults from defaults.yaml ##} +{# Start with defaults from defaults.yaml #} {% import_yaml 'nfs/defaults.yaml' as defaults %} {% import_yaml 'nfs/osfamilymap.yaml' as osfamilymap %} {% import_yaml 'nfs/osmap.yaml' as osmap %} diff --git a/nfs/mount.sls b/nfs/mount.sls index d94394a..8319b24 100644 --- a/nfs/mount.sls +++ b/nfs/mount.sls @@ -11,7 +11,7 @@ include: {# Not every platform needs options #} {% if 'opts' in m[1] or nfs.mount_opts %} - opts: {{ m[1].opts|default(nfs.mount_opts) }} -{% endif %} +{% endif %} - persist: {{ m[1].persist|default(nfs.persist_mount) }} - mkmnt: {{ m[1].mkmnt|default(nfs.mkmnt) }} {% endfor %} diff --git a/nfs/osfingermap.yaml b/nfs/osfingermap.yaml index 467cbd5..cee807b 100644 --- a/nfs/osfingermap.yaml +++ b/nfs/osfingermap.yaml @@ -1,2 +1,3 @@ +--- Debian-8: service_name: 'nfs-kernel-server' diff --git a/nfs/server.sls b/nfs/server.sls index 9ba87c7..d45a170 100644 --- a/nfs/server.sls +++ b/nfs/server.sls @@ -4,7 +4,7 @@ nfs-server-deps: pkg.installed: - pkgs: {{ nfs.pkgs_server|json }} -{% endif %} +{% endif %} nfs-exports-configure: file.managed: @@ -16,11 +16,11 @@ nfs-exports-configure: nfs-service: service.running: -{% if nfs.service_name is string %} +{% if nfs.service_name is string %} - name: {{ nfs.service_name }} -{% elif nfs.service_name is iterable %} +{% elif nfs.service_name is iterable %} - names: {{ nfs.service_name }} -{% endif %} +{% endif %} - enable: True {% if grains.get('os') == 'FreeBSD' %} diff --git a/pillar.example b/pillar.example index 4225b79..40727ce 100644 --- a/pillar.example +++ b/pillar.example @@ -1,14 +1,17 @@ +--- nfs: # Global settings: - mkmnt: False + mkmnt: false mount_opts: noauto,ro - persist_unmount: True - persist_mount: False - + persist_unmount: true + persist_mount: false + # Server settings server: - exports: - /srv/homes: "hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)" + exports: + /srv/homes: >- + hostname1(rw,sync,no_subtree_check) + hostname2(ro,sync,no_subtree_check) # FreeBSD specific: mountd_flags: -l -S @@ -18,11 +21,10 @@ nfs: mountpoint: "/some/path" location: "hostname:/path" opts: "vers=3,rsize=65535,wsize=65535" - persist: True - mkmnt: True + persist: true + mkmnt: true unmount: someothername: mountpoint: "/some/other/path" location: "hostname:/other/path" - persist: False - + persist: false