Merge "Call dib-run-parts from dib"

This commit is contained in:
Jenkins 2017-04-11 22:22:08 +00:00 committed by Gerrit Code Review
commit f23d22c0c8
2 changed files with 14 additions and 2 deletions

View File

@ -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:

View File

@ -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])