Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bschonec committed Aug 9, 2023
2 parents 60ed203 + b04915d commit 7b4719e
Show file tree
Hide file tree
Showing 16 changed files with 188 additions and 69 deletions.
7 changes: 7 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM mcr.microsoft.com/vscode/devcontainers/ruby:3

ENV DEBIAN_FRONTEND=noninteractive
RUN curl -L https://apt.puppet.com/puppet-tools-release-focal.deb -o /tmp/puppet-tools-release-focal.deb && \
sudo dpkg -i /tmp/puppet-tools-release-focal.deb && \
sudo apt-get update && \
sudo apt-get install pdk
7 changes: 7 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"build": { "dockerfile": "Dockerfile" },
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
}
}
4 changes: 2 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
concat: "https://github.com/puppetlabs/puppetlabs-concat.git"
augeasproviders_core: "https://github.com/hercules-team/augeasproviders_core.git"
augeasproviders_shellvar: "https://github.com/hercules-team/augeasproviders_shellvar.git"
augeasproviders_core: "https://github.com/voxpupuli/puppet-augeasproviders_core.git"
augeasproviders_shellvar: "https://github.com/voxpupuli/puppet-augeasproviders_shellvar.git"
augeas_core:
repo: "https://github.com/puppetlabs/puppetlabs-augeas_core.git"
puppet_version: ">= 6.0.0"
Expand Down
59 changes: 51 additions & 8 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,63 @@ on:
branches: [ master ]

jobs:
test-static:
test-static-current:
strategy:
fail-fast: false
matrix:
puppet: [5.0, 6.0, 7.0]
puppet: [7.22.0]
ruby: [2.7.7, 3.0.5, 3.1.3]

name: Static code analysis
runs-on: ubuntu-20.04
permissions:
contents: read

steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
env:
PUPPET_VERSION: ${{ matrix.puppet }}

- name: Run metadata lint
run: |
PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake metadata_lint
- name: Run puppet lint
run: |
PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake lint
- name: Run puppet syntax check
run: |
PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake syntax
- name: Run puppet rspec tests
run: |
PUPPET_VERSION=${{ matrix.puppet }} STRICT_VARIABLES=yes bundle exec rake spec
- name: Run rubocop tests
run: |
PUPPET_VERSION=${{ matrix.puppet }} bundle exec rake rubocop
test-static-old:
strategy:
fail-fast: false
matrix:
puppet: [5.5.22, 6.29.0]
ruby: [2.5.9, 2.6.9]

name: Static code analysis
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
permissions:
contents: read

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand Down Expand Up @@ -55,10 +98,10 @@ jobs:
fail-fast: false
matrix:
puppet: [puppet6, puppet7]
beakerset: [ubuntu-18.04, ubuntu-20.04, centos-7, debian-10, debian-11]
beakerset: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, centos-7, debian-10, debian-11]

name: Integration tests
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
permissions:
contents: read

Expand All @@ -68,7 +111,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.9
ruby-version: 2.6.9
bundler-cache: true
env:
BEAKER_set: ${{ matrix.beakerset }}
Expand All @@ -81,4 +124,4 @@ jobs:
env:
BEAKER_set: ${{ matrix.beakerset }}
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet }}
PUPPET_INSTALL_TYPE: agent
PUPPET_INSTALL_TYPE: agent
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require: rubocop-rspec

AllCops:
NewCops: enable
TargetRubyVersion: 2.5
NewCops: disable
TargetRubyVersion: 2.6
Include:
- '**/*.rb'
Exclude:
Expand Down
6 changes: 2 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ group :test do
gem 'puppet-lint-unquoted_string-check', require: false
gem 'puppet-lint-variable_contains_upcase', require: false
gem 'puppet-lint-version_comparison-check', require: false
gem 'puppet-strings', require: false, git: 'https://github.com/puppetlabs/puppetlabs-strings.git', branch: 'main'
gem 'puppet-strings', require: false
gem 'puppet-syntax', require: false
gem 'puppetlabs_spec_helper', require: false
gem 'semantic_puppet', require: false
gem 'rake', require: false
gem 'rspec', require: false
gem 'rspec-core', require: false
gem 'rspec-puppet', require: false, git: 'https://github.com/rodjek/rspec-puppet.git'
gem 'rspec-puppet', require: false, git: 'https://github.com/puppetlabs/rspec-puppet.git'
gem 'rspec-puppet-facts', require: false
gem 'rspec-puppet-utils', require: false
gem 'rubocop', require: false
Expand All @@ -38,8 +38,6 @@ end

group :development do
gem 'guard-rake', require: false
gem 'travis', require: false
gem 'travis-lint', require: false
end

if RUBY_VERSION >= '2.3.0'
Expand Down
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ifneq ($(origin PUPPET_VERSION), undefined)
puppet_version := ${PUPPET_VERSION}
else
puppet_version := 7.0
puppet_version := 7.20.0
endif

ifneq ($(origin STRICT_VARIABLES), undefined)
Expand All @@ -13,13 +13,15 @@ endif
ifneq ($(origin RVM), undefined)
rvm := ${RVM}
else
rvm := 2.5.0
rvm := 3.1.3
endif

export rvm_beaker := 2.6.9

ifneq ($(origin BEAKER_set), undefined)
beaker_set := ${BEAKER_set}
else
beaker_set := ubuntu-20.04
beaker_set := ubuntu-22.04
endif

ifneq ($(origin PUPPET_collection), undefined)
Expand All @@ -29,12 +31,12 @@ else
endif

DOCKER_CMD := docker run -it --rm -v $$(pwd):/puppet/module derdanne/rvm:$(rvm) /bin/bash -l -c
PREPARE := rm -f Gemfile.lock && $(DOCKER_CMD) "PUPPET_VERSION=$(puppet_version) bundle install --quiet --without system_tests development --path=vendor/bundle"
PREPARE := $(DOCKER_CMD) "PUPPET_VERSION=$(puppet_version)" bundle config set --local without 'system_tests development' path 'vendor/bundle' && rm -f Gemfile.lock && $(DOCKER_CMD) "PUPPET_VERSION=$(puppet_version) bundle install --quiet"

DOCKER_CMD_BEAKER := docker run --net host --privileged -it --rm -v $$(pwd):/puppet/module -v /var/run/docker.sock:/var/run/docker.sock derdanne/rvm:$(rvm) /bin/bash -l -c
PREPARE_BEAKER := rm -f Gemfile.lock && $(DOCKER_CMD) "bundle install --quiet --without system_tests development --path=vendor/bundle"
DOCKER_CMD_BEAKER := docker run --net host --privileged -it --rm -v $$(pwd):/puppet/module -v /var/run/docker.sock:/var/run/docker.sock derdanne/rvm:$(rvm_beaker) /bin/bash -l -c
PREPARE_BEAKER := rm -f Gemfile.lock && $(DOCKER_CMD_BEAKER) "bundle config set --local without 'system_tests development path 'vendor/bundle'' && bundle install --quiet"

VARIABLES := echo "PUPPET_VERSION=$(puppet_version), STRICT_VARIABLES=$(strict_variables), RVM=$(rvm)"
VARIABLES := echo "PUPPET_VERSION=$(puppet_version), STRICT_VARIABLES=$(strict_variables), RVM=$(rvm), RVM_BEAKER=$(rvm_beaker)"

build:
@cd spec/local-testing && docker build --squash --build-arg RUBY_VERSION=$(rvm) -t derdanne/rvm:$(rvm) .
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,12 @@ This will mount /data on client in /share/data.

##### `nfs_v4`
Boolean. If set to <tt>true</tt>, this module will use nfs version 4
for exporting and mounting nfs resources.
for exporting and mounting nfs resources. It defaults to <tt>true</tt>.

##### `nfs_v4_client`
Boolean. If set to <tt>true</tt>, this module will use nfs version 4
for mounting nfs resources. If set to <tt>false</tt> it will use nfs
version 3 to mount nfs resources. It defaults to the setting of `nfs_v4`
version 3 to mount nfs resources. It defaults to <tt>true</tt>.

##### `exports_file`
String. It defines the location of the file with the nfs export resources used
Expand Down
3 changes: 2 additions & 1 deletion manifests/functions/nfsv4_bindmount.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
$bind,
$ensure = 'mounted',
) {
$expdir = "${nfs::server::nfs_v4_export_root}/${v4_export_name}"
$normalize_export_root = regsubst($nfs::server::nfs_v4_export_root, '/$', '')
$expdir = "${normalize_export_root}/${v4_export_name}"
nfs::functions::mkdir { $expdir:
ensure => $ensure,
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
$server_service_name = 'nfs-kernel-server'
$client_gssdopt_name = 'GSSDARGS'
}
'focal', 'bionic', 'focal': {
'bionic', 'focal', 'jammy', 'kinetic': {
$client_services = {'rpcbind' => {}}
$client_gssd_service_name = { 'rpc-gssd' => {
ensure => 'running',
Expand Down
5 changes: 3 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "derdanne-nfs",
"version": "2.1.8",
"version": "2.1.11",
"source": "https://github.com/derdanne/puppet-nfs.git",
"author": "derdanne",
"license": "Apache-2.0",
Expand All @@ -23,7 +23,8 @@
"14.04",
"16.04",
"18.04",
"20.04"
"20.04",
"22.04"
]
},
{
Expand Down
28 changes: 28 additions & 0 deletions spec/acceptance/nodesets/ubuntu-22.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
HOSTS:
ubuntu-2204-x64:
platform: ubuntu-22.04-amd64
hypervisor: docker
image: ubuntu:22.04
docker_preserve_image: true
docker_cmd: '["/sbin/init"]'
docker_image_commands:
# ensure that upstart is booting correctly in the container
- 'apt-get update && apt-get install -y distro-info-data locales lsb-release && locale-gen en_US.UTF-8'
# for local development
- 'echo "MaxAuthTries 100" >> /etc/ssh/sshd_config'
# exportfs does not work on overlayfs - mounting local filesystem
mount_folders:
export:
host_path: .spec/fixtures/export
container_path: /export
data_folder:
host_path: .spec/fixtures/export/data_folder
container_path: /export/data_folder
homeexport:
host_path: .spec/fixtures/export/homeexport
container_path: /export/homeexport
CONFIG:
type: foss
trace_limit: 200
...
# vim: syntax=yaml
33 changes: 32 additions & 1 deletion spec/classes/nfs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe 'nfs' do
# supported_os = %w[Ubuntu_default Ubuntu_16.04 Debian_default Debian_8 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES Archlinux]
supported_os = %w[Ubuntu_16.04 Ubuntu_18.04 Ubuntu_20.04 Debian_8 Debian_9 Debian_10 Debian_11 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES]
supported_os = %w[Ubuntu_16.04 Ubuntu_18.04 Ubuntu_20.04 Ubuntu_22.04 Debian_8 Debian_9 Debian_10 Debian_11 RedHat_default RedHat_7 RedHat_75 RedHat_8 Gentoo SLES]
supported_os.each do |os|
context os do
let(:default_facts) do
Expand Down Expand Up @@ -144,6 +144,37 @@
client_rpcbind_config = '/etc/default/rpcbind'
client_rpcbind_optname = 'OPTIONS'

when 'Ubuntu_22.04'

let(:facts) do
default_facts.merge(
'operatingsystem' => 'Ubuntu',
'os' => {
'family' => 'Debian',
'distro' => {
'codename' => 'focal'
},
'release' => {
'major' => '20',
'minor' => '04',
'full' => '20.04'
}
}
)
end

server_service = 'nfs-kernel-server'
server_servicehelpers = ''
server_packages = %w[nfs-common nfs-kernel-server nfs4-acl-tools rpcbind]
client_services = %w[rpcbind]
client_nfs_vfour_services = %w[rpcbind]
client_packages = %w[nfs-common nfs4-acl-tools]
client_gssdopt_name = 'GSSDARGS'
defaults_file = '/etc/default/nfs-common'
idmapd_file = '/etc/idmapd.conf'
client_rpcbind_config = '/etc/default/rpcbind'
client_rpcbind_optname = 'OPTIONS'

when 'Debian_default'

let(:facts) do
Expand Down
Loading

0 comments on commit 7b4719e

Please sign in to comment.