Add -l/--log-level option. Honor __cdist_loglevel env var. (#572)
Add -l/--log-level option, __cdist_loglevel -> __cdist_log_level; honor __cdist_log_level env var
This commit is contained in:
parent
f08ac264a0
commit
3454da076f
23 changed files with 152 additions and 69 deletions
|
|
@ -28,3 +28,4 @@ from cdist.core.explorer import Explorer
|
|||
from cdist.core.manifest import Manifest
|
||||
from cdist.core.code import Code
|
||||
from cdist.core.util import listdir
|
||||
from cdist.core.util import log_level_env_var_val
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#
|
||||
|
||||
import os
|
||||
from . import util
|
||||
|
||||
|
||||
'''
|
||||
|
|
@ -107,6 +108,7 @@ class Code(object):
|
|||
'__global': self.local.base_path,
|
||||
'__files': self.local.files_path,
|
||||
'__target_host_tags': self.local.target_host_tags,
|
||||
'__cdist_log_level': util.log_level_env_var_val(local.log),
|
||||
}
|
||||
|
||||
def _run_gencode(self, cdist_object, which):
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import os
|
|||
import glob
|
||||
import multiprocessing
|
||||
from cdist.mputil import mp_pool_run
|
||||
from . import util
|
||||
|
||||
'''
|
||||
common:
|
||||
|
|
@ -78,6 +79,7 @@ class Explorer(object):
|
|||
'__target_fqdn': self.target_host[2],
|
||||
'__explorer': self.remote.global_explorer_path,
|
||||
'__target_host_tags': self.local.target_host_tags,
|
||||
'__cdist_log_level': util.log_level_env_var_val(self.log),
|
||||
}
|
||||
self._type_explorers_transferred = []
|
||||
self.jobs = jobs
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import logging
|
|||
import os
|
||||
|
||||
import cdist
|
||||
from . import util
|
||||
|
||||
'''
|
||||
common:
|
||||
|
|
@ -111,12 +112,9 @@ class Manifest(object):
|
|||
'__target_fqdn': self.target_host[2],
|
||||
'__files': self.local.files_path,
|
||||
'__target_host_tags': self.local.target_host_tags,
|
||||
'__cdist_log_level': util.log_level_env_var_val(self.log),
|
||||
}
|
||||
|
||||
self.env.update(
|
||||
{'__cdist_loglevel': logging.getLevelName(
|
||||
self.log.getEffectiveLevel())})
|
||||
|
||||
def _open_logger(self):
|
||||
self.log = logging.getLogger(self.target_host[0])
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#
|
||||
|
||||
import os
|
||||
import logging
|
||||
|
||||
|
||||
def listdir(path='.', include_dot=False):
|
||||
|
|
@ -34,3 +35,7 @@ def listdir(path='.', include_dot=False):
|
|||
|
||||
def _ishidden(path):
|
||||
return path[0] in ('.', b'.'[0])
|
||||
|
||||
|
||||
def log_level_env_var_val(log):
|
||||
return logging.getLevelName(log.getEffectiveLevel())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue