diff --git a/salt/modules/cp.py b/salt/modules/cp.py index ecae236e2c..60805738b0 100644 --- a/salt/modules/cp.py +++ b/salt/modules/cp.py @@ -86,12 +86,12 @@ def get_file(path, dest, env='base', template=None): try: path = _render(path) except CommandExecutionError as exc: - log.error(exc.message) + log.error(str(exc)) return '' try: dest = _render(dest) except CommandExecutionError as exc: - log.error(exc.message) + log.error(str(exc)) return '' if not hash_file(path, env): diff --git a/tests/integration/files/file/base/cheese b/tests/integration/files/file/base/cheese new file mode 100644 index 0000000000..978909a228 --- /dev/null +++ b/tests/integration/files/file/base/cheese @@ -0,0 +1 @@ +I could just fancy some cheese, Gromit. What do you say? Cheddar? diff --git a/tests/integration/modules/cp.py b/tests/integration/modules/cp.py index bdc0ba8d8b..2f0b974a82 100644 --- a/tests/integration/modules/cp.py +++ b/tests/integration/modules/cp.py @@ -24,7 +24,7 @@ class CPModuleTest(integration.ModuleCase): self.assertIn('KNIGHT: They\'re nervous, sire.', data) self.assertNotIn('bacon', data) - def text_get_file_templated_paths(self): + def test_get_file_templated_paths(self): ''' cp.get_file ''' @@ -32,9 +32,11 @@ class CPModuleTest(integration.ModuleCase): self.run_function( 'cp.get_file', [ - 'salt://{{grain.test_grain}}', - tgt.replace('cheese', '{{grain.test_grain}}'), - ]) + 'salt://{{grains.test_grain}}', + tgt.replace('cheese', '{{grains.test_grain}}') + ], + template='jinja' + ) with open(tgt, 'r') as cheese: data = cheese.read() self.assertIn('Gromit', data)