From 62d7616a457f33eb660454fcdcefe8dab84522c0 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 18 Feb 2008 09:00:11 -0600 Subject: Fixing the directory service provider's behaviour when there's no value for a given attribute. --- lib/puppet/provider/nameservice/directoryservice.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 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: -- cgit