Showing with 104 additions and 60 deletions.
  1. +21 −0 .github/workflows/ci.yml
  2. +0 −12 .travis.yml
  3. +21 −0 CHANGELOG.md
  4. +1 −1 CONTRIBUTING.md
  5. +17 −11 Gemfile
  6. +20 −1 Rakefile
  7. +1 −2 manifests/init.pp
  8. +8 −6 metadata.json
  9. +11 −0 spec/acceptance/basic_spec.rb
  10. +2 −0 spec/spec_helper.rb
  11. +2 −27 spec/spec_helper_acceptance.rb
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: CI

on:
pull_request:
schedule:
- cron: '4 4 * * *'


concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true

jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
with:
pidfile_workaround: 'false'
rubocop: false
cache-version: '1'
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## [1.0.0](https://github.com/theforeman/puppet-motd/tree/1.0.0) (2023-04-11)

[Full Changelog](https://github.com/theforeman/puppet-motd/compare/0.1.0...1.0.0)

**Breaking changes:**

- Drop Puppet 5 support [\#12](https://github.com/theforeman/puppet-motd/pull/12) ([ekohl](https://github.com/ekohl))

**Implemented enhancements:**

- Update to voxpupuli-test 5 [\#11](https://github.com/theforeman/puppet-motd/pull/11) ([ekohl](https://github.com/ekohl))
- add support for Ubuntu 20.04 and Debian 11 [\#10](https://github.com/theforeman/puppet-motd/pull/10) ([evgeni](https://github.com/evgeni))
- Allow puppetlabs/stdlib 8.x [\#6](https://github.com/theforeman/puppet-motd/pull/6) ([ekohl](https://github.com/ekohl))

**Merged pull requests:**

- Add a basic acceptance test [\#13](https://github.com/theforeman/puppet-motd/pull/13) ([ekohl](https://github.com/ekohl))
- Increase the cache version [\#8](https://github.com/theforeman/puppet-motd/pull/8) ([ekohl](https://github.com/ekohl))
- Use gha-puppet's reusable workflows [\#5](https://github.com/theforeman/puppet-motd/pull/5) ([ekohl](https://github.com/ekohl))
- Support Puppet 7 [\#4](https://github.com/theforeman/puppet-motd/pull/4) ([ekohl](https://github.com/ekohl))

## [0.1.0](https://github.com/theforeman/puppet-motd/tree/0.1.0) (2020-04-22)

[Full Changelog](https://github.com/theforeman/puppet-motd/compare/6f785dc5e2f2a97bdf3d29f27d7060d42a152bb3...0.1.0)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ More filter info available [here](https://relishapp.com/rspec/rspec-core/v/3-9/d
To run OS specific tests:

```shell
SPEC_FACTS_OS=redhat-7-x86_64 bundle exec rspec spec/classes/foreman_spec.rb
SPEC_FACTS_OS=redhat-8-x86_64 bundle exec rspec spec/classes/foreman_spec.rb
```

If you have more than one version of `redhat` OS specified in metadata.json,
Expand Down
28 changes: 17 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@

source 'https://rubygems.org'

gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '>= 5.5'
gem 'puppet', ENV['PUPPET_GEM_VERSION'] || '>= 5.5', groups: ['development', 'test']
gem 'rake'

gem 'kafo_module_lint'
gem 'puppet-lint-empty_string-check'
gem 'puppet-lint-file_ensure-check'
gem 'puppet-lint-param-docs', '>= 1.3.0'
gem 'puppet-lint-spaceship_operator_without_tag-check'
gem 'puppet-lint-strict_indent-check'
gem 'puppet-lint-undef_in_function-check'
gem 'voxpupuli-test', '~> 1.3'
gem 'kafo_module_lint', {"groups"=>["test"]}
gem 'puppet-lint-empty_string-check', {"groups"=>["test"]}
gem 'puppet-lint-file_ensure-check', {"groups"=>["test"]}
gem 'puppet-lint-param-docs', '>= 1.3.0', {"groups"=>["test"]}
gem 'puppet-lint-spaceship_operator_without_tag-check', {"groups"=>["test"]}
gem 'puppet-lint-strict_indent-check', {"groups"=>["test"]}
gem 'puppet-lint-undef_in_function-check', {"groups"=>["test"]}
gem 'voxpupuli-test', '~> 5.0', {"groups"=>["test"]}
gem 'github_changelog_generator', '>= 1.15.0', {"groups"=>["development"]}
gem 'puppet-blacksmith', '>= 4.1.0', {"groups"=>["development"]}
gem 'voxpupuli-acceptance', '~> 0.1', {"groups"=>["system_tests"]}
gem 'puppet_metadata', '~> 1.3'
gem 'puppet-blacksmith', '>= 6.0.0', {"groups"=>["development"]}
gem 'voxpupuli-acceptance', '~> 1.0', {"groups"=>["system_tests"]}
gem 'puppetlabs_spec_helper', {"groups"=>["system_tests"]}

# Pin rdoc to prevent updating bundled psych (https://github.com/ruby/rdoc/commit/ebe185c8775b2afe844eb3da6fa78adaa79e29a4)
gem 'rdoc', '< 6.4'

# vim:ft=ruby
21 changes: 20 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
# This file is managed centrally by modulesync
# https://github.com/theforeman/foreman-installer-modulesync

require 'voxpupuli/test/rake'
# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper),
# otherwise attempt to load it directly.
begin
require 'voxpupuli/test/rake'
rescue LoadError
begin
require 'puppetlabs_spec_helper/rake_tasks'
rescue LoadError
end
end

# load optional tasks for acceptance
# only available if gem group releases is installed
begin
require 'voxpupuli/acceptance/rake'
rescue LoadError
else
# We use fixtures in our modules, which is not the default
task :beaker => 'spec_prep'
end

# blacksmith isn't always present, e.g. on Travis with --without development
begin
Expand Down
3 changes: 1 addition & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
# @example
# class { 'motd': }
#
class motd(
class motd (
Enum['present', 'absent'] $ensure = 'present',
Stdlib::Absolutepath $config_file = '/etc/motd',
String[1] $template = 'motd/motd.erb',
) {

if $ensure == 'present' {
$ensure_real = 'file'
} else {
Expand Down
14 changes: 8 additions & 6 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-motd",
"version": "0.1.0",
"version": "1.0.0",
"author": "theforeman",
"summary": "Foreman infra motd",
"license": "GPL-3.0+",
Expand All @@ -15,13 +15,13 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.25.0 < 7.0.0"
"version_requirement": ">= 4.25.0 < 9.0.0"
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 5.5.8 < 7.0.0"
"version_requirement": ">= 6.1.0 < 8.0.0"
}
],
"operatingsystem_support": [
Expand All @@ -36,19 +36,21 @@
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7",
"8"
"8"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"10"
"10",
"11"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"18.04"
"18.04",
"20.04"
]
}
]
Expand Down
11 changes: 11 additions & 0 deletions spec/acceptance/basic_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper_acceptance'

describe 'basic usage' do
include_examples 'an idempotent resource' do
let(:manifest) { 'include motd' }
end

specify do
expect(file('/etc/motd')).to have_attributes(content: /Foreman project/)
end
end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

require 'voxpupuli/test/spec_helper'

add_mocked_facts!

def get_content(subject, title)
is_expected.to contain_file(title)
content = subject.resource('file', title).send(:parameters)[:content]
Expand Down
29 changes: 2 additions & 27 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'voxpupuli/acceptance/spec_helper_acceptance'

ENV['BEAKER_setfile'] ||= 'centos7-64{hostname=centos7-64.example.com}'
ENV['BEAKER_setfile'] ||= 'centos8-64{hostname=centos8-64.example.com}'

configure_beaker do |host|
configure_beaker(modules: :fixtures) do |host|
if fact_on(host, 'os.family') == 'RedHat'
unless fact_on(host, 'os.name') == 'Fedora'
# don't delete downloaded rpm for use with BEAKER_provision=no +
Expand All @@ -12,31 +12,6 @@
# refresh check if cache needs refresh on next yum command
on host, 'yum clean expire-cache'
end

local_setup = File.join(__dir__, 'setup_acceptance_node.pp')
if File.exist?(local_setup)
puts "Configuring #{host} by applying #{local_setup}"
apply_manifest_on(host, File.read(local_setup), catch_failures: true)
end
end

shared_examples 'a idempotent resource' do
it 'applies with no errors' do
apply_manifest(pp, catch_failures: true)
end

it 'applies a second time without changes' do
apply_manifest(pp, catch_changes: true)
end
end

shared_examples 'the example' do |name|
let(:pp) do
path = File.join(File.dirname(__dir__), 'examples', name)
File.read(path)
end

include_examples 'a idempotent resource'
end

Dir["./spec/support/acceptance/**/*.rb"].sort.each { |f| require f }