diff --git a/instack/runner.py b/instack/runner.py index 0c8e066..1cc698f 100644 --- a/instack/runner.py +++ b/instack/runner.py @@ -26,6 +26,18 @@ from diskimage_builder import element_dependencies from instack import element +# dib-run-parts has moved in dibv2 to an internal call. We don't +# really want to introduce a dependency on dib-utils here. For v1 +# just call it from path. +# Note this is fragile as dib considers this internal +_DIB_RUN_PARTS = 'dib-run-parts' +try: + import diskimage_builder.paths + _DIB_RUN_PARTS = os.path.join(diskimage_builder.paths.get_path('lib'), + 'dib-run-parts') +except ImportError: + pass + LOG = logging.getLogger() @@ -185,7 +197,7 @@ class ElementRunner(object): LOG.debug(" Blacklisting %s" % blacklisted_script) os.unlink(os.path.join(hook_dir, blacklisted_script)) - command = ['dib-run-parts', hook_dir] + command = [_DIB_RUN_PARTS, hook_dir] if self.dry_run: LOG.info(" Dry Run specified, not running hook") else: diff --git a/instack/tests/test_runner.py b/instack/tests/test_runner.py index d416f21..f388e58 100644 --- a/instack/tests/test_runner.py +++ b/instack/tests/test_runner.py @@ -118,7 +118,7 @@ class TestRunner(testtools.TestCase): self.assertEqual(1, mock_call.call_count) self.assertEqual( - ['dib-run-parts', + [runner._DIB_RUN_PARTS, os.path.join(self.runner.tmp_hook_dir, 'install.d')], mock_call.call_args_list[0][0][0])