summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2008-02-19 08:42:00 +1100
committerJames Turnbull <james@lovedthanlost.net>2008-02-19 08:42:00 +1100
commit8754f41117540b9bb79f4561c99cd608c0115117 (patch)
treedeeec4c166eba9d592c6176f0983adb29efb0964
parentf087df0644c2532cbdf2d0e9ee20fae0a19dc6e6 (diff)
parentd11cd39024e1baa5988e587e34fad65bb116ea01 (diff)
downloadpuppet-8754f41117540b9bb79f4561c99cd608c0115117.tar.gz
puppet-8754f41117540b9bb79f4561c99cd608c0115117.tar.xz
puppet-8754f41117540b9bb79f4561c99cd608c0115117.zip
Merge branch '0.24.x' of git://reductivelabs.com/puppet into 0.24.x
-rw-r--r--lib/puppet/provider/nameservice/directoryservice.rb6
-rwxr-xr-xspec/unit/file_serving/metadata.rb3
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb
index 973a62f6e..e2e68b2ca 100644
--- a/lib/puppet/provider/nameservice/directoryservice.rb
+++ b/lib/puppet/provider/nameservice/directoryservice.rb
@@ -139,10 +139,12 @@ class DirectoryService < Puppet::Provider::NameService
dscl_output.split("\n").each do |line|
# JJM: Split the attribute name and the list of values.
ds_attribute, ds_values_string = line.split(':')
+
+ # Split sets the values to nil if there's nothing after the :
+ ds_values_string ||= ""
# JJM: skip this attribute line if the Puppet::Type doesn't care about it.
- next unless (@@ds_to_ns_attribute_map.keys.include?(ds_attribute) \
- and type_properties.include? @@ds_to_ns_attribute_map[ds_attribute])
+ next unless (@@ds_to_ns_attribute_map.keys.include?(ds_attribute) and type_properties.include? @@ds_to_ns_attribute_map[ds_attribute])
# JJM: We asked dscl to output url encoded values so we're able
# to machine parse on whitespace. We need to urldecode:
diff --git a/spec/unit/file_serving/metadata.rb b/spec/unit/file_serving/metadata.rb
index f7ab0c8d6..d31dd21f0 100755
--- a/spec/unit/file_serving/metadata.rb
+++ b/spec/unit/file_serving/metadata.rb
@@ -58,10 +58,11 @@ describe Puppet::FileServing::Metadata, " when collecting attributes" do
@stat = stub 'stat', :uid => 10, :gid => 20, :mode => 0755, :ftype => "file"
File.stubs(:lstat).returns(@stat)
@filehandle = mock 'filehandle'
- @filehandle.expects(:each_line).yields("some content\n")
+ #@filehandle.expects(:read).with(512).returns("some content\n").then.returns(nil)
File.stubs(:open).with(@path, 'r').yields(@filehandle)
@checksum = Digest::MD5.hexdigest("some content\n")
@metadata = Puppet::FileServing::Metadata.new("file", :path => "/my/file")
+ @metadata.expects(:md5_file).returns(@checksum)
@metadata.collect_attributes
end