Re: [MWA] Java Version in Inventory Items

85 views
Skip to first unread message

Ken Elliott

unread,
Mar 26, 2013, 11:44:07 PM3/26/13
to munki-w...@googlegroups.com, munk...@googlegroups.com
Hi,

First, a question for the list: do people want this to become a standard part of MunkiWebAdmin?
Rather than MunkiWebAdmin, I'd prefer it to be a part of Munki.
I haven't started to use MunkiWebAdmin yet, and continue to use MunkiReports.
If the Application Inventory was updated at source it would be available to all, without having to repeat code.

I've succeeded in creating an InternetPlugin.plist in bash, but have been unable to merge with the ApplicationInventroy.plist 
(My code skill is limited to bash scripts, not python, sorry.)

Thanks to all,
Ken

On 27/03/2013, at 9:13 AM, Joe Wollard <joe.w...@gmail.com> wrote:

Good stuff, Josh!

First, a question for the list: do people want this to become a standard part of MunkiWebAdmin?

Next, I think there were a few leftovers in your copy/paste from testing that caused some errors in my test environment. Here's the same script with the modifications that made it functional for me:

from munkilib import FoundationPlist
import os

invPath = r"/Library/Managed Installs/ApplicationInventory.plist"
plugins = r"/Library/Internet Plug-Ins/"
directoryListing = os.listdir(plugins)
appinv = FoundationPlist.readPlist(invPath)

print "Adding %i plugins" % len(directoryListing)

for x in directoryListing:
    try:
        path = os.path.join(plugins, x, 'Contents/Info.plist')
        info = FoundationPlist.readPlist(path)
        plugin = {}
        plugin['CFBundlenName'] = info.get('CFBundleName','N/A')
        plugin['version'] = info.get('CFBundleVersion','N/A')
        plugin['path'] = path
        plugin['name'] = info.get('CFBundleName', os.path.splitext(os.path.basename(x))[0])
        appinv.append(plugin.copy())
    except Exception, message:
        pass

FoundationPlist.writePlist(appinv, invPath)


On Tue, Mar 26, 2013 at 9:18 AM, Josh Potter <pott...@gmail.com> wrote:
Updated to loop over the /Library/Internet Plug-ins/ directory and grab what it can. There are some files/bundles that FoundationPlist.readPlist can't handle, hence the try/exception.

#!/usr/bin/python

import FoundationPlist
import os

#The plist of App Inventory that we start by reaading and then adding the Java info to.

invPath
= r"/Library/Managed Installs/ApplicationInventory.plist"

#Path where the browser plug-ins are located
plugins
= r"/Library/Internet Plug-Ins/"

#Create a list of the plugins
directoryListing
= os.listdir(plugins)


#Read in the App Inventory plist
appinv
= FoundationPlist.readPlist(invPath)

#Iterate through each plugin and grab the info
for x in directoryListing:

   
#Some plugins will not have the necessary files for the FoundationPlist.readPlist call. We skip over
   
#those plugins with the try/exception.
   
try:

        path
= os.path.join(plugins,x,'Contents/Info.plist')

       
#Get the info from the plugin
        info
= FoundationPlist.readPlist(path)


       
#Grab what we want and create a new dict

        plugin
= {}
        plugin
['CFBundlenName'] = info.get('CFBundleName','N/A')
        plugin
['version'] = info.get('CFBundleVersion','N/A')
        plugin
['path'] = path
        plugin
['name'] = os.path.splitext(os.path.basename(pathname))[0]

       
#Add the new dict to the App Inventory dict
        appinv
.append(plugin.copy())

   
except Exception:
       
pass

#Overwrite the new ApplicationInventory.plist
FoundationPlist.writePlist(appinv, test_invPath)



--
You received this message because you are subscribed to the Google Groups "MunkiWebAdmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-web-adm...@googlegroups.com.
Visit this group at http://groups.google.com/group/munki-web-admin?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Joe Wollard

--
You received this message because you are subscribed to the Google Groups "MunkiWebAdmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-web-adm...@googlegroups.com.
Visit this group at http://groups.google.com/group/munki-web-admin?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Joe Wollard

unread,
Mar 27, 2013, 8:53:23 AM3/27/13
to munk...@googlegroups.com
I hadn't thought of that, but you're absolutely correct. Other applications would certainly benefit from this change being made in Munki rather than MunkiWebAdmin, so it does seem to be the more appropriate place for it. Anyone willing to code it up and send a pull request?


P.S. To make life a little easier on Greg, pull requests should be recorded in an issue and be in the form of a copy/paste-able git command. e.g.: git pull <protocol>://<some-publicly-accessible-repo> [branch-name]


--
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Joe Wollard

Erik

unread,
Mar 27, 2013, 2:26:58 PM3/27/13
to munk...@googlegroups.com
I agree that maybe it should be part of the inventory list, but I don't see where it would help with regards to "other applications".

If I install to the Internet plugins folder, I use an install key so Munki knows where to look if an update is out.

Joe Wollard

unread,
Mar 27, 2013, 3:06:44 PM3/27/13
to munk...@googlegroups.com
When I said "other applications", I meant administration tools other than MunkiWebAdmin such as MunkiReport, MunkiAdmin, Simian, MunkiServer, etc.

Sorry for the confusion.


On Wed, Mar 27, 2013 at 2:26 PM, Erik <eriknico...@gmail.com> wrote:
I agree that maybe it should be part of the inventory list, but I don't see where it would help with regards to "other applications".

If I install to the Internet plugins folder, I use an install key so Munki knows where to look if an update is out.
--
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Joe Wollard
Reply all
Reply to author
Forward
0 new messages