From 2c7e1897eaaa7d2dd8d8d993df8a9a217d1c46c6 Mon Sep 17 00:00:00 2001 From: Nigel Kersten Date: Mon, 16 Mar 2009 07:30:16 -0700 Subject: Fixes incorrect detail variable in OS X version check, re-patches ralsh to work with Facter values and adds error check for missing password hash files. --- CHANGELOG | 2 ++ bin/ralsh | 4 ++++ lib/puppet/provider/nameservice/directoryservice.rb | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4d5b05f40..13bdd3987 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ 0.24.8 + Fixed #2077 - ralsh user broken on OSX + Fixed #2000 - No default specified for checksum Fixed #2026 - Red Hat ignoring stop method diff --git a/bin/ralsh b/bin/ralsh index 5dae8f130..44fc9a568 100755 --- a/bin/ralsh +++ b/bin/ralsh @@ -88,6 +88,7 @@ require 'getoptlong' require 'puppet' +require 'facter' options = [ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ], @@ -99,6 +100,9 @@ options = [ [ "--help", "-h", GetoptLong::NO_ARGUMENT ] ] +# Load facts from Facter +Facter.loadfacts + # Add all of the config parameters as valid options. Puppet.settings.addargs(options) diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb index 42c52f0a7..0e06bb089 100644 --- a/lib/puppet/provider/nameservice/directoryservice.rb +++ b/lib/puppet/provider/nameservice/directoryservice.rb @@ -118,7 +118,7 @@ class DirectoryService < Puppet::Provider::NameService begin product_version = Facter.value(:macosx_productversion) if product_version.nil? - raise Puppet::Error, "Could not determine OS X version: %s" % detail + raise Puppet::Error, "Could not determine OS X version" end product_version_major = product_version.scan(/(\d+)\.(\d+)./).join(".") if %w{10.0 10.1 10.2 10.3}.include?(product_version_major) @@ -320,14 +320,14 @@ class DirectoryService < Puppet::Provider::NameService def self.get_password(guid) password_hash = nil password_hash_file = "#{@@password_hash_dir}/#{guid}" - if File.exists?(password_hash_file) + if File.exists?(password_hash_file) and File.file?(password_hash_file) if not File.readable?(password_hash_file) raise Puppet::Error("Could not read password hash file at #{password_hash_file} for #{@resource[:name]}") end f = File.new(password_hash_file) password_hash = f.read f.close - end + end password_hash end -- cgit