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'],