mirror of https://github.com/zulip/zulip.git
Remove unused puppet-common third-party module code.
This commit is contained in:
parent
084d504c39
commit
75b5d021fa
|
@ -42,13 +42,6 @@ Files: puppet/apt/*
|
||||||
Copyright: 2011, Evolving Web Inc.
|
Copyright: 2011, Evolving Web Inc.
|
||||||
License: Expat
|
License: Expat
|
||||||
|
|
||||||
Files: puppet/common/*
|
|
||||||
Copyright: 2007, David Schmitt
|
|
||||||
License: BSD-3-Clause
|
|
||||||
Comment: https://github.com/DavidS/puppet-common
|
|
||||||
Distribution includes a file `lib/puppet/parser/functions/ip_to_cron.rb` which
|
|
||||||
we removed due to unclear license
|
|
||||||
|
|
||||||
Files: puppet/stdlib/*
|
Files: puppet/stdlib/*
|
||||||
Copyright: 2011, Krzysztof Wilczynski
|
Copyright: 2011, Krzysztof Wilczynski
|
||||||
2011, Puppet Labs Inc
|
2011, Puppet Labs Inc
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
puppet-common/
|
|
|
@ -1,30 +0,0 @@
|
||||||
puppet module common
|
|
||||||
====================
|
|
||||||
|
|
||||||
written by David Schmitt
|
|
||||||
Copyright (C) 2007 David Schmitt
|
|
||||||
<david@schmitt.edv-bus.at>
|
|
||||||
|
|
||||||
adapted by immerda project group
|
|
||||||
admin+puppet(at)immerda.ch
|
|
||||||
|
|
||||||
#################################################
|
|
||||||
|
|
||||||
The common module installs various functions that are
|
|
||||||
required by other modules. This module should be
|
|
||||||
installed before any of the other module.
|
|
||||||
|
|
||||||
To use this module, follow these directions:
|
|
||||||
|
|
||||||
1. Your modules directory will need all the files
|
|
||||||
included in this repository placed under a directory
|
|
||||||
called "common"
|
|
||||||
|
|
||||||
2. Add the following line to manifests/site.pp:
|
|
||||||
|
|
||||||
import "modules.pp"
|
|
||||||
|
|
||||||
3. Add the following line to manifests/modules.pp:
|
|
||||||
|
|
||||||
import "common"
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
# A placeholder to nail this directory into git
|
|
|
@ -1 +0,0 @@
|
||||||
this directory contains various data collected for system wide configurations
|
|
|
@ -1,16 +0,0 @@
|
||||||
# basename(string) : string
|
|
||||||
# basename(string[]) : string[]
|
|
||||||
#
|
|
||||||
# Returns the last component of the filename given as argument, which must be
|
|
||||||
# formed using forward slashes (``/..) regardless of the separator used on the
|
|
||||||
# local file system.
|
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:basename, :type => :rvalue) do |args|
|
|
||||||
if args[0].is_a?(Array)
|
|
||||||
args.collect do |a| File.basename(a) end
|
|
||||||
else
|
|
||||||
File.basename(args[0])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
# dirname(string) : string
|
|
||||||
# dirname(string[]) : string[]
|
|
||||||
#
|
|
||||||
# Returns all components of the filename given as argument except the last
|
|
||||||
# one. The filename must be formed using forward slashes (``/..) regardless of
|
|
||||||
# the separator used on the local file system.
|
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:dirname, :type => :rvalue) do |args|
|
|
||||||
if args[0].is_a?(Array)
|
|
||||||
args.collect do |a| File.dirname(a) end
|
|
||||||
else
|
|
||||||
File.dirname(args[0])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
module Puppet::Parser::Functions
|
|
||||||
# thin wrapper around the ruby gsub function
|
|
||||||
# gsub($string, $pattern, $replacement) will replace all occurrences of
|
|
||||||
# $pattern in $string with $replacement. $string can be either a singel
|
|
||||||
# value or an array. In the latter case, each element of the array will
|
|
||||||
# be processed in turn.
|
|
||||||
newfunction(:gsub, :type => :rvalue) do |args|
|
|
||||||
if args[0].is_a?(Array)
|
|
||||||
args[0].collect do |val|
|
|
||||||
val.gsub(/#{args[1]}/, args[2])
|
|
||||||
end
|
|
||||||
else
|
|
||||||
args[0].gsub(/#{args[1]}/, args[2])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
# get an uniq array of ipaddresses for a hostname
|
|
||||||
require 'resolv'
|
|
||||||
|
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:hostname, :type => :rvalue) do |args|
|
|
||||||
res = Array.new
|
|
||||||
Resolv::DNS.new.each_address(args[0]){ |addr|
|
|
||||||
res << addr
|
|
||||||
}
|
|
||||||
res.uniq
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:network_lookup, :type => :rvalue) do |args|
|
|
||||||
case args[0]
|
|
||||||
when "ip" then
|
|
||||||
IPSocket::getaddress(lookupvar('fqdn'))
|
|
||||||
when "netmask" then
|
|
||||||
"255.255.255.0"
|
|
||||||
when "gateway" then
|
|
||||||
IPSocket::getaddress(lookupvar('fqdn')).gsub(/\.\d+$/, '.1')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,9 +0,0 @@
|
||||||
# prefix arguments 2..n with first argument
|
|
||||||
|
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:prefix_with, :type => :rvalue) do |args|
|
|
||||||
prefix = args.shift
|
|
||||||
args.collect {|v| "%s%s" % [prefix, v] }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# apply regexp escaping to a string
|
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:re_escape, :type => :rvalue) do |args|
|
|
||||||
Regexp.escape(args[0])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# escape slashes in a String
|
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:slash_escape, :type => :rvalue) do |args|
|
|
||||||
args[0].gsub(/\//, '\\/')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# split($string, $delimiter) : $string
|
|
||||||
# split($string[], $delimiter) : $string[][]
|
|
||||||
#
|
|
||||||
# Split the first argument(s) on every $delimiter. $delimiter is interpreted as
|
|
||||||
# Ruby regular expression.
|
|
||||||
#
|
|
||||||
# For long-term portability it is recommended to refrain from using Ruby's
|
|
||||||
# extended RE features.
|
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:split, :type => :rvalue) do |args|
|
|
||||||
if args[0].is_a?(Array)
|
|
||||||
args.collect do |a| a.split(/#{args[1]}/) end
|
|
||||||
else
|
|
||||||
args[0].split(/#{args[1]}/)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,20 +0,0 @@
|
||||||
# subsititute($string, $regex, $replacement) : $string
|
|
||||||
# subsititute($string[], $regex, $replacement) : $string[]
|
|
||||||
#
|
|
||||||
# Replace all ocurrences of $regex in $string by $replacement.
|
|
||||||
# $regex is interpreted as Ruby regular expression.
|
|
||||||
#
|
|
||||||
# For long-term portability it is recommended to refrain from using Ruby's
|
|
||||||
# extended RE features.
|
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:substitute, :type => :rvalue) do |args|
|
|
||||||
if args[0].is_a?(Array)
|
|
||||||
args[0].collect do |val|
|
|
||||||
val.gsub(/#{args[1]}/, args[2])
|
|
||||||
end
|
|
||||||
else
|
|
||||||
args[0].gsub(/#{args[1]}/, args[2])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
# Returns the content at given URL
|
|
||||||
|
|
||||||
module Puppet::Parser::Functions
|
|
||||||
newfunction(:url_get, :type => :rvalue) do |args|
|
|
||||||
require 'open-uri'
|
|
||||||
|
|
||||||
url = args[0]
|
|
||||||
|
|
||||||
begin
|
|
||||||
data = open(url, :proxy => nil)
|
|
||||||
# Ignore header
|
|
||||||
data.readline
|
|
||||||
data.readline.chomp
|
|
||||||
rescue OpenURI::HTTPError => error
|
|
||||||
fail "Fetching URL #{url} failed with status #{error.message}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
define common::append_if_no_such_line($file, $line, $refreshonly = 'false') {
|
|
||||||
exec { "/bin/echo '$line' >> '$file'":
|
|
||||||
unless => "/bin/grep -Fxqe '$line' '$file'",
|
|
||||||
path => "/bin",
|
|
||||||
refreshonly => $refreshonly,
|
|
||||||
subscribe => File[$file],
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
# common/manifests/classes/lsb_release.pp -- request the installation of
|
|
||||||
# lsb_release to get to lsbdistcodename, which is used throughout the manifests
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
||||||
# See LICENSE for the full license granted to you.
|
|
||||||
|
|
||||||
# Changelog:
|
|
||||||
# 2007-08-26: micah <micah@riseup.net> reported, that lsb_release can report
|
|
||||||
# nonsensical values for lsbdistcodename; assert_lsbdistcodename now
|
|
||||||
# recognises "n/a" and acts accordingly
|
|
||||||
|
|
||||||
# This lightweight class only asserts that $lsbdistcodename is set.
|
|
||||||
# If the assertion fails, an error is printed on the server
|
|
||||||
#
|
|
||||||
# To fail individual resources on a missing lsbdistcodename, require
|
|
||||||
# Exec[assert_lsbdistcodename] on the specific resource
|
|
||||||
class common::assert_lsbdistcodename {
|
|
||||||
|
|
||||||
case $lsbdistcodename {
|
|
||||||
'': {
|
|
||||||
err("Please install lsb_release or set facter_lsbdistcodename in the environment of $fqdn")
|
|
||||||
exec { "false # assert_lsbdistcodename": alias => assert_lsbdistcodename }
|
|
||||||
}
|
|
||||||
'n/a': {
|
|
||||||
case $operatingsystem {
|
|
||||||
"Debian": {
|
|
||||||
err("lsb_release was unable to report your distcodename; This seems to indicate a broken apt/sources.list on $fqdn")
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
err("lsb_release was unable to report your distcodename; please set facter_lsbdistcodename in the environment of $fqdn")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exec { "false # assert_lsbdistcodename": alias => assert_lsbdistcodename }
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
exec { "true # assert_lsbdistcodename": alias => assert_lsbdistcodename }
|
|
||||||
exec { "true # require_lsbdistcodename": alias => require_lsbdistcodename }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
# common/manifests/defines/concatenated_file.pp -- create a file from snippets
|
|
||||||
# stored in a directory
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
||||||
# See LICENSE for the full license granted to you.
|
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# * create the directory in _part too
|
|
||||||
|
|
||||||
# Usage:
|
|
||||||
# concatenated_file { "/etc/some.conf":
|
|
||||||
# dir => "/etc/some.conf.d",
|
|
||||||
# }
|
|
||||||
# Use Exec["concat_$name"] as Semaphor
|
|
||||||
define common::concatenated_file (
|
|
||||||
# where the snippets are located
|
|
||||||
$dir = '',
|
|
||||||
# a file with content to prepend
|
|
||||||
$header = '',
|
|
||||||
# a file with content to append
|
|
||||||
$footer = '',
|
|
||||||
$mode = 0644, $owner = root, $group = 0
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
$dir_real = $dir ? { '' => "${name}.d", default => $dir }
|
|
||||||
|
|
||||||
if defined(File[$dir_real]) {
|
|
||||||
debug("${dir_real} already defined")
|
|
||||||
} else {
|
|
||||||
file {
|
|
||||||
$dir_real:
|
|
||||||
source => "puppet://$server/common/empty",
|
|
||||||
checksum => mtime,
|
|
||||||
ignore => '\.ignore',
|
|
||||||
recurse => true, purge => true, force => true,
|
|
||||||
mode => $mode, owner => $owner, group => $group,
|
|
||||||
notify => Exec["concat_${name}"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file {
|
|
||||||
$name:
|
|
||||||
ensure => present, checksum => md5,
|
|
||||||
mode => $mode, owner => $owner, group => $group;
|
|
||||||
}
|
|
||||||
|
|
||||||
# if there is a header or footer file, add it
|
|
||||||
$additional_cmd = $header ? {
|
|
||||||
'' => $footer ? {
|
|
||||||
'' => '',
|
|
||||||
default => "| cat - '${footer}' "
|
|
||||||
},
|
|
||||||
default => $footer ? {
|
|
||||||
'' => "| cat '${header}' - ",
|
|
||||||
default => "| cat '${header}' - '${footer}' "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# use >| to force clobbering the target file
|
|
||||||
exec { "concat_${name}":
|
|
||||||
command => "/usr/bin/find ${dir_real} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat ${additional_cmd} >| ${name}",
|
|
||||||
refreshonly => true,
|
|
||||||
subscribe => [ File[$dir_real] ],
|
|
||||||
before => File[$name],
|
|
||||||
refreshonly => true,
|
|
||||||
subscribe => [ File[$dir_real] ],
|
|
||||||
before => File[$name],
|
|
||||||
alias => [ "concat_${dir_real}"] ,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
# Add a snippet called $name to the concatenated_file at $dir.
|
|
||||||
# The file can be referenced as File["cf_part_${name}"]
|
|
||||||
define common::concatenated_file_part (
|
|
||||||
$dir, $content = '', $ensure = present,
|
|
||||||
$mode = 0644, $owner = root, $group = 0
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
file { "${dir}/${name}":
|
|
||||||
ensure => $ensure, content => $content,
|
|
||||||
mode => $mode, owner => $owner, group => $group,
|
|
||||||
alias => "cf_part_${name}",
|
|
||||||
notify => Exec["concat_${dir}"],
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,91 +0,0 @@
|
||||||
# Inspired by David Schmitt's concatenated_file.pp
|
|
||||||
|
|
||||||
define common::concatfilepart (
|
|
||||||
$ensure = present,
|
|
||||||
$file,
|
|
||||||
$content = false,
|
|
||||||
$source = false,
|
|
||||||
$manage = false
|
|
||||||
) {
|
|
||||||
|
|
||||||
# Resulting file
|
|
||||||
if defined(File[$file]) {
|
|
||||||
debug("${file} already defined")
|
|
||||||
} else {
|
|
||||||
file {$file:
|
|
||||||
ensure => present,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Directory containing file parts
|
|
||||||
$dir = "${file}.d"
|
|
||||||
|
|
||||||
if defined(File[$dir]) {
|
|
||||||
debug("${dir} already defined")
|
|
||||||
} else {
|
|
||||||
file {$dir:
|
|
||||||
ensure => directory,
|
|
||||||
mode => 0600,
|
|
||||||
source => "puppet:///modules/common/empty/",
|
|
||||||
recurse => $manage,
|
|
||||||
purge => $manage,
|
|
||||||
force => $manage,
|
|
||||||
ignore => '.ignore',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if $notify {
|
|
||||||
if $content {
|
|
||||||
file {"${dir}/${name}":
|
|
||||||
ensure => $ensure,
|
|
||||||
content => $content,
|
|
||||||
mode => 0600,
|
|
||||||
notify => [Exec["${file} concatenation"], $notify],
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
file {"${dir}/${name}":
|
|
||||||
ensure => $ensure,
|
|
||||||
source => $source,
|
|
||||||
mode => 0600,
|
|
||||||
notify => [Exec["${file} concatenation"], $notify],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if $content {
|
|
||||||
file {"${dir}/${name}":
|
|
||||||
ensure => $ensure,
|
|
||||||
content => $content,
|
|
||||||
mode => 0600,
|
|
||||||
notify => Exec["${file} concatenation"],
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
file {"${dir}/${name}":
|
|
||||||
ensure => $ensure,
|
|
||||||
source => $source,
|
|
||||||
mode => 0600,
|
|
||||||
notify => Exec["${file} concatenation"],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# The actual file generation
|
|
||||||
if defined(Exec["${file} concatenation"]) {
|
|
||||||
|
|
||||||
debug("Blah")
|
|
||||||
#Exec["${file} concatenation"] {
|
|
||||||
# require +> File["${dir}/${name}"],
|
|
||||||
#}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
# use >| to force clobbering the target file
|
|
||||||
exec { "${file} concatenation":
|
|
||||||
command => "/usr/bin/find ${dir} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat >| ${file}",
|
|
||||||
refreshonly => true,
|
|
||||||
subscribe => File[$dir],
|
|
||||||
before => File[$file],
|
|
||||||
# require => File["${dir}/${name}"],
|
|
||||||
#alias => [ "concat_${name}", "concat_${dir}"] ,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
# common/manifests/defines/config_file.pp -- create a config file with default permissions
|
|
||||||
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
||||||
# See LICENSE for the full license granted to you.
|
|
||||||
|
|
||||||
# Usage:
|
|
||||||
# config_file { filename:
|
|
||||||
# content => "....\n",
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# Examples:
|
|
||||||
#
|
|
||||||
# To create the file /etc/vservers/${vs_name}/context with specific
|
|
||||||
# content:
|
|
||||||
#
|
|
||||||
# config_file { "/etc/vservers/${vs_name}/context":
|
|
||||||
# content => "${context}\n",
|
|
||||||
# notify => Exec["vs_restart_${vs_name}"],
|
|
||||||
# require => Exec["vs_create_${vs_name}"];
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# To create the file /etc/apache2/sites-available/munin-stats with the
|
|
||||||
# content pulled from a template:
|
|
||||||
#
|
|
||||||
# config_file { "/etc/apache2/sites-available/munin-stats":
|
|
||||||
# content => template("apache/munin-stats"),
|
|
||||||
# require => Package["apache2"],
|
|
||||||
# notify => Exec["reload-apache2"]
|
|
||||||
# }
|
|
||||||
|
|
||||||
define config_file ($content = '', $source = '', $ensure = 'present') {
|
|
||||||
file { $name:
|
|
||||||
ensure => $ensure,
|
|
||||||
# keep old versions on the server
|
|
||||||
backup => server,
|
|
||||||
# default permissions for config files
|
|
||||||
mode => 0644, owner => root, group => 0,
|
|
||||||
# really detect changes to this file
|
|
||||||
checksum => md5,
|
|
||||||
}
|
|
||||||
|
|
||||||
case $source {
|
|
||||||
'': { }
|
|
||||||
default: { File[$name] { source => $source } }
|
|
||||||
}
|
|
||||||
|
|
||||||
case $content {
|
|
||||||
'': { }
|
|
||||||
default: { File[$name] { content => $content } }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
# common/manifests/defines/line.pp -- a trivial mechanism to ensure a line exists in a file
|
|
||||||
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
||||||
# See LICENSE for the full license granted to you.
|
|
||||||
|
|
||||||
# Usage:
|
|
||||||
# line { description:
|
|
||||||
# file => "filename",
|
|
||||||
# line => "content",
|
|
||||||
# ensure => {absent,*present*}
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# The following ensures that the line "allow ^$munin_host$" exists
|
|
||||||
# in /etc/munin/munin-node.conf, and if there are any changes notify the service for
|
|
||||||
# a restart
|
|
||||||
#
|
|
||||||
# line { allow_munin_host:
|
|
||||||
# file => "/etc/munin/munin-node.conf",
|
|
||||||
# line => "allow ^$munin_host$",
|
|
||||||
# ensure => present,
|
|
||||||
# notify => Service[munin-node],
|
|
||||||
# require => Package[munin-node],
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
#
|
|
||||||
define common::line($file, $line, $ensure = 'present') {
|
|
||||||
case $ensure {
|
|
||||||
default : { err ( "unknown ensure value '${ensure}'" ) }
|
|
||||||
present: {
|
|
||||||
exec { "/bin/echo '${line}' >> '${file}'":
|
|
||||||
unless => "/bin/grep -qFx '${line}' '${file}'"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
absent: {
|
|
||||||
exec { "/usr/bin/perl -ni -e 'print if \$_ ne \"${line}\n\";' '${file}'":
|
|
||||||
onlyif => "/bin/grep -qFx '${line}' '${file}'"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
# common/manifests/defines/modules_dir.pp -- create a default directory
|
|
||||||
# for storing module specific information
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
||||||
# See LICENSE for the full license granted to you.
|
|
||||||
|
|
||||||
# Usage:
|
|
||||||
# modules_dir { ["common", "common/dir1", "common/dir2" ]: }
|
|
||||||
define modules_dir (
|
|
||||||
$mode = 0644, $owner = root, $group = 0
|
|
||||||
)
|
|
||||||
{
|
|
||||||
$dir = "/var/lib/puppet/modules/${name}"
|
|
||||||
if defined(File[$dir]) {
|
|
||||||
debug("${dir} already defined")
|
|
||||||
} else {
|
|
||||||
file {
|
|
||||||
"/var/lib/puppet/modules/${name}":
|
|
||||||
source => [ "puppet:///modules/${name}/modules_dir", "puppet:///modules/common/empty"],
|
|
||||||
checksum => mtime,
|
|
||||||
# ignore the placeholder
|
|
||||||
ignore => '\.ignore',
|
|
||||||
recurse => true, purge => true, force => true,
|
|
||||||
mode => $mode, owner => $owner, group => $group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
# common/manifests/defines/modules_file.pp -- use a modules_dir to store module
|
|
||||||
# specific files
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
||||||
# See LICENSE for the full license granted to you.
|
|
||||||
|
|
||||||
# Usage:
|
|
||||||
# modules_file { "module/file":
|
|
||||||
# source => "puppet://..",
|
|
||||||
# mode => 644, # default
|
|
||||||
# owner => root, # default
|
|
||||||
# group => root, # default
|
|
||||||
# }
|
|
||||||
define common::modules_file (
|
|
||||||
$source,
|
|
||||||
$mode = 0644, $owner = root, $group = root
|
|
||||||
)
|
|
||||||
{
|
|
||||||
file {
|
|
||||||
"/var/lib/puppet/modules/${name}":
|
|
||||||
source => $source,
|
|
||||||
mode => $mode, owner => $owner, group => $group;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
# common/manifests/defines/replace.pp -- replace a pattern in a file with a string
|
|
||||||
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
||||||
# See LICENSE for the full license granted to you.
|
|
||||||
|
|
||||||
# Usage:
|
|
||||||
#
|
|
||||||
# replace { description:
|
|
||||||
# file => "filename",
|
|
||||||
# pattern => "regexp",
|
|
||||||
# replacement => "replacement"
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# To replace the current port in /etc/munin/munin-node.conf
|
|
||||||
# with a new port, but only disturbing the file when needed:
|
|
||||||
#
|
|
||||||
# replace { set_munin_node_port:
|
|
||||||
# file => "/etc/munin/munin-node.conf",
|
|
||||||
# pattern => "^port (?!$port)[0-9]*",
|
|
||||||
# replacement => "port $port"
|
|
||||||
# }
|
|
||||||
|
|
||||||
define common::replace($file, $pattern, $replacement) {
|
|
||||||
$pattern_no_slashes = slash_escape($pattern)
|
|
||||||
$replacement_no_slashes = slash_escape($replacement)
|
|
||||||
exec { "replace_${pattern}_${file}":
|
|
||||||
command => "/usr/bin/perl -pi -e 's/${pattern_no_slashes}/${replacement_no_slashes}/' '${file}'",
|
|
||||||
onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /${pattern_no_slashes}/ && ! /\\Q${replacement_no_slashes}\\E/; END { exit \$ret; }' '${file}'",
|
|
||||||
alias => "exec_$name",
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
# To fail the complete compilation, include this class
|
|
||||||
class common::require_lsbdistcodename inherits common::assert_lsbdistcodename {
|
|
||||||
exec { "false # require_lsbdistcodename": require => Exec[require_lsbdistcodename], }
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
import "../manifests/concatfilepart.pp"
|
|
||||||
|
|
||||||
common::concatfilepart{"0_header":
|
|
||||||
ensure => present,
|
|
||||||
content => "A",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
||||||
|
|
||||||
common::concatfilepart{"1_body":
|
|
||||||
ensure => present,
|
|
||||||
content => "B",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
||||||
|
|
||||||
common::concatfilepart{"9_footer":
|
|
||||||
ensure => present,
|
|
||||||
content => "C",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
import "../manifests/concatfilepart.pp"
|
|
||||||
|
|
||||||
common::concatfilepart{"0_header":
|
|
||||||
ensure => absent,
|
|
||||||
content => "A",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
||||||
|
|
||||||
common::concatfilepart{"1_body":
|
|
||||||
ensure => present,
|
|
||||||
content => "B",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
||||||
|
|
||||||
common::concatfilepart{"9_footer":
|
|
||||||
ensure => present,
|
|
||||||
content => "C",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
import "../manifests/concatfilepart.pp"
|
|
||||||
|
|
||||||
common::concatfilepart{"0_blah":
|
|
||||||
ensure => present,
|
|
||||||
content => "Z",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
||||||
|
|
||||||
common::concatfilepart{"1_body":
|
|
||||||
ensure => present,
|
|
||||||
content => "B",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
||||||
|
|
||||||
common::concatfilepart{"9_footer":
|
|
||||||
ensure => present,
|
|
||||||
content => "C",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
import "../manifests/concatfilepart.pp"
|
|
||||||
|
|
||||||
common::concatfilepart{"0_blah":
|
|
||||||
ensure => absent,
|
|
||||||
content => "Z",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
||||||
|
|
||||||
common::concatfilepart{"1_body":
|
|
||||||
ensure => absent,
|
|
||||||
content => "B",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
||||||
|
|
||||||
common::concatfilepart{"9_footer":
|
|
||||||
ensure => absent,
|
|
||||||
content => "C",
|
|
||||||
file => "/tmp/test-concat.txt",
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
error() {
|
|
||||||
echo "Error"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
TF="/tmp/test-concat.txt"
|
|
||||||
|
|
||||||
echo "concatfilepart"
|
|
||||||
echo
|
|
||||||
|
|
||||||
rm -r /tmp/test-concat.txt*
|
|
||||||
|
|
||||||
puppet concatfilepart1.pp
|
|
||||||
echo "ABC =? $(cat /tmp/test-concat.txt)"
|
|
||||||
|
|
||||||
puppet concatfilepart2.pp
|
|
||||||
echo "BC =? $(cat /tmp/test-concat.txt)"
|
|
||||||
|
|
||||||
puppet concatfilepart3.pp
|
|
||||||
echo "ZBC =? $(cat /tmp/test-concat.txt)"
|
|
||||||
|
|
||||||
puppet concatfilepart4.pp
|
|
||||||
echo " =? $(cat /tmp/test-concat.txt)"
|
|
|
@ -46,7 +46,6 @@ tools/jslint/jslint.js
|
||||||
api/setup.py
|
api/setup.py
|
||||||
api/integrations/perforce/git_p4.py
|
api/integrations/perforce/git_p4.py
|
||||||
puppet/apt/.forge-release
|
puppet/apt/.forge-release
|
||||||
puppet/puppet-common/tests/
|
|
||||||
puppet/apt/README.md
|
puppet/apt/README.md
|
||||||
static/locale
|
static/locale
|
||||||
""".split()
|
""".split()
|
||||||
|
|
|
@ -25,8 +25,6 @@ import sys
|
||||||
|
|
||||||
exclude_trees = """
|
exclude_trees = """
|
||||||
static/third
|
static/third
|
||||||
puppet/common
|
|
||||||
puppet/puppet-common
|
|
||||||
puppet/apt
|
puppet/apt
|
||||||
puppet/puppet-apt
|
puppet/puppet-apt
|
||||||
certs
|
certs
|
||||||
|
|
Loading…
Reference in New Issue