stage: add module information about itself
Add a new `info` property that holds the `meta.ModuleInfo` info for the stage. This gives each instance of a stage access to meta (or class) information about it, i.e. its schema, docs but, more importantly, also its name and path to the executable. Thefore the `name` property is coverted into a transient property which access the `name` member of `info`. Change the `formats/v1` load mechanism to carry a new `index` argument which is used to load the `ModuleInfo` for each stage. Adapt all tests to load the info as well when creating stages.
This commit is contained in:
parent
a26b7291d1
commit
7a6c2df910
6 changed files with 41 additions and 20 deletions
|
|
@ -55,9 +55,12 @@ class TestMonitor(unittest.TestCase):
|
|||
@unittest.skipUnless(test.TestBase.can_bind_mount(), "root-only")
|
||||
def test_log_monitor_vfuncs(self):
|
||||
# Checks the basic functioning of the LogMonitor
|
||||
index = osbuild.meta.Index(os.curdir)
|
||||
|
||||
runner = detect_host_runner()
|
||||
pipeline = osbuild.Pipeline(runner=runner)
|
||||
pipeline.add_stage("org.osbuild.noop", {
|
||||
info = index.get_module_info("Stage", "org.osbuild.noop")
|
||||
pipeline.add_stage(info, {
|
||||
"isthisthereallife": False
|
||||
})
|
||||
pipeline.set_assembler("org.osbuild.noop")
|
||||
|
|
@ -87,11 +90,14 @@ class TestMonitor(unittest.TestCase):
|
|||
def test_monitor_integration(self):
|
||||
# Checks the monitoring API is called properly from the pipeline
|
||||
runner = detect_host_runner()
|
||||
index = osbuild.meta.Index(os.curdir)
|
||||
|
||||
pipeline = osbuild.Pipeline(runner=runner)
|
||||
pipeline.add_stage("org.osbuild.noop", {
|
||||
noop_info = index.get_module_info("Stage", "org.osbuild.noop")
|
||||
pipeline.add_stage(noop_info, {
|
||||
"isthisthereallife": False
|
||||
})
|
||||
pipeline.add_stage("org.osbuild.noop", {
|
||||
pipeline.add_stage(noop_info, {
|
||||
"isthisjustfantasy": True
|
||||
})
|
||||
pipeline.set_assembler("org.osbuild.noop")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue