From 753eb03723cff2ad15c1c2d404ecf82b76d13dd6 Mon Sep 17 00:00:00 2001 From: Samuel Keeley Date: Tue, 22 Nov 2016 14:10:08 -0600 Subject: [PATCH] handle case where no profiles installed --- lib/facter/profiles.rb | 6 ++---- lib/puppet/provider/profile_manager/macos.rb | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/facter/profiles.rb b/lib/facter/profiles.rb index a7b7448..284d452 100644 --- a/lib/facter/profiles.rb +++ b/lib/facter/profiles.rb @@ -16,10 +16,8 @@ plist = Puppet::Util::Plist.read_plist_file(path) - data = plist['_computerlevel'] - - unless data.empty? - for item in data + if plist.key?('_computerlevel') + for item in plist['_computerlevel'] profiles[item['ProfileIdentifier']] = { 'display_name' => item['ProfileDisplayName'], 'description' => item['ProfileDescription'], diff --git a/lib/puppet/provider/profile_manager/macos.rb b/lib/puppet/provider/profile_manager/macos.rb index 0366db4..22de902 100644 --- a/lib/puppet/provider/profile_manager/macos.rb +++ b/lib/puppet/provider/profile_manager/macos.rb @@ -68,10 +68,8 @@ def getinstalledstate plist = Puppet::Util::Plist.read_plist_file(path) - data = plist['_computerlevel'] - - unless data.empty? - for item in data + if plist.key?('_computerlevel') + for item in plist['_computerlevel'] if item['ProfileIdentifier'] == resource[:name] return { 'identifier' => item['ProfileIdentifier'],