...
 
Commits (10)
......@@ -146,6 +146,14 @@ suites:
- To boldly go where no one has gone before!
footer: Engage!
info: true
- name: sys_chef
run_list:
- recipe[sys::chef]
attributes:
sys:
chef:
server_url:
http://localhost:4000
- name: sys_mail
run_list:
- recipe[sys::mail]
......
......@@ -56,8 +56,10 @@ jobs:
- stage: chefspec
script: bundle exec rake chefspec
env: CHEF_VERSION=14
rvm: 2.5
- stage: chefspec
script: bundle exec rake chefspec
rvm: 2.5
- stage: kitchen
env: KITCHEN_PLATFORM=debian-stretch
script: bundle exec kitchen test $KITCHEN_PLATFORM
......
......@@ -14,7 +14,8 @@ begin
require 'foodcritic'
FoodCritic::Rake::LintTask.new do |task|
task.options = {
:exclude_paths => ['example_config/**/*']
exclude_paths: ['example_config/**/*'],
fail_tags: %w[!FC091 !FC092]
}
end
rescue LoadError
......
......@@ -15,4 +15,4 @@ supports 'debian'
depends 'line', '< 1.0'
version '1.53.4'
version '1.53.5'
<%= template_header %>
node_name '<%= node['fqdn'] %>'
chef_server_url '<%= @server_url %>'
client_key "<%= @client_key %>"
<% if @trusted_certs_dir -%>
trusted_certs_dir "<%= @trusted_certs_dir %>"
<% end -%>
<%- if @verify_ssl == 'all' -%>
# Verify all HTTPS connections
ssl_verify_mode :verify_peer
<%- elsif @verify_ssl == 'chef-server' -%>
# Verify only connections to chef-server
verify_api_cert true
<%- end -%>
validation_client_name "<%= @validation_client_name %>"
validation_key "<%= @validation_key %>"
log_level <%= @log_level %>
log_location <%= @use_syslog?'SyslogLogger.new("chef-client")':'STDOUT' %>
file_backup_path "/var/backups/chef"
file_cache_path "/var/cache/chef"
pid_file "/var/run/chef/client.pid"
# configuration for Ohai:
<%- unless @odisable.empty? -%>
<%# Make sure to write symbols into the configuration file %>
<%- plugins = @odisable.map { |p| p.capitalize.to_sym } -%>
Ohai::Config[:disabled_plugins] = <%= plugins %>
<%- end %>
Ohai::Config[:plugin_path] << "<%= @opath %>"
<%= @custom_config %>
<%= template_header %>
node_name '<%= node['fqdn'] %>'
chef_server_url '<%= @server_url %>'
client_key "<%= @client_key %>"
<% if @trusted_certs_dir -%>
trusted_certs_dir "<%= @trusted_certs_dir %>"
<% end -%>
<%- if @verify_ssl == 'all' -%>
# Verify all HTTPS connections
ssl_verify_mode :verify_peer
<%- elsif @verify_ssl == 'chef-server' -%>
# Verify only connections to chef-server
verify_api_cert true
<%- end -%>
validation_client_name "<%= @validation_client_name %>"
validation_key "<%= @validation_key %>"
log_level <%= @log_level %>
log_location <%= @use_syslog?'SyslogLogger.new("chef-client")':'STDOUT' %>
file_backup_path "/var/backups/chef"
file_cache_path "/var/cache/chef"
pid_file "/var/run/chef/client.pid"
# configuration for Ohai:
<%- unless @odisable.empty? -%>
<%# Make sure to write symbols into the configuration file %>
<%- plugins = @odisable.map { |p| p.capitalize.to_sym } -%>
Ohai::Config[:disabled_plugins] = <%= plugins %>
<%- end %>
Ohai::Config[:plugin_path] << "<%= @opath %>"
<%= @custom_config %>
......@@ -30,8 +30,8 @@ pid_file "/var/run/chef/client.pid"
<%- unless @odisable.empty? -%>
<%# Make sure to write symbols into the configuration file %>
<%- plugins = @odisable.map { |p| p.capitalize.to_sym } -%>
Ohai::Config[:disabled_plugins] = <%= plugins %>
ohai.disabled_plugins = <%= plugins %>
<%- end %>
Ohai::Config[:plugin_path] << "<%= @opath %>"
ohai.plugin_path << "<%= @opath %>"
<%= @custom_config %>
......@@ -2,10 +2,6 @@
<%= template_header %>
#
# Configuration file for ferm(1), created by Chef cookbook sys::ferm
#
<% node['sys']['ferm']['rules'].each do |domain, tables| -%>
domain <%= domain %> {
<% tables.each do |table, chains| -%>
......
source 'http://rubygems.org'
group :jessie do
# net-ssh >= 5 requires ruby 2.2 and
# net-telnet >= 0.2 requires ruby 2.3
if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.2.0')
gem 'net-ssh', '< 5'
gem 'net-telnet', '< 0.2'
end
end
group :wheezy do
# net-ssh >= 5 requires ruby 2.2
if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem 'rake', '< 12.3'
end
end
#
# Cookbook Name:: sys
# Serverspec integration tests for sys::chef
#
# Copyright 2020 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
#
# Authors:
# Christopher Huhn <C.Huhn@gsi.de>
#
# 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.
#
require 'spec_helper'
require 'chef_zero/server'
context 'chef-client config' do
before(:all) do
# start chef-zero
server = ChefZero::Server.new(port: 4000)
server.start_background
# create dummy key:
`openssl genrsa -out /etc/chef/client.pem`
end
describe command('chef-client') do
its(:exit_status) { should be_zero }
its(:stdout) { should contain('Chef Run complete') }
end
end
require 'serverspec'
set :backend, :exec
#
# Cookbook Name:: sys
# Tests for custom resource sys_systemd_unit
#
# Copyright 2015 - 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
# Copyright 2015-2020 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
#
# Authors:
# Dennis Klein
# Christopher Huhn
# Christopher Huhn <c.huhn@gsi.de>
# Dennis Klein <d.klein@gsi.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -22,7 +23,8 @@
require 'spec_helper'
describe 'lwrp: sys_systemd_unit' do
# skip this test on travis as it is very slow and times out with Chef >= 13
describe 'lwrp: sys_systemd_unit', unless: ENV['TRAVIS'] do
let(:runner) do
ChefSpec::ServerRunner.new(
......
......@@ -101,9 +101,9 @@ describe 'sys::mail' do
it "manages #{etc_postfix_virtual}" do
expect(chef_run).to create_template(etc_postfix_virtual).with_mode('0600')
expect(chef_run.template(etc_postfix_virtual))
.to notify("execute[#{update_virtual}]").to(:run).immediately
expect(chef_run.execute(update_virtual)).to do_nothing
expect(chef_run.execute(update_virtual))
.to notify("execute[update-virtual]").to(:run).immediately
expect(chef_run.execute('update-virtual')).to do_nothing
expect(chef_run.execute('update-virtual'))
.to notify("service[#{postfix}]").to(:reload).delayed
end
......
......@@ -8,9 +8,11 @@ describe 'sys::multipath' do
end
context 'with some test attributes' do
before do
chef_run.node.default['sys']['multipath']['defaults']['user_friendly_names'] = 'yes'
chef_run.converge(described_recipe)
cached(:chef_run) do
ChefSpec::SoloRunner.new do |node|
node.default['sys']['multipath']['defaults']['user_friendly_names'] =
'yes'
end.converge(described_recipe)
end
it 'installs multipath-tools' do
......