21. Software Policy
(use and contribution)
What content is OK? What's off limits?
Who signs off?
Acceptable license features
Use permission
Redistribution rights
Attribution requirements
Patent protection
Disclaimer of liability
Acceptable licenses (MIT, BSD, Apache, GPL, etc.)
Display of license (LICENSE file, file headers, etc.)
Contributor License Agreements (CLAs)
Quality control
30. manifests/site.pp
Facter >= 2.2 required for $::os structured facts
$os_name = $::os['name']
$os_major = $::os['release']['major']
$os_minor = $::os['release']['minor']
node default {
$host_group = 'default'
$security_policy = 'high'
include 'base'
warning("Node ${::certname} does not match any host groups")
}
node /^ntp[[:digit:]]{2}.dca.example.net$/ {
$host_group = 'ntp'
$location = 'DCA'
$security_policy = 'medium'
include 'base'
}
31. site/base/manifests/init.pp
Puppet >= 3.0 required
# A base class to manage Puppet runs
class base {
$hiera_classes = hiera_array('classes', [])
include $hiera_classes
}
45. Style Guide
Every major [software] project has its own style guide: a set of conventions
(sometimes arbitrary) about how to write code for that project. It is much
easier to understand a large codebase when all the code in it is in a
consistent style.
google-styleguide
https://docs.puppetlabs.com/guides/style_guide.html
49. rspec-puppet
coveragecoverage 98%98%
http://rspec-puppet.com
require 'spec_helper'
describe 'example_module' do
context 'on CentOS' do
let(:facts) {{ operatingsystem: 'CentOS' }}
context "example_module class with default parameters" do
let(:params) {{ }}
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('example_module::params') }
it { is_expected.to contain_service('example_module') }
it { is_expected.to contain_file('/path/to/example_file').with_ensure('file') }
end
end
end