Call dib-run-parts from dib
After I149c345d38d761a49b3a6ccc4833482f09f1cd05 dib v2 does not export dib-run-parts. Since we have a "special" relationship with dib internals, call the internal version. This is fragile, but practically dib is unlikely to break this. Depends-On: I149c345d38d761a49b3a6ccc4833482f09f1cd05 Change-Id: Ibfe972208df40fa092b11b5419043524c903f1b4
This commit is contained in:
parent
db7123ec10
commit
5a168821f5
|
@ -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()
|
||||
|
||||
|
@ -179,7 +191,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:
|
||||
|
|
|
@ -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])
|
||||
|
||||
|
|
Loading…
Reference in New Issue