Merge remote-tracking branch 'telmich/master'

This commit is contained in:
Steven Armstrong 2011-10-14 23:23:53 +02:00
commit 66324db4b3
2 changed files with 13 additions and 6 deletions

View file

@ -74,6 +74,9 @@ class Manifest(object):
'__global': self.local.out_path,
'__cdist_type_base_path': self.local.type_path, # for use in type emulator
}
if log.getEffectiveLevel() == logging.DEBUG:
self.env.update({'__debug': "yes" })
def run_initial_manifest(self, script):
env = os.environ.copy()

View file

@ -26,9 +26,7 @@ import getpass
import shutil
import string
import random
#import logging
#logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s')
import logging
import cdist
from cdist.exec import local
@ -51,12 +49,13 @@ class ManifestTestCase(unittest.TestCase):
def setUp(self):
self.temp_dir = self.mkdtemp()
target_host = 'localhost'
self.target_host = 'localhost'
out_path = self.temp_dir
self.local = local.Local(target_host, local_base_path, out_path)
self.local = local.Local(self.target_host, local_base_path, out_path)
self.local.create_directories()
self.local.link_emulator(cdist.test.cdist_exec_path)
self.manifest = manifest.Manifest(target_host, self.local)
self.manifest = manifest.Manifest(self.target_host, self.local)
self.log = logging.getLogger("cdist")
def tearDown(self):
shutil.rmtree(self.temp_dir)
@ -69,3 +68,8 @@ class ManifestTestCase(unittest.TestCase):
cdist_type = core.Type(self.local.type_path, '__dump_environment')
cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever')
self.manifest.run_type_manifest(cdist_object)
def test_debug_env_setup(self):
self.log.setLevel(logging.DEBUG)
manifest = cdist.core.manifest.Manifest(self.target_host, self.local)
self.assertTrue("__debug" in manifest.env)