Merge remote-tracking branch 'steven/master'

This commit is contained in:
Nico Schottelius 2011-10-19 15:19:24 +02:00
commit eb78fa18c1
8 changed files with 16 additions and 22 deletions

View file

@ -105,7 +105,8 @@ class Code(object):
'__type': cdist_object.type.absolute_path,
'__object': cdist_object.absolute_path,
'__object_id': cdist_object.object_id,
'__object_fq': cdist_object.path,
'__object_name': cdist_object.name,
'__self': cdist_object.name,
})
return self.local.run_script(script, env=env, return_output=True)

View file

@ -75,7 +75,7 @@ class Manifest(object):
'__cdist_type_base_path': self.local.type_path, # for use in type emulator
}
if self.log.getEffectiveLevel() == logging.DEBUG:
self.env.update({'__debug': "yes" })
self.env.update({'__cdist_debug': "yes" })
def run_initial_manifest(self, script):
@ -92,10 +92,10 @@ class Manifest(object):
env = os.environ.copy()
env.update(self.env)
env.update({
'__self': cdist_object.name,
'__object': cdist_object.absolute_path,
'__object_id': cdist_object.object_id,
'__object_fq': cdist_object.name,
'__object_name': cdist_object.name,
'__self': cdist_object.name,
'__type': cdist_object.type.absolute_path,
'__cdist_manifest': script,
})

View file

@ -82,7 +82,7 @@ class Emulator(object):
logformat = '%(levelname)s: %(message)s'
logging.basicConfig(format=logformat)
if '__debug' in os.environ:
if '__cdist_debug' in os.environ:
logging.root.setLevel(logging.DEBUG)
else:
logging.root.setLevel(logging.INFO)

View file

@ -85,7 +85,8 @@ class CodeTestCase(unittest.TestCase):
self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path)
self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path)
self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id)
self.assertEqual(output_dict['__object_fq'], self.cdist_object.path)
self.assertEqual(output_dict['__object_name'], self.cdist_object.name)
self.assertEqual(output_dict['__self'], self.cdist_object.name)
def test_run_gencode_remote_environment(self):
output_string = self.code.run_gencode_remote(self.cdist_object)
@ -100,7 +101,8 @@ class CodeTestCase(unittest.TestCase):
self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path)
self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path)
self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id)
self.assertEqual(output_dict['__object_fq'], self.cdist_object.path)
self.assertEqual(output_dict['__object_name'], self.cdist_object.name)
self.assertEqual(output_dict['__self'], self.cdist_object.name)
def test_transfer_code_remote(self):
self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object)
@ -116,8 +118,3 @@ class CodeTestCase(unittest.TestCase):
self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object)
self.code.transfer_code_remote(self.cdist_object)
self.code.run_code_remote(self.cdist_object)
def test_debug_env_setup(self):
self.log.setLevel(logging.DEBUG)
code = cdist.core.code.Code(self.target_host, self.local, self.remote)
self.assertTrue("__debug" in code.env)

View file

@ -5,4 +5,5 @@ echo "echo __global: $__global"
echo "echo __type: $__type"
echo "echo __object: $__object"
echo "echo __object_id: $__object_id"
echo "echo __object_fq: $__object_fq"
echo "echo __object_name: $__object_name"
echo "echo __self: $__self"

View file

@ -126,8 +126,3 @@ class ExplorerClassTestCase(unittest.TestCase):
self.explorer.transfer_type_explorers(cdist_type)
output = self.explorer.run_type_explorer('world', cdist_object)
self.assertEqual(output, 'hello\n')
def test_debug_env_setup(self):
self.log.setLevel(logging.DEBUG)
explorer = cdist.core.explorer.Explorer(self.target_host, self.local, self.remote)
self.assertTrue("__debug" in explorer.env)

View file

@ -104,11 +104,11 @@ class ManifestTestCase(unittest.TestCase):
self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path)
self.assertEqual(output_dict['__type'], cdist_type.absolute_path)
self.assertEqual(output_dict['__object'], cdist_object.absolute_path)
self.assertEqual(output_dict['__self'], cdist_object.name)
self.assertEqual(output_dict['__object_id'], cdist_object.object_id)
self.assertEqual(output_dict['__object_fq'], cdist_object.path)
self.assertEqual(output_dict['__object_name'], cdist_object.name)
self.assertEqual(output_dict['__self'], cdist_object.name)
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)
self.assertTrue("__cdist_debug" in manifest.env)

View file

@ -9,5 +9,5 @@ __type: $__type
__self: $__self
__object: $__object
__object_id: $__object_id
__object_fq: $__object_fq
__object_name: $__object_name
DONE