From 040f1acf02dc379e3fe577d900b96b47a38a714a Mon Sep 17 00:00:00 2001 From: Felix Bechstein Date: Wed, 27 Jan 2016 08:18:12 +0100 Subject: Shortcut for creating unit files / tmpfiles This change allows creating unit files and reloading systemd with just a single resource. It's fully compatible with the manual behavior. --- .fixtures.yml | 4 ++++ README.md | 30 ++++++++++++++++++++++---- manifests/tmpfile.pp | 20 ++++++++++++++++++ manifests/unit_file.pp | 20 ++++++++++++++++++ spec/defines/tmpfile_spec.rb | 48 ++++++++++++++++++++++++++++++++++++++++++ spec/defines/unit_file_spec.rb | 48 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 .fixtures.yml create mode 100644 manifests/tmpfile.pp create mode 100644 manifests/unit_file.pp create mode 100644 spec/defines/tmpfile_spec.rb create mode 100644 spec/defines/unit_file_spec.rb diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..1d455a3 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,4 @@ +--- +fixtures: + symlinks: + systemd: "#{source_dir}" \ No newline at end of file diff --git a/README.md b/README.md index f70bcb0..5d962c9 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,23 @@ ## Overview -This module declares exec resources that you can use when you change systemd units or configuration files. +This module declares exec resources to create global sync points for reloading systemd. -## Examples +## Usage and examples -### systemctl --daemon-reload +There are two ways to use this module. + +### unit files + +Let this module handle file creation and systemd reloading. + +```puppet +::systemd::unit_file { 'foo.service': + source => "puppet:///modules/${module_name}/foo.service", +} +``` + +Or handle file creation yourself and trigger systemd. ```puppet include ::systemd @@ -23,7 +35,17 @@ file { '/usr/lib/systemd/system/foo.service': Exec['systemctl-daemon-reload'] ``` -### systemd-tmpfiles --create +### tmpfiles + +Let this module handle file creation and systemd reloading + +```puppet +::systemd::tmpfile { 'foo.conf': + source => "puppet:///modules/${module_name}/foo.conf", +} +``` + +Or handle file creation yourself and trigger systemd. ```puppet include ::systemd diff --git a/manifests/tmpfile.pp b/manifests/tmpfile.pp new file mode 100644 index 0000000..c4d1a05 --- /dev/null +++ b/manifests/tmpfile.pp @@ -0,0 +1,20 @@ +# -- Define: systemd::tmpfile +# Creates a tmpfile and reloads systemd +define systemd::tmpfile( + $ensure = file, + $path = '/etc/tmpfiles.d', + $content = undef, + $source = undef, +) { + include ::systemd + + file { "${path}/${title}": + ensure => $ensure, + content => $content, + source => $source, + owner => 'root', + group => 'root', + mode => '0444', + notify => Exec['systemd-tmpfiles-create'], + } +} \ No newline at end of file diff --git a/manifests/unit_file.pp b/manifests/unit_file.pp new file mode 100644 index 0000000..0f659db --- /dev/null +++ b/manifests/unit_file.pp @@ -0,0 +1,20 @@ +# -- Define: systemd::unit_file +# Creates a unit file and reloads systemd +define systemd::unit_file( + $ensure = file, + $path = '/etc/systemd/system', + $content = undef, + $source = undef, +) { + include ::systemd + + file { "${path}/${title}": + ensure => $ensure, + content => $content, + source => $source, + owner => 'root', + group => 'root', + mode => '0444', + notify => Exec['systemctl-daemon-reload'], + } +} \ No newline at end of file diff --git a/spec/defines/tmpfile_spec.rb b/spec/defines/tmpfile_spec.rb new file mode 100644 index 0000000..4eb22ac --- /dev/null +++ b/spec/defines/tmpfile_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +describe 'systemd::tmpfile' do + + let(:facts) { { + :path => '/usr/bin', + } } + + context 'default params' do + + let(:title) { 'fancy.conf' } + + it 'creates the tmpfile' do + should contain_file('/etc/tmpfiles.d/fancy.conf').with({ + 'ensure' => 'file', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0444', + }) + end + + it 'triggers systemd daemon-reload' do + should contain_class('systemd') + should contain_file('/etc/tmpfiles.d/fancy.conf').with_notify("Exec[systemd-tmpfiles-create]") + end + end + + context 'with params' do + let(:title) { 'fancy.conf' } + + let(:params) { { + :ensure => 'absent', + :path => '/etc/tmpfiles.d/foo', + :content => 'some-content', + :source => 'some-source', + } } + + it 'creates the unit file' do + should contain_file('/etc/tmpfiles.d/foo/fancy.conf').with({ + 'ensure' => 'absent', + 'content' => 'some-content', + 'source' => 'some-source', + }) + end + + end + +end diff --git a/spec/defines/unit_file_spec.rb b/spec/defines/unit_file_spec.rb new file mode 100644 index 0000000..0eebbd3 --- /dev/null +++ b/spec/defines/unit_file_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +describe 'systemd::unit_file' do + + let(:facts) { { + :path => '/usr/bin', + } } + + context 'default params' do + + let(:title) { 'fancy.service' } + + it 'creates the unit file' do + should contain_file('/etc/systemd/system/fancy.service').with({ + 'ensure' => 'file', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0444', + }) + end + + it 'triggers systemd daemon-reload' do + should contain_class('systemd') + should contain_file('/etc/systemd/system/fancy.service').with_notify("Exec[systemctl-daemon-reload]") + end + end + + context 'with params' do + let(:title) { 'fancy.service' } + + let(:params) { { + :ensure => 'absent', + :path => '/usr/lib/systemd/system', + :content => 'some-content', + :source => 'some-source', + } } + + it 'creates the unit file' do + should contain_file('/usr/lib/systemd/system/fancy.service').with({ + 'ensure' => 'absent', + 'content' => 'some-content', + 'source' => 'some-source', + }) + end + + end + +end -- cgit v1.2.3 From e2ef15480abaf5a10404ec4c2c049d82aae47b68 Mon Sep 17 00:00:00 2001 From: Yanis Guenane Date: Thu, 12 Mar 2015 10:17:33 +0100 Subject: (FACT-852) Support for systemd and systemd_version This commit adds support for systemd and systemd_version facts. --- lib/facter/systemd.rb | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/facter/systemd.rb diff --git a/lib/facter/systemd.rb b/lib/facter/systemd.rb new file mode 100644 index 0000000..3ac0a1e --- /dev/null +++ b/lib/facter/systemd.rb @@ -0,0 +1,39 @@ +# Fact: systemd +# +# Purpose: +# Determine whether SystemD is the init system on the node +# +# Resolution: +# Check the name of the process 1 (ps -p 1) +# +# Caveats: +# + +# Fact: systemd-version +# +# Purpose: +# Determine the version of systemd installed +# +# Resolution: +# Check the output of systemctl --version +# +# Caveats: +# + +Facter.add(:systemd) do + confine :kernel => :linux + setcode do + result = false + init_process_name = Facter::Core::Execution.exec('ps -p 1 -o comm=') + if init_process_name.eql? 'systemd' + result = true + end + end +end + +Facter.add(:systemd_version) do + confine :systemd => true + setcode do + version = Facter::Core::Execution.exec("systemctl --version | grep 'systemd' | awk '{ print $2 }'") + end +end -- cgit v1.2.3 From b19ae68789e2a7abe0368d710f5860eef2a70a1d Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Fri, 19 Feb 2016 09:14:51 +0100 Subject: Simplify systemd facts following puppetlabs/facter#871 comments --- lib/facter/systemd.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/facter/systemd.rb b/lib/facter/systemd.rb index 3ac0a1e..b4b11fb 100644 --- a/lib/facter/systemd.rb +++ b/lib/facter/systemd.rb @@ -23,17 +23,13 @@ Facter.add(:systemd) do confine :kernel => :linux setcode do - result = false - init_process_name = Facter::Core::Execution.exec('ps -p 1 -o comm=') - if init_process_name.eql? 'systemd' - result = true - end + Facter::Core::Execution.exec('ps -p 1 -o comm=') == 'systemd' end end Facter.add(:systemd_version) do confine :systemd => true setcode do - version = Facter::Core::Execution.exec("systemctl --version | grep 'systemd' | awk '{ print $2 }'") + Facter::Core::Execution.exec("systemctl --version | grep 'systemd' | awk '{ print $2 }'") end end -- cgit v1.2.3 From c35dd1535b429d5432ee55b91884a6c76f17a075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Can=C3=A9vet?= Date: Wed, 4 May 2016 09:44:11 +0200 Subject: Update with modulesync --- .travis.yml | 10 +++++++--- Gemfile | 8 ++++---- Rakefile | 14 +++++++------- spec/acceptance/nodesets/centos-5.yml | 15 +++++++++++++++ spec/acceptance/nodesets/centos-6.yml | 16 ++++++++++++++++ spec/acceptance/nodesets/centos-7.yml | 15 +++++++++++++++ spec/acceptance/nodesets/debian-6.yml | 15 +++++++++++++++ spec/acceptance/nodesets/debian-7.yml | 15 +++++++++++++++ spec/acceptance/nodesets/debian-8.yml | 16 ++++++++++++++++ spec/acceptance/nodesets/ubuntu-12.04.yml | 16 ++++++++++++++++ spec/acceptance/nodesets/ubuntu-14.04.yml | 18 ++++++++++++++++++ spec/acceptance/nodesets/ubuntu-14.10.yml | 18 ++++++++++++++++++ spec/acceptance/nodesets/ubuntu-15.04.yml | 16 ++++++++++++++++ spec/acceptance/nodesets/ubuntu-15.10.yml | 16 ++++++++++++++++ spec/acceptance/nodesets/ubuntu-16.04.yml | 16 ++++++++++++++++ 15 files changed, 210 insertions(+), 14 deletions(-) create mode 100644 spec/acceptance/nodesets/centos-5.yml create mode 100644 spec/acceptance/nodesets/centos-6.yml create mode 100644 spec/acceptance/nodesets/centos-7.yml create mode 100644 spec/acceptance/nodesets/debian-6.yml create mode 100644 spec/acceptance/nodesets/debian-7.yml create mode 100644 spec/acceptance/nodesets/debian-8.yml create mode 100644 spec/acceptance/nodesets/ubuntu-12.04.yml create mode 100644 spec/acceptance/nodesets/ubuntu-14.04.yml create mode 100644 spec/acceptance/nodesets/ubuntu-14.10.yml create mode 100644 spec/acceptance/nodesets/ubuntu-15.04.yml create mode 100644 spec/acceptance/nodesets/ubuntu-15.10.yml create mode 100644 spec/acceptance/nodesets/ubuntu-16.04.yml diff --git a/.travis.yml b/.travis.yml index 467045c..01ca316 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,13 @@ --- language: ruby sudo: false +addons: + apt: + packages: + - libaugeas-dev cache: bundler bundler_args: --without system_tests -script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake spec SPEC_OPTS='--format documentation'", "bundle exec rake metadata"] +script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake spec SPEC_OPTS='--format documentation'"] matrix: fast_finish: true include: @@ -15,7 +19,7 @@ matrix: env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - - rvm: 2.1.6 + - rvm: 2.1.7 env: PUPPET_GEM_VERSION="~> 4.0" notifications: email: false @@ -29,4 +33,4 @@ deploy: # all_branches is required to use tags all_branches: true # Only publish if our main Ruby target builds - rvm: 1.9.3 + rvm: 2.1.7 diff --git a/Gemfile b/Gemfile index 0cb5933..f0d7a49 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :unit_tests do - gem 'rake', :require => false - gem 'rspec', '< 3.2', :require => false if RUBY_VERSION =~ /^1.8/ + gem 'rake', ' < 11.0', :require => false if RUBY_VERSION =~ /^1\.8/ + gem 'rspec', '< 3.2', :require => false if RUBY_VERSION =~ /^1\.8/ gem 'rspec-puppet', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'metadata-json-lint', :require => false @@ -21,8 +21,8 @@ group :development, :unit_tests do gem 'puppet-lint-file_source_rights-check', :require => false gem 'puppet-lint-alias-check', :require => false gem 'rspec-puppet-facts', :require => false - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/raphink/github-changelog-generator.git', :branch => 'dev/all_patches' if RUBY_VERSION !~ /^1.8/ - gem 'puppet-blacksmith', :require => false if RUBY_VERSION !~ /^1.8/ + gem 'ruby-augeas', :require => false + gem 'puppet-blacksmith', :require => false if RUBY_VERSION !~ /^1\./ end group :system_tests do diff --git a/Rakefile b/Rakefile index adcac18..61faa29 100644 --- a/Rakefile +++ b/Rakefile @@ -11,13 +11,13 @@ end PuppetSyntax.exclude_paths = ["spec/fixtures/**/*.pp", "vendor/**/*"] # Publishing tasks -unless RUBY_VERSION =~ /^1\.8/ +unless RUBY_VERSION =~ /^1\./ require 'puppet_blacksmith' require 'puppet_blacksmith/rake_tasks' - require 'github_changelog_generator/task' - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - m = Blacksmith::Modulefile.new - config.future_release = m.version - config.release_url = "https://forge.puppetlabs.com/#{m.author}/#{m.name}/%s" - end + #require 'github_changelog_generator/task' + #GitHubChangelogGenerator::RakeTask.new :changelog do |config| + # m = Blacksmith::Modulefile.new + # config.future_release = m.version + # config.release_url = "https://forge.puppetlabs.com/#{m.author}/#{m.name}/%s" + #end end diff --git a/spec/acceptance/nodesets/centos-5.yml b/spec/acceptance/nodesets/centos-5.yml new file mode 100644 index 0000000..b7ed0e5 --- /dev/null +++ b/spec/acceptance/nodesets/centos-5.yml @@ -0,0 +1,15 @@ +HOSTS: + centos-5-x64: + default_apply_opts: + order: random + strict_variables: + platform: el-5-x86_64 + hypervisor : docker + image: tianon/centos:5.10 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'yum install -y crontabs tar wget which' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/centos-6.yml b/spec/acceptance/nodesets/centos-6.yml new file mode 100644 index 0000000..c82c10d --- /dev/null +++ b/spec/acceptance/nodesets/centos-6.yml @@ -0,0 +1,16 @@ +HOSTS: + centos-6-x64: + default_apply_opts: + order: random + strict_variables: + platform: el-6-x86_64 + hypervisor : docker + image: centos:6 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'rm -rf /var/run/network/*' + - 'yum install -y crontabs tar wget' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/centos-7.yml b/spec/acceptance/nodesets/centos-7.yml new file mode 100644 index 0000000..bc57539 --- /dev/null +++ b/spec/acceptance/nodesets/centos-7.yml @@ -0,0 +1,15 @@ +HOSTS: + centos-7-x64: + default_apply_opts: + order: random + strict_variables: + platform: el-7-x86_64 + hypervisor : docker + image: centos:7 + docker_preserve_image: true + docker_cmd: '["/usr/sbin/init"]' + docker_image_commands: + - 'yum install -y crontabs tar wget' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/debian-6.yml b/spec/acceptance/nodesets/debian-6.yml new file mode 100644 index 0000000..d7b0275 --- /dev/null +++ b/spec/acceptance/nodesets/debian-6.yml @@ -0,0 +1,15 @@ +HOSTS: + debian-6-x64: + default_apply_opts: + order: random + strict_variables: + platform: debian-6-amd64 + hypervisor : docker + image: debian/eol:squeeze + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y cron locales-all net-tools wget' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/debian-7.yml b/spec/acceptance/nodesets/debian-7.yml new file mode 100644 index 0000000..9591ea7 --- /dev/null +++ b/spec/acceptance/nodesets/debian-7.yml @@ -0,0 +1,15 @@ +HOSTS: + debian-7-x64: + default_apply_opts: + order: random + strict_variables: + platform: debian-7-amd64 + hypervisor : docker + image: debian:7 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y cron locales-all net-tools wget' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/debian-8.yml b/spec/acceptance/nodesets/debian-8.yml new file mode 100644 index 0000000..5fb24c6 --- /dev/null +++ b/spec/acceptance/nodesets/debian-8.yml @@ -0,0 +1,16 @@ +HOSTS: + debian-8-x64: + default_apply_opts: + order: random + strict_variables: + platform: debian-8-amd64 + hypervisor : docker + image: debian:8 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y cron locales-all net-tools wget' + - 'rm -f /usr/sbin/policy-rc.d' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-12.04.yml b/spec/acceptance/nodesets/ubuntu-12.04.yml new file mode 100644 index 0000000..594e177 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-12.04.yml @@ -0,0 +1,16 @@ +HOSTS: + ubuntu-1204-x64: + default_apply_opts: + order: random + strict_variables: + platform: ubuntu-12.04-amd64 + hypervisor : docker + image: ubuntu:12.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-14.04.yml b/spec/acceptance/nodesets/ubuntu-14.04.yml new file mode 100644 index 0000000..2b293c9 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-14.04.yml @@ -0,0 +1,18 @@ +HOSTS: + ubuntu-1404-x64: + default_apply_opts: + order: random + strict_variables: + platform: ubuntu-14.04-amd64 + hypervisor : docker + image: ubuntu:14.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'rm /usr/sbin/policy-rc.d' + - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-14.10.yml b/spec/acceptance/nodesets/ubuntu-14.10.yml new file mode 100644 index 0000000..7ce09b2 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-14.10.yml @@ -0,0 +1,18 @@ +HOSTS: + ubuntu-1410-x64: + default_apply_opts: + order: random + strict_variables: + platform: ubuntu-14.10-amd64 + hypervisor : docker + image: ubuntu:14.10 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'rm /usr/sbin/policy-rc.d' + - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-15.04.yml b/spec/acceptance/nodesets/ubuntu-15.04.yml new file mode 100644 index 0000000..329f331 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-15.04.yml @@ -0,0 +1,16 @@ +HOSTS: + ubuntu-1504-x64: + default_apply_opts: + order: random + strict_variables: + platform: ubuntu-15.04-amd64 + hypervisor : docker + image: ubuntu:15.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-15.10.yml b/spec/acceptance/nodesets/ubuntu-15.10.yml new file mode 100644 index 0000000..487795a --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-15.10.yml @@ -0,0 +1,16 @@ +HOSTS: + ubuntu-1510-x64: + default_apply_opts: + order: random + strict_variables: + platform: ubuntu-15.10-amd64 + hypervisor : docker + image: ubuntu:15.10 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + type: aio + log_level: debug diff --git a/spec/acceptance/nodesets/ubuntu-16.04.yml b/spec/acceptance/nodesets/ubuntu-16.04.yml new file mode 100644 index 0000000..6c32b96 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-16.04.yml @@ -0,0 +1,16 @@ +HOSTS: + ubuntu-1604-x64: + default_apply_opts: + order: random + strict_variables: + platform: ubuntu-16.04-amd64 + hypervisor : docker + image: ubuntu:16.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + type: aio + log_level: debug -- cgit v1.2.3 From f6bb9c9bdb8d0e1b02a42b1e19ac0a56ac4b84a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Mon, 16 May 2016 15:28:00 +0200 Subject: Release 0.3.0 --- CHANGELOG.md | 12 +++++++++--- HISTORY.md | 15 ++++++++++++--- metadata.json | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11e8439..aee8ad5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## [0.3.0](https://forge.puppetlabs.com/camptocamp/systemd/0.3.0) (2016-05-16) +[Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.2...0.3.0) + +**Implemented enhancements:** + +- Shortcut for creating unit files / tmpfiles [\#4](https://github.com/camptocamp/puppet-systemd/pull/4) ([felixb](https://github.com/felixb)) +- Add systemd facts [\#6](https://github.com/camptocamp/puppet-systemd/pull/6) ([roidelapluie](https://github.com/roidelapluie)) + + ## [0.2.2](https://forge.puppetlabs.com/camptocamp/systemd/0.2.2) (2015-08-25) [Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.1...0.2.2) @@ -60,6 +69,3 @@ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* - - -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/HISTORY.md b/HISTORY.md index c7bf2b4..aee8ad5 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,14 @@ +# Change Log + +## [0.3.0](https://forge.puppetlabs.com/camptocamp/systemd/0.3.0) (2016-05-16) +[Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.2...0.3.0) + +**Implemented enhancements:** + +- Shortcut for creating unit files / tmpfiles [\#4](https://github.com/camptocamp/puppet-systemd/pull/4) ([felixb](https://github.com/felixb)) +- Add systemd facts [\#6](https://github.com/camptocamp/puppet-systemd/pull/6) ([roidelapluie](https://github.com/roidelapluie)) + + ## [0.2.2](https://forge.puppetlabs.com/camptocamp/systemd/0.2.2) (2015-08-25) [Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.1...0.2.2) @@ -5,6 +16,7 @@ - Add 'systemd-tmpfiles-create' [\#1](https://github.com/camptocamp/puppet-systemd/pull/1) ([roidelapluie](https://github.com/roidelapluie)) + ## [0.2.1](https://forge.puppetlabs.com/camptocamp/systemd/0.2.1) (2015-08-21) [Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.0...0.2.1) @@ -56,7 +68,4 @@ - Confine rspec pinning to ruby 1.8 -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* - - \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/metadata.json b/metadata.json index abdd481..9224247 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "camptocamp-systemd", - "version": "0.2.2", + "version": "0.3.0", "author": "camptocamp", "summary": "Puppet Systemd module", "license": "Apache-2.0", -- cgit v1.2.3 From b9ef73138afacfc5833bada0edb37075bcd1c7db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Mon, 16 May 2016 15:28:00 +0200 Subject: Release 0.3.0 --- CHANGELOG.md | 12 +++++++++--- HISTORY.md | 15 ++++++++++++--- metadata.json | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11e8439..aee8ad5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## [0.3.0](https://forge.puppetlabs.com/camptocamp/systemd/0.3.0) (2016-05-16) +[Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.2...0.3.0) + +**Implemented enhancements:** + +- Shortcut for creating unit files / tmpfiles [\#4](https://github.com/camptocamp/puppet-systemd/pull/4) ([felixb](https://github.com/felixb)) +- Add systemd facts [\#6](https://github.com/camptocamp/puppet-systemd/pull/6) ([roidelapluie](https://github.com/roidelapluie)) + + ## [0.2.2](https://forge.puppetlabs.com/camptocamp/systemd/0.2.2) (2015-08-25) [Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.1...0.2.2) @@ -60,6 +69,3 @@ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* - - -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/HISTORY.md b/HISTORY.md index c7bf2b4..aee8ad5 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,14 @@ +# Change Log + +## [0.3.0](https://forge.puppetlabs.com/camptocamp/systemd/0.3.0) (2016-05-16) +[Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.2...0.3.0) + +**Implemented enhancements:** + +- Shortcut for creating unit files / tmpfiles [\#4](https://github.com/camptocamp/puppet-systemd/pull/4) ([felixb](https://github.com/felixb)) +- Add systemd facts [\#6](https://github.com/camptocamp/puppet-systemd/pull/6) ([roidelapluie](https://github.com/roidelapluie)) + + ## [0.2.2](https://forge.puppetlabs.com/camptocamp/systemd/0.2.2) (2015-08-25) [Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.1...0.2.2) @@ -5,6 +16,7 @@ - Add 'systemd-tmpfiles-create' [\#1](https://github.com/camptocamp/puppet-systemd/pull/1) ([roidelapluie](https://github.com/roidelapluie)) + ## [0.2.1](https://forge.puppetlabs.com/camptocamp/systemd/0.2.1) (2015-08-21) [Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.0...0.2.1) @@ -56,7 +68,4 @@ - Confine rspec pinning to ruby 1.8 -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* - - \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/metadata.json b/metadata.json index abdd481..9224247 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "camptocamp-systemd", - "version": "0.2.2", + "version": "0.3.0", "author": "camptocamp", "summary": "Puppet Systemd module", "license": "Apache-2.0", -- cgit v1.2.3 From 66115b15090f0c8be716cda29d376bcd8080714b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Mon, 11 Jul 2016 14:09:36 +0200 Subject: Deprecate Ruby 1.8 tests --- .travis.yml | 2 -- Gemfile | 6 +++--- Rakefile | 6 ------ spec/acceptance/nodesets/centos-5.yml | 1 + spec/acceptance/nodesets/centos-6.yml | 1 + 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01ca316..d816b71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,6 @@ script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake matrix: fast_finish: true include: - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 3.0" FACTER_GEM_VERSION="~> 1.7.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 2.0.0 diff --git a/Gemfile b/Gemfile index f0d7a49..1c22776 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :unit_tests do - gem 'rake', ' < 11.0', :require => false if RUBY_VERSION =~ /^1\.8/ - gem 'rspec', '< 3.2', :require => false if RUBY_VERSION =~ /^1\.8/ + gem 'rake', :require => false + gem 'rspec', :require => false gem 'rspec-puppet', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'metadata-json-lint', :require => false @@ -17,7 +17,6 @@ group :development, :unit_tests do gem 'puppet-lint-trailing_comma-check', :require => false gem 'puppet-lint-file_ensure-check', :require => false gem 'puppet-lint-version_comparison-check', :require => false - gem 'puppet-lint-fileserver-check', :require => false gem 'puppet-lint-file_source_rights-check', :require => false gem 'puppet-lint-alias-check', :require => false gem 'rspec-puppet-facts', :require => false @@ -30,6 +29,7 @@ group :system_tests do gem 'beaker-rspec', :require => false gem 'beaker_spec_helper', :require => false gem 'serverspec', :require => false + gem 'specinfra', :require => false end if facterversion = ENV['FACTER_GEM_VERSION'] diff --git a/Rakefile b/Rakefile index 61faa29..ab65ceb 100644 --- a/Rakefile +++ b/Rakefile @@ -14,10 +14,4 @@ PuppetSyntax.exclude_paths = ["spec/fixtures/**/*.pp", "vendor/**/*"] unless RUBY_VERSION =~ /^1\./ require 'puppet_blacksmith' require 'puppet_blacksmith/rake_tasks' - #require 'github_changelog_generator/task' - #GitHubChangelogGenerator::RakeTask.new :changelog do |config| - # m = Blacksmith::Modulefile.new - # config.future_release = m.version - # config.release_url = "https://forge.puppetlabs.com/#{m.author}/#{m.name}/%s" - #end end diff --git a/spec/acceptance/nodesets/centos-5.yml b/spec/acceptance/nodesets/centos-5.yml index b7ed0e5..a26f27f 100644 --- a/spec/acceptance/nodesets/centos-5.yml +++ b/spec/acceptance/nodesets/centos-5.yml @@ -10,6 +10,7 @@ HOSTS: docker_cmd: '["/sbin/init"]' docker_image_commands: - 'yum install -y crontabs tar wget which' + - 'sed -i -e "/mingetty/d" /etc/inittab' CONFIG: type: aio log_level: debug diff --git a/spec/acceptance/nodesets/centos-6.yml b/spec/acceptance/nodesets/centos-6.yml index c82c10d..71e23cd 100644 --- a/spec/acceptance/nodesets/centos-6.yml +++ b/spec/acceptance/nodesets/centos-6.yml @@ -11,6 +11,7 @@ HOSTS: docker_image_commands: - 'rm -rf /var/run/network/*' - 'yum install -y crontabs tar wget' + - 'rm /etc/init/tty.conf' CONFIG: type: aio log_level: debug -- cgit v1.2.3 From bfcf8c808bbc2afbdb7fcd548d10eb03871461d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Mon, 11 Jul 2016 14:49:08 +0200 Subject: modulesync --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index d816b71..7cf4712 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ addons: apt: packages: - libaugeas-dev + sources: + - augeas cache: bundler bundler_args: --without system_tests script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake spec SPEC_OPTS='--format documentation'"] -- cgit v1.2.3 From aeff226c587ec52adfdadc707ab97028c7ccaf9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Tue, 26 Jul 2016 00:01:57 +0200 Subject: only use awk, instead of grep and awk (#9) This reduces a pipe, by only using `awk` for both of operations that of `grep`, and that of `awk`. --- lib/facter/systemd.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/facter/systemd.rb b/lib/facter/systemd.rb index b4b11fb..d488efb 100644 --- a/lib/facter/systemd.rb +++ b/lib/facter/systemd.rb @@ -30,6 +30,6 @@ end Facter.add(:systemd_version) do confine :systemd => true setcode do - Facter::Core::Execution.exec("systemctl --version | grep 'systemd' | awk '{ print $2 }'") + Facter::Core::Execution.exec("systemctl --version | awk '/systemd/{ print $2 }'") end end -- cgit v1.2.3 From 800067db32f2190929a6867bf253b2c875c2eab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Can=C3=A9vet?= Date: Thu, 28 Jul 2016 15:13:38 +0200 Subject: =?UTF-8?q?=C2=A0Update=20with=20modulesync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7cf4712..d816b71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,6 @@ addons: apt: packages: - libaugeas-dev - sources: - - augeas cache: bundler bundler_args: --without system_tests script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake spec SPEC_OPTS='--format documentation'"] -- cgit v1.2.3 From 9bf73eb98a8a98b89f97665ae93b56852461fa8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Tue, 16 Aug 2016 16:05:30 +0200 Subject: Add LICENSE Fix #11 --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8d968b6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. -- cgit v1.2.3 From e496de727fafbbfbe2cf72c9f1528a719ec0e50f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Tue, 16 Aug 2016 16:23:49 +0200 Subject: modulesync --- .puppet-lint.rc | 2 +- .travis.yml | 2 ++ Gemfile | 1 + Rakefile | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.puppet-lint.rc b/.puppet-lint.rc index d8f5c59..e09d52f 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,5 +1,5 @@ --fail-on-warnings --relative ---no-80chars +--no-140chars --no-documentation --no-class_inherits_from_params_class-check diff --git a/.travis.yml b/.travis.yml index d816b71..7cf4712 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ addons: apt: packages: - libaugeas-dev + sources: + - augeas cache: bundler bundler_args: --without system_tests script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake spec SPEC_OPTS='--format documentation'"] diff --git a/Gemfile b/Gemfile index 1c22776..c2dabee 100644 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,7 @@ group :development, :unit_tests do gem 'rspec-puppet-facts', :require => false gem 'ruby-augeas', :require => false gem 'puppet-blacksmith', :require => false if RUBY_VERSION !~ /^1\./ + gem 'json_pure', '< 2.0.2', :require => false end group :system_tests do diff --git a/Rakefile b/Rakefile index ab65ceb..aa7b8a1 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,7 @@ require 'puppet-lint/tasks/puppet-lint' Rake::Task[:lint].clear PuppetLint::RakeTask.new :lint do |config| config.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"] - config.disable_checks = ['80chars'] + config.disable_checks = ['140chars'] config.fail_on_warnings = true end -- cgit v1.2.3 From 57283b23aafb47608501ae0ac68c1defa7f4065c Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Tue, 16 Aug 2016 17:05:47 +0200 Subject: Add target param for the unit file (#10) This is useful in case the Unit file is a symlink to another one --- manifests/unit_file.pp | 4 +++- spec/defines/unit_file_spec.rb | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/manifests/unit_file.pp b/manifests/unit_file.pp index 0f659db..94bc845 100644 --- a/manifests/unit_file.pp +++ b/manifests/unit_file.pp @@ -5,6 +5,7 @@ define systemd::unit_file( $path = '/etc/systemd/system', $content = undef, $source = undef, + $target = undef, ) { include ::systemd @@ -12,9 +13,10 @@ define systemd::unit_file( ensure => $ensure, content => $content, source => $source, + target => $target, owner => 'root', group => 'root', mode => '0444', notify => Exec['systemctl-daemon-reload'], } -} \ No newline at end of file +} diff --git a/spec/defines/unit_file_spec.rb b/spec/defines/unit_file_spec.rb index 0eebbd3..88a0122 100644 --- a/spec/defines/unit_file_spec.rb +++ b/spec/defines/unit_file_spec.rb @@ -33,6 +33,7 @@ describe 'systemd::unit_file' do :path => '/usr/lib/systemd/system', :content => 'some-content', :source => 'some-source', + :target => 'some-target', } } it 'creates the unit file' do @@ -40,6 +41,7 @@ describe 'systemd::unit_file' do 'ensure' => 'absent', 'content' => 'some-content', 'source' => 'some-source', + 'target' => 'some-target', }) end -- cgit v1.2.3 From 3584f3bfbe6c1658bc6c75ac7b4f61c5f92df774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Thu, 18 Aug 2016 16:53:08 +0200 Subject: Release 0.4.0 --- CHANGELOG.md | 8 ++++++++ metadata.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aee8ad5..79b9e64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## [0.4.0](https://forge.puppetlabs.com/camptocamp/systemd/0.4.0) (2016-08-18) +[Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.3.0...0.4.0) + +- Deprecate Ruby 1.8 tests +- Only use awk instead of grep and awk [\#9](https://github.com/camptocamp/puppet-systemd/pull/9) ([igalic](https://github.com/igalic)) +- Add LICENSE (fix #11) +- Add target param for the unit file [\#10](https://github.com/camptocamp/puppet-systemd/pull/10) ([tampakrap](https://github.com/tampakrap)) + ## [0.3.0](https://forge.puppetlabs.com/camptocamp/systemd/0.3.0) (2016-05-16) [Full Changelog](https://github.com/camptocamp/puppet-systemd/compare/0.2.2...0.3.0) diff --git a/metadata.json b/metadata.json index 9224247..08951ef 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "camptocamp-systemd", - "version": "0.3.0", + "version": "0.4.0", "author": "camptocamp", "summary": "Puppet Systemd module", "license": "Apache-2.0", -- cgit v1.2.3 From 922ed77e790399d2121285377826c47ada16f0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Tue, 23 Aug 2016 14:50:55 +0200 Subject: modulesync --- .travis.yml | 6 +++--- Gemfile | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7cf4712..96940f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,8 @@ matrix: env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - - rvm: 2.1.7 - env: PUPPET_GEM_VERSION="~> 4.0" + - rvm: 2.1.9 + env: PUPPET_GEM_VERSION="~> 4.5.0" notifications: email: false deploy: @@ -33,4 +33,4 @@ deploy: # all_branches is required to use tags all_branches: true # Only publish if our main Ruby target builds - rvm: 2.1.7 + rvm: 2.1.9 diff --git a/Gemfile b/Gemfile index c2dabee..7a15ede 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,6 @@ group :development, :unit_tests do gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-empty_string-check', :require => false gem 'puppet-lint-spaceship_operator_without_tag-check', :require => false - gem 'puppet-lint-variable_contains_upcase', :require => false gem 'puppet-lint-absolute_classname-check', :require => false gem 'puppet-lint-undef_in_function-check', :require => false gem 'puppet-lint-leading_zero-check', :require => false -- cgit v1.2.3 From b2f44d4832a771dde6ebea86f70811de8b4c1f26 Mon Sep 17 00:00:00 2001 From: Peter Souter Date: Wed, 24 Aug 2016 20:04:10 +0100 Subject: Refactor systemd facts (#12) * Use `Facter::Util::Resolution.exec`, which is backwards compatible with older Facter, calls the same method in modern facter * Adds basic unit testing for facts --- lib/facter/systemd.rb | 4 ++-- spec/unit/facter/systemd_spec.rb | 41 ++++++++++++++++++++++++++++++++ spec/unit/facter/systemd_version_spec.rb | 31 ++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 spec/unit/facter/systemd_spec.rb create mode 100644 spec/unit/facter/systemd_version_spec.rb diff --git a/lib/facter/systemd.rb b/lib/facter/systemd.rb index d488efb..4361f77 100644 --- a/lib/facter/systemd.rb +++ b/lib/facter/systemd.rb @@ -23,13 +23,13 @@ Facter.add(:systemd) do confine :kernel => :linux setcode do - Facter::Core::Execution.exec('ps -p 1 -o comm=') == 'systemd' + Facter::Util::Resolution.exec('ps -p 1 -o comm=') == 'systemd' end end Facter.add(:systemd_version) do confine :systemd => true setcode do - Facter::Core::Execution.exec("systemctl --version | awk '/systemd/{ print $2 }'") + Facter::Util::Resolution.exec("systemctl --version | awk '/systemd/{ print $2 }'") end end diff --git a/spec/unit/facter/systemd_spec.rb b/spec/unit/facter/systemd_spec.rb new file mode 100644 index 0000000..a7b6241 --- /dev/null +++ b/spec/unit/facter/systemd_spec.rb @@ -0,0 +1,41 @@ +require "spec_helper" + +describe Facter::Util::Fact do + before { + Facter.clear + } + + describe "systemd" do + context 'returns true when systemd present' do + before do + Facter.fact(:kernel).stubs(:value).returns(:linux) + end + let(:facts) { {:kernel => :linux} } + it do + Facter::Util::Resolution.expects(:exec).with('ps -p 1 -o comm=').returns('systemd') + expect(Facter.value(:systemd)).to eq(true) + end + end + context 'returns false when systemd not present' do + before do + Facter.fact(:kernel).stubs(:value).returns(:linux) + end + let(:facts) { {:kernel => :linux} } + it do + Facter::Util::Resolution.expects(:exec).with('ps -p 1 -o comm=').returns('init') + expect(Facter.value(:systemd)).to eq(false) + end + end + + context 'returns nil when kernel is not linux' do + before do + Facter.fact(:kernel).stubs(:value).returns(:windows) + end + let(:facts) { {:kernel => :windows} } + it do + Facter::Util::Resolution.expects(:exec).with('ps -p 1 -o comm=').never + expect(Facter.value(:systemd)).to be_nil + end + end + end +end diff --git a/spec/unit/facter/systemd_version_spec.rb b/spec/unit/facter/systemd_version_spec.rb new file mode 100644 index 0000000..5007dc6 --- /dev/null +++ b/spec/unit/facter/systemd_version_spec.rb @@ -0,0 +1,31 @@ +require "spec_helper" + +describe Facter::Util::Fact do + before { + Facter.clear + } + + describe "systemd_version" do + context 'returns version when systemd fact present' do + before do + Facter.fact(:systemd).stubs(:value).returns(true) + end + let(:facts) { {:systemd => true} } + it do + Facter::Util::Resolution.expects(:exec).with("systemctl --version | awk '/systemd/{ print $2 }'").returns('229') + expect(Facter.value(:systemd_version)).to eq('229') + end + end + context 'returns nil when systemd fact not present' do + before do + Facter.fact(:systemd).stubs(:value).returns(false) + end + let(:facts) { {:systemd => false } } + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:exec).with("systemctl --version | awk '/systemd/{ print $2 }'").never + expect(Facter.value(:systemd_version)).to eq(nil) + end + end + end +end -- cgit v1.2.3 From ec94e54f14c214a5423681e90b99d6e73094bfeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rurik=20Yl=C3=A4-Onnenvuori?= Date: Mon, 31 Oct 2016 13:03:21 +0100 Subject: Manage resource limits of services (#13) User can configure resource limits for services started by systemd --- README.md | 21 +++++++++++++++++++ manifests/init.pp | 8 +++++++- manifests/service_limits.pp | 50 +++++++++++++++++++++++++++++++++++++++++++++ templates/limits.erb | 26 +++++++++++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 manifests/service_limits.pp create mode 100644 templates/limits.erb diff --git a/README.md b/README.md index 5d962c9..51bf5cd 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,24 @@ file { '/etc/tmpfiles.d/foo.conf': } ~> Exec['systemd-tmpfiles-create'] ``` + +### service limits + +Manage soft and hard limits on various resources for executed processes. + +```puppet +::systemd::service_limits { 'foo.service': + limits => { + LimitNOFILE => 8192, + LimitNPROC => 16384 + } +} +``` + +Or provide the configuration file yourself. Systemd reloading and restarting of the service are handled by the module. + +```puppet +::systemd::service_limits { 'foo.service': + source => "puppet:///modules/${module_name}/foo.conf", +} +``` diff --git a/manifests/init.pp b/manifests/init.pp index 5e6ad79..e669f09 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,8 @@ -class systemd { +# -- Class systemd +# This module allows triggering systemd commands once for all modules +class systemd ( + $service_limits = {} +){ Exec { refreshonly => true, @@ -15,4 +19,6 @@ class systemd { command => 'systemd-tmpfiles --create', } + create_resources('systemd::service_limits', $service_limits, {}) + } diff --git a/manifests/service_limits.pp b/manifests/service_limits.pp new file mode 100644 index 0000000..a9cdc25 --- /dev/null +++ b/manifests/service_limits.pp @@ -0,0 +1,50 @@ +# -- Define: systemd::service_limits +# Creates a custom config file and reloads systemd +define systemd::service_limits( + $ensure = file, + $path = '/etc/systemd/system', + $limits = undef, + $source = undef, + $restart_service = true +) { + include ::systemd + + if $limits { + validate_hash($limits) + $content = template('systemd/limits.erb') + } + else { + $content = undef + } + + if $limits and $source { + fail('You may not supply both limits and source parameters to systemd::service_limits') + } elsif $limits == undef and $source == undef { + fail('You must supply either the limits or source parameter to systemd::service_limits') + } + + file { "${path}/${title}.d/": + ensure => 'directory', + owner => 'root', + group => 'root', + } + -> + file { "${path}/${title}.d/limits.conf": + ensure => $ensure, + content => $content, + source => $source, + owner => 'root', + group => 'root', + mode => '0444', + notify => Exec['systemctl-daemon-reload'], + } + + if $restart_service { + exec { "systemctl restart ${title}": + path => $::path, + refreshonly => true, + subscribe => File["${path}/${title}.d/limits.conf"], + require => Exec['systemctl-daemon-reload'], + } + } +} diff --git a/templates/limits.erb b/templates/limits.erb new file mode 100644 index 0000000..3caf586 --- /dev/null +++ b/templates/limits.erb @@ -0,0 +1,26 @@ +# This file is created by Puppet +[Service] +<% +[ + 'LimitCPU', + 'LimitFSIZE', + 'LimitDATA', + 'LimitSTACK', + 'LimitCORE', + 'LimitRSS', + 'LimitNOFILE', + 'LimitAS', + 'LimitNPROC', + 'LimitMEMLOCK', + 'LimitLOCKS', + 'LimitSIGPENDING', + 'LimitMSGQUEUE', + 'LimitNICE', + 'LimitRTPRIO', + 'LimitRTTIME' +].each do |d| +if @limits[d] -%> +<%= d %>=<%= @limits[d] %> +<% +end +end %> -- cgit v1.2.3 From a0321364514f52a4c110a15afbdad5109d768fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= Date: Thu, 5 Jan 2017 13:12:05 +0100 Subject: Modulesync: remove Puppet 3 tests --- .travis.yml | 10 +++------- Gemfile | 10 +++++----- spec/acceptance/nodesets/centos-7.yml | 2 +- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 96940f1..1d1bedf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,14 +13,10 @@ script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake matrix: fast_finish: true include: - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.5.0" + env: PUPPET_GEM_VERSION="~> 4.0" + - rvm: 2.3.1 + env: PUPPET_GEM_VERSION="~> 4" notifications: email: false deploy: diff --git a/Gemfile b/Gemfile index 7a15ede..377d0c1 100644 --- a/Gemfile +++ b/Gemfile @@ -25,11 +25,11 @@ group :development, :unit_tests do end group :system_tests do - gem 'beaker', :require => false - gem 'beaker-rspec', :require => false - gem 'beaker_spec_helper', :require => false - gem 'serverspec', :require => false - gem 'specinfra', :require => false + gem 'beaker', :require => false + gem 'beaker-rspec', '> 5', :require => false + gem 'beaker_spec_helper', :require => false + gem 'serverspec', :require => false + gem 'specinfra', :require => false end if facterversion = ENV['FACTER_GEM_VERSION'] diff --git a/spec/acceptance/nodesets/centos-7.yml b/spec/acceptance/nodesets/centos-7.yml index bc57539..a8fa468 100644 --- a/spec/acceptance/nodesets/centos-7.yml +++ b/spec/acceptance/nodesets/centos-7.yml @@ -9,7 +9,7 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/usr/sbin/init"]' docker_image_commands: - - 'yum install -y crontabs tar wget' + - 'yum install -y crontabs tar wget iproute' CONFIG: type: aio log_level: debug -- cgit v1.2.3