(fix) Fix missing parameter for node pkg list
- When compiling a list of packages to be installed on deploying nodes the function call to render all bootactions was missing a parameter introduced in [0] to secure the bootaction. - Add unit testing for this flow Change-Id: I9f59819d6b79290a9f72db2a5a4c3422f2c79739
This commit is contained in:
parent
a3c88be95a
commit
2c9ec2503a
@ -23,8 +23,8 @@ import ulid2
|
|||||||
import falcon
|
import falcon
|
||||||
|
|
||||||
from drydock_provisioner.objects.fields import ActionResult
|
from drydock_provisioner.objects.fields import ActionResult
|
||||||
|
from drydock_provisioner.objects.fields import BootactionAssetType
|
||||||
import drydock_provisioner.objects as objects
|
import drydock_provisioner.objects as objects
|
||||||
|
|
||||||
from .base import StatefulResource
|
from .base import StatefulResource
|
||||||
|
|
||||||
logger = logging.getLogger('drydock')
|
logger = logging.getLogger('drydock')
|
||||||
@ -261,7 +261,9 @@ class BootactionUtils(object):
|
|||||||
tarbytes = io.BytesIO()
|
tarbytes = io.BytesIO()
|
||||||
tarball = tarfile.open(
|
tarball = tarfile.open(
|
||||||
mode='w:gz', fileobj=tarbytes, format=tarfile.GNU_FORMAT)
|
mode='w:gz', fileobj=tarbytes, format=tarfile.GNU_FORMAT)
|
||||||
asset_list = asset_list or []
|
asset_list = [
|
||||||
|
a for a in asset_list if a.type != BootactionAssetType.PackageList
|
||||||
|
]
|
||||||
for a in asset_list:
|
for a in asset_list:
|
||||||
fileobj = io.BytesIO(a.rendered_bytes)
|
fileobj = io.BytesIO(a.rendered_bytes)
|
||||||
tarasset = tarfile.TarInfo(name=a.path)
|
tarasset = tarfile.TarInfo(name=a.path)
|
||||||
|
@ -627,10 +627,14 @@ class Orchestrator(object):
|
|||||||
|
|
||||||
for ba in site_design.bootactions:
|
for ba in site_design.bootactions:
|
||||||
if nodename in ba.target_nodes:
|
if nodename in ba.target_nodes:
|
||||||
|
# NOTE(sh8121att) the ulid generation below
|
||||||
|
# is throw away data as these assets are only used to
|
||||||
|
# get a full list of packages to deploy
|
||||||
assets = ba.render_assets(
|
assets = ba.render_assets(
|
||||||
nodename,
|
nodename,
|
||||||
site_design,
|
site_design,
|
||||||
ulid2.generate_binary_ulid(),
|
ulid2.generate_binary_ulid(),
|
||||||
|
ulid2.generate_binary_ulid(),
|
||||||
task.design_ref,
|
task.design_ref,
|
||||||
type_filter=hd_fields.BootactionAssetType.PackageList)
|
type_filter=hd_fields.BootactionAssetType.PackageList)
|
||||||
for a in assets:
|
for a in assets:
|
||||||
|
@ -17,6 +17,8 @@ import ulid2
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from drydock_provisioner.statemgmt.state import DrydockState
|
from drydock_provisioner.statemgmt.state import DrydockState
|
||||||
|
from drydock_provisioner.objects import Task
|
||||||
|
from drydock_provisioner.objects import fields as hd_fields
|
||||||
|
|
||||||
|
|
||||||
class TestBootactionRenderAction(object):
|
class TestBootactionRenderAction(object):
|
||||||
@ -78,7 +80,8 @@ class TestBootactionRenderAction(object):
|
|||||||
action_key, design_ref)
|
action_key, design_ref)
|
||||||
|
|
||||||
assert action_key.hex() in assets[2].rendered_bytes.decode('utf-8')
|
assert action_key.hex() in assets[2].rendered_bytes.decode('utf-8')
|
||||||
assert ulid2.ulid_to_base32(action_id) in assets[2].rendered_bytes.decode('utf-8')
|
assert ulid2.ulid_to_base32(
|
||||||
|
action_id) in assets[2].rendered_bytes.decode('utf-8')
|
||||||
|
|
||||||
def test_bootaction_network_context(self, input_files,
|
def test_bootaction_network_context(self, input_files,
|
||||||
deckhand_orchestrator, setup):
|
deckhand_orchestrator, setup):
|
||||||
@ -131,3 +134,18 @@ class TestBootactionRenderAction(object):
|
|||||||
node_ctx = ba.asset_list[0]._get_node_context('compute01', design_data)
|
node_ctx = ba.asset_list[0]._get_node_context('compute01', design_data)
|
||||||
|
|
||||||
assert node_ctx['domain'] == node_domain
|
assert node_ctx['domain'] == node_domain
|
||||||
|
|
||||||
|
def test_bootaction_pkg_list(self, input_files, deckhand_orchestrator,
|
||||||
|
setup):
|
||||||
|
"""Test that a list of packages to be installed on a ndoe can be compiled from boot actions."""
|
||||||
|
input_file = input_files.join("deckhand_fullsite.yaml")
|
||||||
|
|
||||||
|
design_ref = "file://%s" % str(input_file)
|
||||||
|
|
||||||
|
test_task = Task(
|
||||||
|
action=hd_fields.OrchestratorAction.Noop, design_ref=design_ref)
|
||||||
|
|
||||||
|
pkg_list = deckhand_orchestrator.find_node_package_lists(
|
||||||
|
'compute01', test_task)
|
||||||
|
|
||||||
|
assert len(pkg_list) == 2
|
||||||
|
@ -548,6 +548,10 @@ data:
|
|||||||
data_pipeline:
|
data_pipeline:
|
||||||
- utf8_decode
|
- utf8_decode
|
||||||
- template
|
- template
|
||||||
|
- type: pkg_list
|
||||||
|
data:
|
||||||
|
2ping: '3.2.1-1'
|
||||||
|
'0xffff': null
|
||||||
---
|
---
|
||||||
schema: 'drydock/BootAction/v1'
|
schema: 'drydock/BootAction/v1'
|
||||||
metadata:
|
metadata:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user