Remove deprecated code that lead to circular imports

This commit is contained in:
Greg Neagle
2017-01-02 16:17:13 -08:00
parent 41153d3a86
commit e9a2927e27
2 changed files with 40 additions and 40 deletions

46
code/client/munkilib/appleupdates.py Normal file → Executable file
View File

@@ -1690,26 +1690,26 @@ class AppleUpdates(object):
return 0
return count
def SoftwareUpdateList(self):
"""Returns a list of str update names using softwareupdate -l."""
if self._update_list_cache is not None:
return self._update_list_cache
updates = []
munkicommon.display_detail(
'Getting list of available Apple Software Updates')
cmd = ['/usr/sbin/softwareupdate', '-l']
proc = subprocess.Popen(cmd, shell=False, bufsize=-1,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, dummy_err = proc.communicate()
if proc.returncode == 0:
updates = [str(item)[5:] for item in str(output).splitlines()
if str(item).startswith(' * ')]
munkicommon.display_detail(
'softwareupdate returned %d updates.', len(updates))
self._update_list_cache = updates
return updates
# def SoftwareUpdateList(self):
# """Returns a list of str update names using softwareupdate -l."""
# if self._update_list_cache is not None:
# return self._update_list_cache
#
# updates = []
# munkicommon.display_detail(
# 'Getting list of available Apple Software Updates')
# cmd = ['/usr/sbin/softwareupdate', '-l']
# proc = subprocess.Popen(cmd, shell=False, bufsize=-1,
# stdin=subprocess.PIPE,
# stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# output, dummy_err = proc.communicate()
# if proc.returncode == 0:
# updates = [str(item)[5:] for item in str(output).splitlines()
# if str(item).startswith(' * ')]
# munkicommon.display_detail(
# 'softwareupdate returned %d updates.', len(updates))
# self._update_list_cache = updates
# return updates
def copyUpdateMetadata(self, item, metadata):
"""Applies metadata to Apple update item restricted
@@ -1822,9 +1822,9 @@ def getAppleUpdatesInstance():
return apple_updates_object
def softwareUpdateList():
"""Method for drop-in appleupdates replacement; see primary method docs."""
return getAppleUpdatesInstance().SoftwareUpdateList()
#def softwareUpdateList():
# """Method for drop-in appleupdates replacement; see primary method docs."""
# return getAppleUpdatesInstance().SoftwareUpdateList()
def clearAppleUpdateInfo():

34
code/client/munkilib/installationstate.py Normal file → Executable file
View File

@@ -24,7 +24,6 @@ Utilities for determining installation status for Munki items.
import os
from . import appleupdates
from . import catalogs
from . import compare
from . import display
@@ -61,22 +60,23 @@ def installed_state(item_pl):
# return 1 so we're marked as not needing to be installed
return 1
if item_pl.get('softwareupdatename'):
available_apple_updates = appleupdates.softwareUpdateList()
display.display_debug2(
'Available Apple updates:\n%s', available_apple_updates)
if item_pl['softwareupdatename'] in available_apple_updates:
display.display_debug1(
'%s is in available Apple Software Updates',
item_pl['softwareupdatename'])
# return 0 so we're marked as needing to be installed
return 0
else:
display.display_debug1(
'%s is not in available Apple Software Updates',
item_pl['softwareupdatename'])
# return 1 so we're marked as not needing to be installed
return 1
# this was deprecated a very long time ago. removing 02 Jan 2017
#if item_pl.get('softwareupdatename'):
# available_apple_updates = appleupdates.softwareUpdateList()
# display.display_debug2(
# 'Available Apple updates:\n%s', available_apple_updates)
# if item_pl['softwareupdatename'] in available_apple_updates:
# display.display_debug1(
# '%s is in available Apple Software Updates',
# item_pl['softwareupdatename'])
# # return 0 so we're marked as needing to be installed
# return 0
# else:
# display.display_debug1(
# '%s is not in available Apple Software Updates',
# item_pl['softwareupdatename'])
# # return 1 so we're marked as not needing to be installed
# return 1
if item_pl.get('installer_type') == 'profile':
identifier = item_pl.get('PayloadIdentifier')