3rd iteration of logging cleanup.

This commit is contained in:
Darko Poljak 2017-06-29 09:22:59 +02:00 committed by Steven Armstrong
parent 127c05a882
commit a722f3c634
9 changed files with 15 additions and 14 deletions

View File

@ -464,6 +464,7 @@ class Config(object):
def object_prepare(self, cdist_object):
"""Prepare object: Run type explorer + manifest"""
self.log.info("Preparing object {}".format(cdist_object.name))
self.log.info(
"Running manifest and explorers for " + cdist_object.name)
self.explorer.run_type_explorers(cdist_object)
@ -473,6 +474,7 @@ class Config(object):
def object_run(self, cdist_object):
"""Run gencode and code for an object"""
self.log.info("Running object " + cdist_object.name)
self.log.verbose("Trying to run object %s" % (cdist_object.name))
if cdist_object.state == core.CdistObject.STATE_DONE:
raise cdist.Error(("Attempting to run an already finished "
@ -481,7 +483,7 @@ class Config(object):
cdist_type = cdist_object.cdist_type
# Generate
self.log.info("Generating code for %s" % (cdist_object.name))
self.log.debug("Generating code for %s" % (cdist_object.name))
cdist_object.code_local = self.code.run_gencode_local(cdist_object)
cdist_object.code_remote = self.code.run_gencode_remote(cdist_object)
if cdist_object.code_local or cdist_object.code_remote:
@ -492,8 +494,12 @@ class Config(object):
if cdist_object.code_local or cdist_object.code_remote:
self.log.info("Executing code for %s" % (cdist_object.name))
if cdist_object.code_local:
self.log.trace("Executing local code for %s"
% (cdist_object.name))
self.code.run_code_local(cdist_object)
if cdist_object.code_remote:
self.log.trace("Executing remote code for %s"
% (cdist_object.name))
self.code.transfer_code_remote(cdist_object)
self.code.run_code_remote(cdist_object)
else:

View File

@ -22,7 +22,6 @@
#
import fnmatch
import logging
import os
import collections
@ -30,8 +29,6 @@ import cdist
import cdist.core
from cdist.util import fsproperty
log = logging.getLogger(__name__)
class IllegalObjectIdError(cdist.Error):
def __init__(self, object_id, message=None):

View File

@ -21,7 +21,6 @@
#
import os
import cdist

View File

@ -21,13 +21,10 @@
#
#
import logging
import os
import cdist
log = logging.getLogger(__name__)
'''
common:

View File

@ -168,6 +168,8 @@ class Explorer(object):
in the object.
"""
self.log.info("Running type explorers for {}".format(
cdist_object.cdist_type))
self.log.trace("Transfering type explorers for type: %s",
cdist_object.cdist_type)
self.transfer_type_explorers(cdist_object.cdist_type)

View File

@ -145,12 +145,11 @@ class Manifest(object):
else:
user_supplied = True
self.log.info("Running initial manifest " + initial_manifest)
if not os.path.isfile(initial_manifest):
raise NoInitialManifestError(initial_manifest, user_supplied)
message_prefix = "initialmanifest"
self.log.info("Running initial manifest " + initial_manifest)
self.local.run_script(initial_manifest,
env=self.env_initial_manifest(initial_manifest),
message_prefix=message_prefix,
@ -177,6 +176,7 @@ class Manifest(object):
cdist_object.cdist_type.manifest_path)
message_prefix = cdist_object.name
if os.path.isfile(type_manifest):
self.log.info("Running type manifest " + type_manifest)
self.local.run_script(type_manifest,
env=self.env_type_manifest(cdist_object),
message_prefix=message_prefix,

View File

@ -256,10 +256,10 @@ class Emulator(object):
# (this would leed to an circular dependency)
if ("CDIST_ORDER_DEPENDENCY" in self.env and
'CDIST_OVERRIDE' not in self.env):
# load object name created bevor this one from typeorder file ...
# load object name created befor this one from typeorder file ...
with open(self.typeorder_path, 'r') as typecreationfile:
typecreationorder = typecreationfile.readlines()
# get the type created bevore this one ...
# get the type created before this one ...
try:
lastcreatedtype = typecreationorder[-2].strip()
if 'require' in self.env:

View File

@ -192,7 +192,6 @@ class Local(object):
Return the output as a string.
"""
self.log.trace("Local run: %s", command)
assert isinstance(command, (list, tuple)), (
"list or tuple argument expected, got: %s" % command)
@ -211,6 +210,7 @@ class Local(object):
message = cdist.message.Message(message_prefix, self.messages_path)
env.update(message.env)
self.log.trace("Local run: %s", command)
try:
if save_output:
output, errout = exec_util.call_get_output(command, env=env)

View File

@ -45,7 +45,7 @@ def commandline():
log.warning(retval)
log.trace(args)
log.verbose("version %s" % cdist.VERSION)
log.info("version %s" % cdist.VERSION)
# Work around python 3.3 bug:
# http://bugs.python.org/issue16308