diff options
Diffstat (limited to 'examples/code')
28 files changed, 0 insertions, 589 deletions
diff --git a/examples/code/allatonce b/examples/code/allatonce deleted file mode 100644 index 8912ec4e7..000000000 --- a/examples/code/allatonce +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ - -define thingie { - file { "/tmp/classtest": ensure => file, mode => 755 } - #testing {} -} - -class testing { - thingie { "componentname": } -} - -#component {} -testing { "testingname": } diff --git a/examples/code/assignments b/examples/code/assignments deleted file mode 100644 index 3edcef84e..000000000 --- a/examples/code/assignments +++ /dev/null @@ -1,11 +0,0 @@ -# $Id$ - -$goodness = sunos - -$subvariable = $goodness - -$yayness = "this is a string of text" - -#$sleeper = service { sleeper: -# running => "1" -#} diff --git a/examples/code/components b/examples/code/components deleted file mode 100644 index 3da43c571..000000000 --- a/examples/code/components +++ /dev/null @@ -1,73 +0,0 @@ -# $Id$ - -# i still have no 'require'-like functionality, and i should also -# have 'recommend'-like functionality... -define apache(php,docroot,user,group) { - package { apache: - version => "2.0.53" - } - service { apache: - running => true - } - - - # this definitely won't parse - #if $php == "true" { - # # this needs to do two things: - # # - mark a dependency - # # - cause this apache component to receive refresh events generated by php - # #require("php") - # $var = value - #} - - #file { "../examples/root/etc/configfile": - # owner => $user - #} -} - -define sudo() { - package { sudo: - version => "1.6.8p7" - } - file { "/etc/sudoers": - owner => root, - group => root, - mode => "440" - } -} - -define ssh { - package { ssh: - version => "3.4.4.4" - } - service { "sshd": - running => true - } -} - -define sleeper(path,mode) { - Service { - path => "../examples/root/etc/init.d" - } - - service { sleeper: - running => true, - path => "../examples/root/etc/init.d" - } - file { $path: - mode => $mode - } - $files = ["/tmp/testness","/tmp/funtest"] - file { $files: - ensure => file - } -} - -#apache { "test": -# php => false, -# docroot => "/export/html", -# user => "www-data", -# group => "www-data" -#} - -#ssh { "yucko":} diff --git a/examples/code/execs b/examples/code/execs deleted file mode 100644 index 44f133098..000000000 --- a/examples/code/execs +++ /dev/null @@ -1,16 +0,0 @@ -$path = "/usr/bin:/bin" - -exec { "mkdir -p /tmp/fakedir": - path => $path -} - -exec { "rm -rf /tmp/fakedir": - path => $path -} - -exec { "touch /this/directory/does/not/exist": - path => $path, - returns => 1 -} - - diff --git a/examples/code/file.bl b/examples/code/file.bl deleted file mode 100644 index ef46ba223..000000000 --- a/examples/code/file.bl +++ /dev/null @@ -1,11 +0,0 @@ -# $Id$ - -file { - "/tmp/atest": ensure => file, mode => 755; - "/tmp/btest": ensure => file, mode => 755 -} - -file { - "/tmp/ctest": ensure => file; - "/tmp/dtest": ensure => file; -} diff --git a/examples/code/filedefaults b/examples/code/filedefaults deleted file mode 100644 index 56cf76a9a..000000000 --- a/examples/code/filedefaults +++ /dev/null @@ -1,10 +0,0 @@ -# $Id$ - -File { - mode => 755, - recurse => true -} - -file { "/tmp/filedefaultstest": - ensure => file -} diff --git a/examples/code/fileparsing b/examples/code/fileparsing deleted file mode 100644 index f9766b9f6..000000000 --- a/examples/code/fileparsing +++ /dev/null @@ -1,116 +0,0 @@ -# $Id$ - -# this will eventually parse different config files - -# this creates the 'passwd' type, but it does not create any instances -filetype { "passwd": - linesplit => "\n", - escapednewlines => false -} - - -# this creates the 'PasswdUser' type, but again, no instances -filerecord { "user": - filetype => passwd, - fields => [name, password, uid, gid, gcos, home, shell], - namevar => name, - splitchar => ":" - -} - -filetype { ini: - linesplit => "\n\n" -} - -# ini files are different because we don't really care about validating fields -# or at least, we can't do it for most files... -filerecord { "initrecord": - filetype => ini, - fields => [name, password, uid, gid, gcos, home, shell], - namevar => name, - splitchar => ":" - -} - -# this won't work for multiple record types, will it? -# or at least, it requires that we specify multiple times -# ah, and it doesn't specify which of the available record types -# it works for... -passwd { user: - complete => true, # manage the whole file - path => "/etc/passwd" -} - -user { yaytest: - password => x, - uid => 10000, - gid => 10000, - home => "/home/yaytest", - gcos => "The Yaytest", - shell => "/bin/sh" -} - # there seems to be an intrinsic problem here -- i've got subtypes that only - # make sense when an instance of the super type already exists, and i need - # to associate the instances of the subtype with the instances of the supertype - # even if i created the parsers manually, I'd have the same problem - -# this is the crux of it -- i want to be able to say 'user' here without having -# to specify the file, which leaves two options: -# 1) associate the record type with a filetype instance (BAD) -# 2) once the filetype and record type are created, have another command -# that specifically creates a filetype instance and gives names for instances -# of its record types - -define syslog { - - # create a new type, with all defaults - filetype { "syslog": - escapednewlines => true - } - - filerecord { "log": - filetype => syslog, - regex => "^([^#\s]+)\s+(\S+)$", - joinchar => "\t", - fields => [logs, dest] - } - - # these two should just be supported within the filetypes - filerecord { "comment": - filetype => syslog, - regex => "^(#.*)$", - joinchar => "s", - fields => [comment] - } - - filerecord { "blank": - filetype => syslog, - regex => "^(\s*)$", - joinchar => "s", - fields => blank - } -} - -define cron { - filetype { "usercrontab": - } - - # this won't actually work, of course - filerecord { "cronjob": - filetype => crontab, - regex => "^([^#\s]+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.+)$", - joinchar => " ", - fields => [minute, hour, day, month, weekday, command], - defaults => ["*", "*", "*", "*", "*", nil], - optional => [minute, hour, day, month, weekday] - } - - crontab { "luke": - } -} - -# XXX this doesn't work in the slightest -define crontab(name,path) { - usercrontab { "${path}/${name}": - } -} diff --git a/examples/code/filerecursion b/examples/code/filerecursion deleted file mode 100644 index b7d8278c2..000000000 --- a/examples/code/filerecursion +++ /dev/null @@ -1,15 +0,0 @@ -# $Id$ - -file { "/tmp/dirtest/b/a": - mode => 755, -} - -file { "/tmp/dirtest": - mode => 755, - recurse => true, -} - -file { "/tmp/dirtest/b/b": - mode => 644, -} - diff --git a/examples/code/functions b/examples/code/functions deleted file mode 100644 index 8e95c3a72..000000000 --- a/examples/code/functions +++ /dev/null @@ -1,3 +0,0 @@ -# $Id$ - -$yaytest = fact("operatingsystem") diff --git a/examples/code/groups b/examples/code/groups deleted file mode 100644 index 35505a2eb..000000000 --- a/examples/code/groups +++ /dev/null @@ -1,7 +0,0 @@ -# $Id$ - -# there need to be two forms of adding to groups: -# add the current host to a group, and add a list of hosts to a -# group by name - -$group = "crap" diff --git a/examples/code/head b/examples/code/head deleted file mode 100644 index 59cbb6593..000000000 --- a/examples/code/head +++ /dev/null @@ -1,30 +0,0 @@ -# $Id$ - -# this file is responsible for importing all of the files we want to actually test - -# these are all of the simple tests -import "simpletests" -import "assignments" -import "selectors" -#import "iftest" -import "importing" -import "execs" -import "filedefaults" - -# facts are now imported into the top of the namespace -#import "facts" - -# obsoleted -#import "functions" - -# files we no longer need to import directly, or at all in some cases -#import "one" -#import "classing" -#import "components" -#import "file.bl" -#import "fileparsing.disabled" -#import "groups" - -# this imports the more complex files -import "allatonce" # imports classing and components -import "nodes" # imports classing and components diff --git a/examples/code/importing b/examples/code/importing deleted file mode 100644 index f02604109..000000000 --- a/examples/code/importing +++ /dev/null @@ -1,8 +0,0 @@ -# $Id$ - -#import "groups" -# testing import loops -import "importing" - -$name = "value" -$system = $operatingsystem diff --git a/examples/code/mac_automount.pp b/examples/code/mac_automount.pp deleted file mode 100644 index bab0136fc..000000000 --- a/examples/code/mac_automount.pp +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env puppet -# Jeff McCune <mccune@math.ohio-state.edu> -# -# Apple's Automounter spawns a child that sends the parent -# a SIGTERM. This makes it *very* difficult to figure out -# if the process started correctly or not. -# - -service {"automount-test": - provider => base, - hasrestart => false, - pattern => '/tmp/hometest', - start => "/usr/sbin/automount -m /tmp/home /dev/null -mnt /tmp/hometest", - stop => "ps auxww | grep '/tmp/hometest' | grep -v grep | awk '{print \$2}' | xargs kill", - ensure => running -} diff --git a/examples/code/mac_dscl.pp b/examples/code/mac_dscl.pp deleted file mode 100755 index ff59f9d8d..000000000 --- a/examples/code/mac_dscl.pp +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env puppet --debug --verbose --trace -# -# Jeff McCune: I use this for developing and testing the directory service -# provider. - -User { provider => "directoryservice" } -Group { provider => "directoryservice" } - -user { - "testgone": - ensure => absent, - uid => 550; - "testhere": - ensure => present, - password => "foobar", - shell => "/bin/bash", - uid => 551; -} - -group { - "testgone": - ensure => absent, - gid => 550; - "testhere": - ensure => present, - gid => 551; - -}
\ No newline at end of file diff --git a/examples/code/mac_dscl_revert.pp b/examples/code/mac_dscl_revert.pp deleted file mode 100755 index c9bd2b541..000000000 --- a/examples/code/mac_dscl_revert.pp +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env puppet --debug --verbose --trace -# -# Jeff McCune: I use this for developing and testing the directory service -# provider. - -User { provider => "directoryservice" } -Group { provider => "directoryservice" } - -user { - "testgone": - ensure => absent, - uid => 550; - "testhere": - ensure => absent, - uid => 551; -} - -group { - "testgone": - ensure => absent, - gid => 550; - "testhere": - ensure => absent, - gid => 551; - -} diff --git a/examples/code/mac_netinfo.pp b/examples/code/mac_netinfo.pp deleted file mode 100755 index 544b64818..000000000 --- a/examples/code/mac_netinfo.pp +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env puppet --debug - -user { - "jmccune": provider => "netinfo", ensure => present; -} diff --git a/examples/code/mac_pkgdmg.pp b/examples/code/mac_pkgdmg.pp deleted file mode 100755 index a2499e815..000000000 --- a/examples/code/mac_pkgdmg.pp +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env puppet -# - -package -{ - "Foobar.pkg.dmg": ensure => present, provider => pkgdmg; -} diff --git a/examples/code/modules/sample-module.pp b/examples/code/modules/sample-module.pp deleted file mode 100644 index 57079a0aa..000000000 --- a/examples/code/modules/sample-module.pp +++ /dev/null @@ -1,10 +0,0 @@ -# Jeff McCune <jeff.mccune@northstarlabs.net> -# 2007-08-14 -# -# Use: -# puppet --verbose --debug --modulepath=`pwd` ./sample-module.pp -# -# sample-module demonstrates the use of a custom language function -# included within the module bundle. - -include sample-module diff --git a/examples/code/modules/sample-module/README.txt b/examples/code/modules/sample-module/README.txt deleted file mode 100644 index ee4b8201a..000000000 --- a/examples/code/modules/sample-module/README.txt +++ /dev/null @@ -1,17 +0,0 @@ -Jeff McCune <jeff.mccune@northstarlabs.net> -2007-08-14 - -This small, sample module demonstrates how to extend the puppet language -with a new parser function. - -See: -manifests/init.pp -lib/puppet/parser/functions/hostname_to_dn.rb -templates/sample.erb - -Note the consistent naming of files for Puppet::Util::Autoload - -Reference Documents: -http://reductivelabs.com/trac/puppet/wiki/ModuleOrganisation -http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions -http://reductivelabs.com/trac/puppet/wiki/FunctionReference diff --git a/examples/code/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb b/examples/code/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb deleted file mode 100644 index 9f732b5bc..000000000 --- a/examples/code/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) David Schmitt <david@schmitt.edv-bus.at> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the Author nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -# Jeff McCune <jeff.mccune@northstarlabs.net> -# 2007-08-14 -# See: http://reductivelabs.com/trac/puppet/wiki/WritingYourOwnFunctions - -module Puppet::Parser::Functions - newfunction(:hostname_to_dn, :type => :rvalue, :doc => "Given 'foo.bar.com', return 'dc=foo,dc=bar,dc=com'.") do |args| - args[0].split(/\./).map do |s| "dc=%s"%[s] end.join(",") - end -end diff --git a/examples/code/modules/sample-module/manifests/init.pp b/examples/code/modules/sample-module/manifests/init.pp deleted file mode 100644 index 1af8dff1f..000000000 --- a/examples/code/modules/sample-module/manifests/init.pp +++ /dev/null @@ -1,12 +0,0 @@ -# Jeff McCune <jeff.mccune@northstarlabs.net> -# -# Demonstration of a custom parser function and erb template within -# a module, working in concert. - -class sample-module { - $fqdn_to_dn = hostname_to_dn($domain) - $sample_template = template("sample-module/sample.erb") - - notice("hostname_to_dn module function returned: [$fqdn_to_dn]") - info("sample.erb looks like:\n$sample_template") -} diff --git a/examples/code/modules/sample-module/templates/sample.erb b/examples/code/modules/sample-module/templates/sample.erb deleted file mode 100644 index b13561b45..000000000 --- a/examples/code/modules/sample-module/templates/sample.erb +++ /dev/null @@ -1,5 +0,0 @@ - -## Jeff McCune <jeff.mccune@northstarlabs.net> -fqdn: <%= fqdn %> -basedn: <%= fqdn_to_dn %> -## end sample.erb ## diff --git a/examples/code/nodes b/examples/code/nodes deleted file mode 100644 index 42488e689..000000000 --- a/examples/code/nodes +++ /dev/null @@ -1,20 +0,0 @@ -# $Id$ - -# define nodes - -#service.setpath("../examples/root/etc/init.d") - -Service { - path => "../examples/root/etc/init.d" -} - -import "classing" - -sleepserver { - path => $operatingsystem ? { - sunos => "../examples/root/etc/configfile", - hpux => "../examples/other/etc/configfile", - default => "../examples/root/etc/configfile" - }, - schedule => true -} diff --git a/examples/code/one b/examples/code/one deleted file mode 100644 index 452d32f3e..000000000 --- a/examples/code/one +++ /dev/null @@ -1,8 +0,0 @@ -# $Id$ - -# this service doesn't actually exist, so we noop it -# and this way, we can test noop :) -service { "funtest": - running => "0", - noop => true -} diff --git a/examples/code/relationships b/examples/code/relationships deleted file mode 100644 index 795788947..000000000 --- a/examples/code/relationships +++ /dev/null @@ -1,34 +0,0 @@ -# $Id$ - -#service.setpath("../examples/root/etc/init.d") -#puppet.statefile("/tmp/puppetstate") -$path = "../examples/root/etc/configfile" - path => "../examples/root/etc/init.d" - - -define files { - file { "/tmp/yaytest": - ensure => file, - mode => 755 - } - file { "/tmp/exists": - checksum => md5 - } -} - -define sleeper { - file { $path: - mode => 755 - } - service { sleeper: - path => "../examples/root/etc/init.d", - running => 1 - } -} - -files { } - -sleeper { - require => files["yay"], - schedule => true -} diff --git a/examples/code/selectors b/examples/code/selectors deleted file mode 100644 index a70399bc7..000000000 --- a/examples/code/selectors +++ /dev/null @@ -1,28 +0,0 @@ -# $Id$ -# - -$platform = SunOS - -$funtest = $platform ? { - SunOS => yayness, - AIX => goodness, - default => badness -} - -# this is a comment - -$filename = "/tmp/yayness" - -$sleeper = file { $filename: - mode => $platform ? { - SunOS => 644, - default => 755 - }, - create => $platform ? "SunOS" => true -} - -# i guess it has to be solved this way... - -#$platform ? sunos => file { $filename: -# mode => 644 -#} diff --git a/examples/code/simpletests b/examples/code/simpletests deleted file mode 100644 index b4fd3234e..000000000 --- a/examples/code/simpletests +++ /dev/null @@ -1,11 +0,0 @@ -# $Id$ - -file { - "/tmp/atest": ensure => file; - "/tmp/btest": ensure => file -} - -file { - "/tmp/ctest": ensure => file; - "/tmp/dtest": ensure => file; -} diff --git a/examples/code/svncommit b/examples/code/svncommit deleted file mode 100644 index 350cd8580..000000000 --- a/examples/code/svncommit +++ /dev/null @@ -1,13 +0,0 @@ -$path = "/usr/bin:/bin" - -file { "/tmp/svntests": - recurse => true, - checksum => md5 -} - -exec { "echo 'files have been updated'": - cwd => "/tmp/svntests", - refreshonly => true, - require => file["/tmp/svntests"], - path => $path -} |