summaryrefslogtreecommitdiffstats
path: root/lib/puppet/type
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-04-02 18:56:53 -0500
committerLuke Kanies <luke@madstop.com>2009-04-02 18:56:53 -0500
commit6e79cc00965a50c44f215fd1e553281cfd2b87c9 (patch)
tree56c496df9ad6ab66dfb16993910eb5ff1c34d065 /lib/puppet/type
parent62dad7a5f87f8d6285650ab1b727819db27cf2a7 (diff)
parentc62c19370bfba881819c1a3d9da2f8e6fb52e5d9 (diff)
downloadpuppet-6e79cc00965a50c44f215fd1e553281cfd2b87c9.tar.gz
puppet-6e79cc00965a50c44f215fd1e553281cfd2b87c9.tar.xz
puppet-6e79cc00965a50c44f215fd1e553281cfd2b87c9.zip
Merge branch '0.24.x'
Conflicts: bin/ralsh lib/puppet/executables/client/certhandler.rb lib/puppet/parser/functions/versioncmp.rb lib/puppet/parser/resource/reference.rb lib/puppet/provider/augeas/augeas.rb lib/puppet/provider/nameservice/directoryservice.rb lib/puppet/provider/ssh_authorized_key/parsed.rb lib/puppet/type.rb lib/puppet/type/file/checksum.rb spec/integration/defaults.rb spec/integration/transaction/report.rb spec/unit/executables/client/certhandler.rb spec/unit/indirector/ssl_rsa/file.rb spec/unit/node/catalog.rb spec/unit/provider/augeas/augeas.rb spec/unit/rails.rb spec/unit/type/ssh_authorized_key.rb spec/unit/type/tidy.rb test/executables/filebucket.rb test/executables/puppetbin.rb
Diffstat (limited to 'lib/puppet/type')
-rw-r--r--lib/puppet/type/augeas.rb34
-rwxr-xr-xlib/puppet/type/file/checksum.rb42
-rw-r--r--lib/puppet/type/ssh_authorized_key.rb14
3 files changed, 39 insertions, 51 deletions
diff --git a/lib/puppet/type/augeas.rb b/lib/puppet/type/augeas.rb
index c89400b5e..da9cff369 100644
--- a/lib/puppet/type/augeas.rb
+++ b/lib/puppet/type/augeas.rb
@@ -19,10 +19,10 @@
Puppet::Type.newtype(:augeas) do
include Puppet::Util
-
+
feature :parse_commands, "Parse the command string"
feature :need_to_run?, "If the command should run"
- feature :execute_changes, "Actually make the changes"
+ feature :execute_changes, "Actually make the changes"
@doc = "Apply the changes (single or array of changes) to the filesystem
via the augeas tool.
@@ -59,7 +59,7 @@ Puppet::Type.newtype(:augeas) do
newparam (:context) do
desc "Optional context path. This value is pre-pended to the paths of all changes"
- defaultto ""
+ defaultto ""
end
newparam (:onlyif) do
@@ -81,7 +81,7 @@ Puppet::Type.newtype(:augeas) do
AN_ARRAY is in the form ['a string', 'another']"
defaultto ""
end
-
+
newparam(:changes) do
desc "The changes which should be applied to the filesystem. This
@@ -92,14 +92,13 @@ Puppet::Type.newtype(:augeas) do
rm [PATH] Removes the node at location PATH
remove [PATH] Synonym for rm
clear [PATH] Keeps the node at PATH, but removes the value.
- ins [LABEL] [WHERE] [PATH]
+ ins [LABEL] [WHERE] [PATH]
Inserts an empty node LABEL either [WHERE={before|after}] PATH.
- insert [LABEL] [WHERE] [PATH]
+ insert [LABEL] [WHERE] [PATH]
Synonym for ins
-
If the parameter 'context' is set that value is prepended to PATH"
- munge do |value|
+ munge do |value|
provider.parse_commands(value)
end
end
@@ -115,6 +114,13 @@ Puppet::Type.newtype(:augeas) do
defaultto ""
end
+ newparam(:force) do
+ desc "Optional command to force the augeas type to execute even if it thinks changes
+ will not be made. This does not overide the only setting. If onlyif is set, then the
+ foce setting will not override that result"
+
+ defaultto false
+ end
newparam(:type_check) do
desc "Set to true if augeas should perform typechecking. Optional, defaults to false"
@@ -122,7 +128,7 @@ Puppet::Type.newtype(:augeas) do
defaultto :false
end
-
+
# This is the acutal meat of the code. It forces
# augeas to be run and fails or not based on the augeas return
# code.
@@ -131,12 +137,12 @@ Puppet::Type.newtype(:augeas) do
desc "The expected return code from the augeas command. Should not be set"
defaultto 0
-
+
# Make output a bit prettier
def change_to_s(currentvalue, newvalue)
return "executed successfully"
- end
-
+ end
+
# if the onlyif resource is provided, then the value is parsed.
# a return value of 0 will stop exection becuase it matches the
# default value.
@@ -146,12 +152,12 @@ Puppet::Type.newtype(:augeas) do
else
0
end
- end
+ end
# Actually execute the command.
def sync
@resource.provider.execute_changes()
end
- end
+ end
end
diff --git a/lib/puppet/type/file/checksum.rb b/lib/puppet/type/file/checksum.rb
index 76e27e55d..54d1c463b 100755
--- a/lib/puppet/type/file/checksum.rb
+++ b/lib/puppet/type/file/checksum.rb
@@ -11,11 +11,13 @@ Puppet::Type.type(:file).newproperty(:checksum) do
like Tripwire without managing the file contents in any way. You can
specify that a file's checksum should be monitored and then subscribe to
the file from another object and receive events to signify
- checksum changes, for instance.
-
+ checksum changes, for instance.
+
There are a number of checksum types available including MD5 hashing (and
an md5lite variation that only hashes the first 500 characters of the
- file."
+ file.
+
+ The default checksum parameter, if checksums are enabled, is md5."
@event = :file_changed
@@ -41,11 +43,6 @@ Puppet::Type.type(:file).newproperty(:checksum) do
handlesum()
end
- newvalue(:nosum) do
- # nothing
- :nochange
- end
-
# If they pass us a sum type, behave normally, but if they pass
# us a sum type + sum, stick the sum in the cache.
munge do |value|
@@ -134,35 +131,6 @@ Puppet::Type.type(:file).newproperty(:checksum) do
cache(checktype())
end
- # Retrieve the cached sum
- def getcachedsum
- hash = nil
- unless hash = @resource.cached(:checksums)
- hash = {}
- @resource.cache(:checksums, hash)
- end
-
- sumtype = self.should
-
- if hash.include?(sumtype)
- #self.notice "Found checksum %s for %s" %
- # [hash[sumtype] ,@resource[:path]]
- sum = hash[sumtype]
-
- unless sum =~ /^\{\w+\}/
- sum = "{%s}%s" % [sumtype, sum]
- end
- return sum
- elsif hash.empty?
- #self.notice "Could not find sum of type %s" % sumtype
- return :nosum
- else
- #self.notice "Found checksum for %s but not of type %s" %
- # [@resource[:path],sumtype]
- return :nosum
- end
- end
-
# Calculate the sum from disk.
def getsum(checktype, file = nil)
sum = ""
diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ssh_authorized_key.rb
index 66cf3e733..997afb81e 100644
--- a/lib/puppet/type/ssh_authorized_key.rb
+++ b/lib/puppet/type/ssh_authorized_key.rb
@@ -31,6 +31,20 @@ module Puppet
newproperty(:target) do
desc "The file in which to store the SSH key."
+
+ defaultto :absent
+
+ def should
+ if defined? @should and @should[0] != :absent
+ return super
+ end
+
+ if user = resource[:user]
+ return File.expand_path("~%s/.ssh/authorized_keys" % user)
+ end
+
+ return nil
+ end
end
newproperty(:options, :array_matching => :all) do