From ef5eb34274c6770810abeb5f0c7b5b13b2cb3a67 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:57:32 +0200 Subject: [PATCH 1/7] update test for upcomming change: /__debug/__cdist_debug/ Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 2 +- lib/cdist/test/explorer/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index c9761a4b..514acb4a 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -120,4 +120,4 @@ class CodeTestCase(unittest.TestCase): 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) + self.assertTrue("__cdist_debug" in code.env) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index fe23b7e2..341371cd 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -130,4 +130,4 @@ class ExplorerClassTestCase(unittest.TestCase): 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) + self.assertTrue("__cdist_debug" in explorer.env) From 1fb96c0fc20448c9c13f90839c6cc8c1d600908f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:58:25 +0200 Subject: [PATCH 2/7] update test for upcomming change: /__debug/__cdist_debug/ Signed-off-by: Steven Armstrong --- lib/cdist/test/manifest/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 14d6be8a..bf573a9c 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -111,4 +111,4 @@ class ManifestTestCase(unittest.TestCase): 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) From eb5b80d132fd7a9acb30b546e7491392b7352ee1 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:02:17 +0200 Subject: [PATCH 3/7] remove legacy tests Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 5 ----- lib/cdist/test/explorer/__init__.py | 5 ----- 2 files changed, 10 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index 514acb4a..c177f49c 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -116,8 +116,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("__cdist_debug" in code.env) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 341371cd..42b83ee8 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -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("__cdist_debug" in explorer.env) From dc3ed07153543a58c24a9bf31f93b3c4ec781e89 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:03:47 +0200 Subject: [PATCH 4/7] /__debug/__cdist_debug/ Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index f7b08c20..38d2ee98 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -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): From 8f306a748484b5151098cb233260a22fd0c42045 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:04:14 +0200 Subject: [PATCH 5/7] /__debug/__cdist_debug/ Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 7e7e12b4..4880c6e6 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -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) From b56925d24a7cfd197df358d9226f830f78900dd2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:15:05 +0200 Subject: [PATCH 6/7] /__object_fq/__object_name/ Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 6 ++++-- .../fixtures/conf/type/__dump_environment/gencode-local | 3 ++- lib/cdist/test/manifest/__init__.py | 4 ++-- .../manifest/fixtures/conf/type/__dump_environment/manifest | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index c177f49c..68e8a41d 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -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) diff --git a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local b/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local index ac292546..ed1265c9 100755 --- a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local +++ b/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local @@ -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" diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index bf573a9c..257311d7 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -104,9 +104,9 @@ 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) diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest b/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest index 212de64d..e135de35 100755 --- a/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest +++ b/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest @@ -9,5 +9,5 @@ __type: $__type __self: $__self __object: $__object __object_id: $__object_id -__object_fq: $__object_fq +__object_name: $__object_name DONE From d6cf85e6f6407c7b9b5fec96c55a7799da4c0db7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:17:45 +0200 Subject: [PATCH 7/7] implement /__object_fq/__object_name/ Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 3 ++- lib/cdist/core/manifest.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index 2505925c..51912559 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -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) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 38d2ee98..704a3978 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -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, })