summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-09-17 10:48:40 -0700
committerTim Smith <tsmith84@gmail.com>2020-09-17 10:59:39 -0700
commitb159e98c8b04c1140970eddebd5de304f1843e9a (patch)
tree7d3ababf5279b6c9dce212d7093f7f364b28134c
parent41761f867004193b93e75f4cd171305b45175349 (diff)
downloadchef-b159e98c8b04c1140970eddebd5de304f1843e9a.tar.gz
Fix querying of installed profile data and avoid writing data to disk
We can write it to stdout by specifying the output as "stdout-xml". The profiles command would fail if the temp file has already been used and this was resulting in null values. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/osx_profile.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb
index 8939ad506c..5de3d3cdc8 100644
--- a/lib/chef/resource/osx_profile.rb
+++ b/lib/chef/resource/osx_profile.rb
@@ -317,10 +317,9 @@ class Chef
end
def query_installed_profiles
- Tempfile.open("allprofiles.plist") do |tempfile|
- shell_out( "/usr/bin/profiles", "-P", "-o", tempfile.path )
- ::Plist.parse_xml(tempfile)
- end
+ logger.trace("Running /usr/bin/profiles -P -o stdout-xml to determine profile state")
+ so = shell_out( "/usr/bin/profiles", "-P", "-o", "stdout-xml" )
+ ::Plist.parse_xml(so.stdout)
end
def profile_installed?