Skip to content
Permalink
Browse files

Provide switch for MunkiStatus output so precache_agent can switch it…

… off. Addresses #897
  • Loading branch information...
gregneagle committed Jan 8, 2019
1 parent 8f55dbb commit c97d96162455f9474a2ae0a0b1a8833dc4a58e43
Showing with 16 additions and 8 deletions.
  1. +1 −1 code/client/managedsoftwareupdate
  2. +10 −6 code/client/munkilib/display.py
  3. +4 −0 code/client/precache_agent
  4. +1 −1 code/client/removepackages
@@ -778,7 +778,7 @@ def main():
exit(constants.EXIT_STATUS_INVALID_PARAMETERS)

# set munkicommon globals
display.munkistatusoutput = options.munkistatusoutput
display.munkistatusoutput = True
display.verbose = options.verbose

# Set environment variable for verbosity
@@ -30,6 +30,7 @@
from . import munkistatus



def _getsteps(num_of_steps, limit):
"""
Helper function for display_percent_done
@@ -55,7 +56,8 @@ def display_percent_done(current, maximum):
percentdone = 100
else:
percentdone = int(float(current)/float(maximum)*100)
munkistatus.percent(str(percentdone))
if munkistatusoutput:
munkistatus.percent(str(percentdone))

if verbose:
step = _getsteps(16, maximum)
@@ -116,9 +118,10 @@ def display_status_major(msg, *args):
"""
msg = _concat_message(msg, *args)
munkilog.log(msg)
munkistatus.message(msg)
munkistatus.detail('')
munkistatus.percent(-1)
if munkistatusoutput:
munkistatus.message(msg)
munkistatus.detail('')
munkistatus.percent(-1)
if verbose:
if msg.endswith('.') or msg.endswith(u''):
print '%s' % msg.encode('UTF-8')
@@ -134,7 +137,8 @@ def display_status_minor(msg, *args):
"""
msg = _concat_message(msg, *args)
munkilog.log(u' ' + msg)
munkistatus.detail(msg)
if munkistatusoutput:
munkistatus.detail(msg)
if verbose:
if msg.endswith('.') or msg.endswith(u''):
print ' %s' % msg.encode('UTF-8')
@@ -230,7 +234,7 @@ def display_error(msg, *args):
# module globals
# pylint: disable=invalid-name
verbose = 1
munkistatusoutput = False
munkistatusoutput = True
# pylint: enable=invalid-name


@@ -23,9 +23,13 @@ A privileged agent that downloads optional installs items marked for precaching.
"""
import time

from munkilib import display
from munkilib.updatecheck import download


if __name__ == '__main__':
# turn off Munki status output; this should be silent
display.munkistatusoutput = False
download.cache()
# sleep 10 seconds to prevent launchd from complaining
time.sleep(10)
@@ -70,7 +70,7 @@ def main():
exit(-1)

# set the display globals
display.munkistatusoutput = options.munkistatusoutput
display.munkistatusoutput = True
display.verbose = options.verbose

if options.munkistatusoutput:

0 comments on commit c97d961

Please sign in to comment.
You can’t perform that action at this time.