Permalink
Browse files

More puppet snippets

  • Loading branch information...
1 parent c3d7685 commit f5578f51f1a1ae1fe403951362d1c908906c0265 Tim Sharpe committed Jan 7, 2011
Showing with 151 additions and 2 deletions.
  1. +151 −2 snippets/puppet.snippets
View
@@ -1,11 +1,160 @@
-# class
snippet cl
class ${1:classname} {
${2:# code}
}
-# defined type
+snippet clin
+ class ${1:classname} inherits ${2:classname} {
+ ${3:# code}
+ }
+
snippet def
define ${1:typename}(${2:args}) {
${3:# code}
}
+
+snippet node
+ node "${1:name}" {
+ ${2:# code}
+ }
+
+snippet nodein
+ node "${1:name}" inherits "${2:name}" {
+ ${3:# code}
+ }
+
+#############################################################################
+# CONDITIONALS
+
+snippet if
+ if $${1:variable} ${2:==} ${3:"value"} {
+ ${4:# code}
+ }
+
+snippet ifelse
+ if $${1:variable} ${2:==} ${3:"value"} {
+ ${4:# code}
+ }
+ ${5:# code}
+ }
+
+snippet elsif
+ elsif $${1:variable} {
+ ${2:# code}
+ }
+
+snippet elsifelse
+ elsif $${1:variable} {
+ ${2:# code}
+ } else {
+ ${3:# code}
+ }
+
+snippet $?
+ $${1:variable} ? {
+ ${2:value} => ${3:result},
+ default => ${4:result},
+ },
+
+snippet case
+ case $${1:variable} {
+ ${2:value}: {
+ ${3:# code}
+ }
+ default: {
+ ${4:# code}
+ }
+ }
+
+
+#############################################################################
+# BUILT IN FUNCTIONS
+
+snippet alert
+ alert("${1:string}")
+
+snippet crit
+ crit("${1:string}")
+
+snippet debug
+ debug("${1:string}")
+
+snippet defined
+ defined(${1:resource})
+
+snippet emerg
+ emerg("${1:string}")
+
+snippet err
+ err("${1:string}")
+
+snippet extlookup
+ extlookup("${1:key}", "${2:default value}")
+
+snippet fail
+ fail("${1:string}")
+
+snippet file
+ file("${1:path}")
+
+snippet fqdn
+ fqdn_rand(${1:range})
+
+snippet generate
+ generate("${1:command}")
+
+snippet inc
+ include ${1:classname}
+
+snippet info
+ info("${1:string}")
+
+snippet inline
+ inline_template("${1:string}")
+
+snippet md5
+ md5("${1:string}")
+
+snippet notice
+ notice("${1:string}")
+
+snippet realize
+ realize(${1:string})
+
+snippet regsubst
+ regsubst($${1:target}, /${2:regexp}/, "${3:replacement}")
+
+snippet require
+ require ${1:classname}
+
+snippet search
+ search(${1:namespace})
+
+snippet sha1
+ sha1(${1:string})
+
+snippet quote
+ shellquote(${1:args})
+
+snippet split
+ split($${1:string}, "${2:regexp}")
+
+snippet sprintf
+ sprintf("${1:string}", ${2:args})
+
+snippet tag
+ tag("${1:string}")
+
+snippet tagged
+ tagged("${1:string}")
+
+snippet template
+ template("${1:path}")
+
+snippet versioncmp
+ versioncmp("${1:a}", "${2:b}")
+
+snippet warn
+ warning("${1:string}")
+
+

0 comments on commit f5578f5

Please sign in to comment.