Skip to content

Commit 55b5e8c

Browse files
committed
every day new things
1 parent c56c0f2 commit 55b5e8c

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

lib/facter/profiles.rb

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44

55
require 'puppet/util/plist'
66
require 'time'
7-
require 'tmpdir'
87

98
profiles = {}
109

1110
if Facter.value(:os)['release']['major'].to_i >= 12
1211

13-
path = Dir.mktmpdir + '/profiles.plist'
14-
15-
# why????
16-
Facter::Util::Resolution.exec(['/usr/bin/profiles', '-C', '-o', path].join(' '))
17-
18-
plist = Puppet::Util::Plist.read_plist_file(path)
12+
plist = Puppet::Util::Plist.parse_plist(Facter::Util::Resolution.exec(['/usr/bin/profiles', '-C', '-o', 'stdout-xml'].join(' ')))
1913

2014
if plist.key?('_computerlevel')
2115
for item in plist['_computerlevel']

lib/puppet/provider/profile_manager/macos.rb

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'puppet/util/plist'
2-
require 'tmpdir'
32

43
Puppet::Type.type(:profile_manager).provide :macos do
54
desc 'Provides management of mobileconfig profiles on macOS.'
@@ -61,12 +60,8 @@ def writereceipt
6160
end
6261

6362
def getinstalledstate
64-
# profiles will only write to a nonexistant file, so we make a temp dir for it to write to.
65-
path = Dir.mktmpdir + '/profiles.plist'
6663

67-
Puppet::Util::Execution.execute(['/usr/bin/profiles', '-C', '-o', path])
68-
69-
plist = Puppet::Util::Plist.read_plist_file(path)
64+
plist = Puppet::Util::Plist.parse_plist(Puppet::Util::Execution.execute(['/usr/bin/profiles', '-C', '-o', 'stdout-xml']))
7065

7166
if plist.key?('_computerlevel')
7267
for item in plist['_computerlevel']

0 commit comments

Comments
 (0)