Support of the .pp extension for Pascal

This commit is contained in:
Paul Chaignon
2014-06-10 15:40:26 +02:00
parent 701e720ab8
commit 5580f39df2
7 changed files with 63958 additions and 63398 deletions

View File

@@ -0,0 +1,26 @@
define example::expiringhost($ip, $timestamp) {
# Calculate the age of this resource by comparing 'now' against $timestamp
$age = inline_template("<%= require 'time'; Time.now - Time.parse(timestamp) %>")
# Max age, in seconds.
$maxage = 60
if $age > $maxage {
$expired = true
notice("Expiring resource $class[$name] due to age > $maxage (actual: $age)")
} else {
$expired = false
notice("Found recently-active $class[$name] (age: $age)")
}
# I set target to a /tmp path so you can run this example as non-root.
# In production, you probabyl won't set target as it defaults to /etc/hosts
# (or wherever puppet thinks your platform wants it)
host {
$name:
ip => $ip,
target => "/tmp/expiring-hosts-example-output",
ensure => $expired ? { true => absent, false => present };
}
}

View File

@@ -0,0 +1,26 @@
class foo {
notify {
"foo": ;
}
}
class bar {
notify {
"bar": ;
}
}
node default {
stage {
"one": ;
"two": ;
}
class {
"foo": stage => "one";
"bar": stage => "two";
}
Stage["one"] -> Stage["two"]
}

View File

@@ -0,0 +1,22 @@
# Manually manage /tmp/original
# Each puppet run will copy it to /tmp/flag if there's a change and notify
# the exec when it changes.
#
# The idea here is you might need (in some case) to manually manage a file outside
# of puppet (in this case, "/tmp/original"). Using this example, you can make puppet
# signal other parts of your catalog based on changes to that file.
file {
# This will, when different, copy /tmp/original to /tmp/flag and notify our
# exec.
"/tmp/flag":
source => "file:///tmp/original",
notify => Exec["hello world"];
}
exec {
"hello world":
command => "/bin/echo hello world",
refreshonly => true;
}