From a722f3c63486d1f3ed4f93727f935a3b8dab3731 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Thu, 29 Jun 2017 09:22:59 +0200 Subject: [PATCH] 3rd iteration of logging cleanup. --- cdist/config.py | 8 +++++++- cdist/core/cdist_object.py | 3 --- cdist/core/cdist_type.py | 1 - cdist/core/code.py | 3 --- cdist/core/explorer.py | 2 ++ cdist/core/manifest.py | 4 ++-- cdist/emulator.py | 4 ++-- cdist/exec/local.py | 2 +- scripts/cdist | 2 +- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cdist/config.py b/cdist/config.py index f6b0cc20..4109fa85 100644 --- a/cdist/config.py +++ b/cdist/config.py @@ -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: diff --git a/cdist/core/cdist_object.py b/cdist/core/cdist_object.py index 262db8bf..410dfafc 100644 --- a/cdist/core/cdist_object.py +++ b/cdist/core/cdist_object.py @@ -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): diff --git a/cdist/core/cdist_type.py b/cdist/core/cdist_type.py index 14865386..339d5995 100644 --- a/cdist/core/cdist_type.py +++ b/cdist/core/cdist_type.py @@ -21,7 +21,6 @@ # import os - import cdist diff --git a/cdist/core/code.py b/cdist/core/code.py index e9e2edf0..6917e7ba 100644 --- a/cdist/core/code.py +++ b/cdist/core/code.py @@ -21,13 +21,10 @@ # # -import logging import os import cdist -log = logging.getLogger(__name__) - ''' common: diff --git a/cdist/core/explorer.py b/cdist/core/explorer.py index f2f1f15b..b5c00897 100644 --- a/cdist/core/explorer.py +++ b/cdist/core/explorer.py @@ -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) diff --git a/cdist/core/manifest.py b/cdist/core/manifest.py index 29f96c4f..16c08353 100644 --- a/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -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, diff --git a/cdist/emulator.py b/cdist/emulator.py index 78d75b26..7c9dfcca 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -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: diff --git a/cdist/exec/local.py b/cdist/exec/local.py index be3cde4c..2ff31466 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -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) diff --git a/scripts/cdist b/scripts/cdist index 492bbec6..605c5a6c 100755 --- a/scripts/cdist +++ b/scripts/cdist @@ -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