From 09dce4cb54dafbd2863cbb442ec8d2243b3ba47b Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Sat, 12 Aug 2023 11:48:25 -0400 Subject: [PATCH] Convert to tailoredautomation/pdk-templates --- .devcontainer/devcontainer.json | 2 +- .github/workflows/ci.yaml | 96 ++ .github/workflows/ci.yml | 92 -- .github/workflows/release.yaml | 31 + .pdkignore | 3 +- .puppet-lint.rc | 4 +- .rubocop.yml | 8 + .sync.yml | 7 +- CONTRIBUTING.md | 6 + Gemfile | 43 +- README.md | 1560 ++++++++++++++++++++++ Rakefile | 26 +- metadata.json | 6 +- pdk.yaml | 2 + spec/acceptance/nodesets/debian-10.yml | 24 + spec/acceptance/nodesets/debian-11.yml | 27 + spec/acceptance/nodesets/el8.yml | 25 + spec/acceptance/nodesets/el9.yml | 25 + spec/acceptance/nodesets/ubuntu-2004.yml | 24 + spec/acceptance/nodesets/ubuntu-2204.yml | 24 + spec/spec_helper_acceptance.rb | 20 + 21 files changed, 1922 insertions(+), 133 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yaml create mode 100644 CONTRIBUTING.md create mode 100644 README.md create mode 100644 pdk.yaml create mode 100644 spec/acceptance/nodesets/debian-10.yml create mode 100644 spec/acceptance/nodesets/debian-11.yml create mode 100644 spec/acceptance/nodesets/el8.yml create mode 100644 spec/acceptance/nodesets/el9.yml create mode 100644 spec/acceptance/nodesets/ubuntu-2004.yml create mode 100644 spec/acceptance/nodesets/ubuntu-2204.yml create mode 100644 spec/spec_helper_acceptance.rb diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index cdd65d2..fe7a8b1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "settings": { "terminal.integrated.profiles.linux": { "bash": { - "path": "bash" + "path": "bash", } } }, diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..4b86b00 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,96 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: + +jobs: + unit: + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.allow_failure }} + strategy: + fail-fast: false + matrix: + include: + - ruby: 2.7.8 + puppet: 7 + fixtures: .fixtures.yml + allow_failure: false + - ruby: 2.7.8 + puppet: 7 + fixtures: .fixtures-latest.yml + allow_failure: true + - ruby: 3.2.2 + puppet: 8 + fixtures: .fixtures.yml + allow_failure: false + - ruby: 3.2.2 + puppet: 8 + fixtures: .fixtures-latest.yml + allow_failure: true + env: + BUNDLE_WITHOUT: system_tests:release + PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}.0" + FIXTURES_YML: ${{ matrix.fixtures }} + name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }} fixtures=${{ matrix.fixtures }}) + steps: + - uses: actions/checkout@v3 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + cache-version: 2 + bundler: '2.1.0' + - name: Validate + run: bundle exec rake check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint + - name: Run tests + run: bundle exec rake parallel_spec +# Disabled as there are no acceptance tests +# acceptance: +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# set: +# - "el8" +# - "el9" +# - "debian-10" +# - "debian-11" +# - "ubuntu-2004" +# - "ubuntu-2204" +# puppet: +# - "puppet7" +# - "puppet8" +# env: +# BUNDLE_WITHOUT: development:release +# BEAKER_debug: true +# name: +# steps: +# - name: Enable IPv6 on docker +# run: | +# echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json +# sudo service docker restart +# # https://github.com/actions/virtual-environments/issues/181#issuecomment-610874237 +# - name: apparmor +# run: | +# set -x +# sudo apt-get remove mysql-server --purge +# sudo apt-get install apparmor-profiles +# sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld +# - uses: actions/checkout@v3 +# - name: Setup ruby +# uses: ruby/setup-ruby@v1 +# with: +# ruby-version: '2.7' +# bundler-cache: true +# cache-version: 2 +# bundler: '2.1.0' +# - name: Run tests +# run: bundle exec rake beaker +# env: +# BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }} +# BEAKER_set: ${{ matrix.set }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 5c39551..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,92 +0,0 @@ ---- -name: CI - -on: pull_request - -concurrency: - group: ${{ github.head_ref }} - cancel-in-progress: true - -jobs: - setup_matrix: - name: Setup Test Matrix - runs-on: ubuntu-20.04 - timeout-minutes: 40 - outputs: - puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} - github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} - steps: - - uses: actions/checkout@v3 - - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7.3' - bundler-cache: true - - - name: Run static validations - run: bundle exec rake validate lint - - - name: Run rake rubocop - run: bundle exec rake rubocop - - - name: Setup Test Matrix - id: get-outputs - run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false - - unit: - needs: setup_matrix - runs-on: ubuntu-20.04 - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} - name: Spec Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - steps: - - uses: actions/checkout@v3 - - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - - name: Run tests - run: bundle exec rake parallel_spec - -# TODO: active when acceptance tests have been added -# acceptance: -# name: Litmus Acceptance -# runs-on: ubuntu-20.04 -# env: -# BOLT_GEM: true -# CI: true -# steps: -# - uses: actions/checkout@v3 -# - name: Setup ruby -# uses: ruby/setup-ruby@v1 -# with: -# ruby-version: '2.7.3' -# bundler-cache: true -# -# - name: Provision Testing Environments -# run: | -# bundle exec rake 'litmus:provision_list[default]' -# bundle exec rake 'litmus:install_agent' -# bundle exec rake 'litmus:install_module' -# - name: Run Tests -# run: bundle exec rake 'litmus:acceptance:parallel' -# -# - name: Tear Down -# run: bundle exec rake 'litmus:tear_down' - - tests: - needs: - - unit -# TODO: active when acceptance tests have been added -# - acceptance - runs-on: ubuntu-20.04 - name: Test suite - steps: - - run: echo Test suite completed diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..bed1e38 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,31 @@ +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + cache-version: 2 + bundler: '2.1.0' + - name: Build and Deploy + env: + # Configure secrets here: + # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets + BLACKSMITH_FORGE_USERNAME: 'ghoneycutt' + BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' + run: bundle exec rake module:push diff --git a/.pdkignore b/.pdkignore index a956c8f..fcf8a0e 100644 --- a/.pdkignore +++ b/.pdkignore @@ -27,18 +27,17 @@ /inventory.yaml /spec/fixtures/litmus_inventory.yaml /appveyor.yml -/.editorconfig /.fixtures.yml /Gemfile /.gitattributes /.gitignore /.gitlab-ci.yml /.pdkignore -/.puppet-lint.rc /Rakefile /rakelib/ /.rspec /.rubocop.yml +/.travis.yml /.yardopts /spec/ /.vscode/ diff --git a/.puppet-lint.rc b/.puppet-lint.rc index 4fa16f9..75071c7 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,3 +1,5 @@ ---relative --no-80chars-check --no-140chars-check +--no-manifest_whitespace_opening_brace_after-check +--relative +--fail_on_warnings diff --git a/.rubocop.yml b/.rubocop.yml index 31e8248..bb2b4a9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -71,12 +71,20 @@ Style/TrailingCommaInArrayLiteral: Style/SymbolArray: Description: Using percent style obscures symbolic intent of array's contents. EnforcedStyle: brackets +Layout/FirstHashElementIndentation: + Enabled: false +Performance/RegexpMatch: + Enabled: false RSpec/MessageSpies: EnforcedStyle: receive +RSpec/NamedSubject: + Enabled: false Style/Documentation: Exclude: - lib/puppet/parser/functions/**/* - spec/**/* +Style/HashEachMethods: + Enabled: false Style/WordArray: EnforcedStyle: brackets Performance/AncestorsInclude: diff --git a/.sync.yml b/.sync.yml index a0f08c3..dd767a3 100644 --- a/.sync.yml +++ b/.sync.yml @@ -15,10 +15,6 @@ appveyor.yml: Gemfile: unmanaged: false optional: - ':development': - - gem: 'github_changelog_generator' - version: '~> 1.15' - condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" ':test': # provides metadata2gha, needed for unit tests - gem: 'puppet_metadata' @@ -39,6 +35,9 @@ Rakefile: - '80chars' - '140chars' +.github/workflows/release.yaml: + username: ghoneycutt + # Disabled as the associate Ruby Gem has unmet dependency issues (2021-07-26) #Rakefile: # extras: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5e35566 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,6 @@ +# Release Process + +1. Update metadata.json version, eg: `pdk bundle exec rake module:bump:{major,minor,patch}` +1. Run release task, eg: `pdk bundle exec rake release` +1. Update GitHub pages, eg: `pdk bundle exec rake strings:gh_pages:update` +1. Push to GitHub: `git push --tags origin main` diff --git a/Gemfile b/Gemfile index 9584486..dd18e5c 100644 --- a/Gemfile +++ b/Gemfile @@ -13,32 +13,27 @@ def location_for(place_or_version, fake_version = nil) end end +ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments +minor_version = ruby_version_segments[0..1].join('.') + group :development do - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "voxpupuli-puppet-lint-plugins", '~> 4.0', require: false - gem "facterdb", '~> 1.18', require: false - gem "metadata-json-lint", '>= 2.0.2', '< 4.0.0', require: false - gem "puppetlabs_spec_helper", '~> 5.0', require: false - gem "rspec-puppet-facts", '~> 2.0', require: false - gem "codecov", '~> 0.2', require: false - gem "dependency_checker", '~> 0.2', require: false - gem "parallel_tests", '= 3.12.1', require: false - gem "pry", '~> 0.10', require: false - gem "simplecov-console", '~> 0.5', require: false - gem "puppet-debugger", '~> 1.0', require: false - gem "rubocop", '= 1.6.1', require: false - gem "rubocop-performance", '= 1.9.1', require: false - gem "rubocop-rspec", '= 2.0.1', require: false - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "github_changelog_generator", '~> 1.15', require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0') + gem "voxpupuli-test", '6.0.0', require: false + gem "rubocop-performance", '~> 1.18', require: false + gem "faraday", '~> 1.0', require: false + gem "github_changelog_generator", require: false + gem "puppet-blacksmith", require: false + gem "puppet-strings", require: false end group :system_tests do - gem "puppet_litmus", '< 1.0.0', require: false, platforms: [:ruby, :x64_mingw] - gem "serverspec", '~> 2.41', require: false + gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.29') + gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') + gem "beaker-pe", require: false + gem "beaker-hostgenerator" + gem "beaker-rspec" + gem "beaker-docker" + gem "beaker-puppet" + gem "beaker-puppet_install_helper", require: false + gem "beaker-module_install_helper", require: false end group :test do gem "puppet_metadata", '~> 1.9.0', require: false @@ -50,6 +45,8 @@ hiera_version = ENV['HIERA_GEM_VERSION'] gems = {} +gems['rake'] = [require: false] +gems['puppetlabs_spec_helper'] = [require: false] gems['puppet'] = location_for(puppet_version) # If facter or hiera versions have been specified via the environment diff --git a/README.md b/README.md new file mode 100644 index 0000000..062184e --- /dev/null +++ b/README.md @@ -0,0 +1,1560 @@ +# puppet-module-nscd +=== + +Puppet module to manage nscd, Linux's Name Service Cache Daemon. + +Recommend reading the man page, NSCD.CONF(5). This module allows for +parameterization of all options specified in the man page. + +The module assumes that you want to set enable-cache to true for each of the +services (passwd, group, hosts, and services). If this is not the case, you can +disable the cache on a per service basis. + +To use this module simply `include nscd` + +=== + +# Compatibility +--------------- +This module officially supports the platforms listed in the +`metadata.json`. It does not fail on unsupported platforms and has been +known to work on many, many platforms since its creation in 2013. + +* Amazon Linux 2015 +* Amazon Linux 2016 +* Amazon Linux 2017 +* Debian 6 +* EL 5 +* EL 6 +* EL 7 +* EL 8 +* Solaris 10 +* Suse 10 +* Suse 11 +* Suse 12 +* Suse 15 +* OpenSuse 13.1 +* Ubuntu 12.04 LTS + + +# Compatibility with Dell Authentication Services +------------------------------------------------- +When using nscd in combination with Dell Authentication Services (QAS/VAS) [1] it is recommended to turn off caching of passwd and groups. + +
+nscd::passwd_enable_cache: 'no'
+nscd::group_enable_cache:  'no'
+
+ +[1] http://software.dell.com/products/authentication-services/ + +=== + +# Parameters +------------ +All numbers should be type cast as strings. Global options for nscd.con can be accessed as parameters, with the dashes changed to underscores. Each per service option can be accessed as parameters and follow the naming scheme of `_