Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

tasks must use pools not VMs #1105

Merged
1 commit merged into from
Jul 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/api-service/__app__/onefuzzlib/tasks/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from ..azure.creds import get_instance_id
from ..azure.queue import get_queue_sas
from ..azure.storage import StorageType
from ..workers.pools import Pool
from .defs import TASK_DEFINITIONS

LOGGER = logging.getLogger("onefuzz")
Expand Down Expand Up @@ -143,25 +144,24 @@ def check_config(config: TaskConfig) -> None:
raise TaskConfigError("missing supervisor_exe")

if config.vm:
if not check_val(definition.vm.compare, definition.vm.value, config.vm.count):
err = "invalid vm count: expected %s %d, got %s" % (
definition.vm.compare,
definition.vm.value,
config.vm.count,
)
LOGGER.error(err)
raise TaskConfigError(err)
elif config.pool:
if not check_val(definition.vm.compare, definition.vm.value, config.pool.count):
err = "invalid vm count: expected %s %d, got %s" % (
definition.vm.compare,
definition.vm.value,
config.pool.count,
)
LOGGER.error(err)
raise TaskConfigError(err)
else:
raise TaskConfigError("either the vm or pool must be specified")
err = "specifying task config vm is no longer supported"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

raise TaskConfigError(err)

if not config.pool:
raise TaskConfigError("pool must be specified")

if not check_val(definition.vm.compare, definition.vm.value, config.pool.count):
err = "invalid vm count: expected %s %d, got %s" % (
definition.vm.compare,
definition.vm.value,
config.pool.count,
)
LOGGER.error(err)
raise TaskConfigError(err)

pool = Pool.get_by_name(config.pool.pool_name)
if not isinstance(pool, Pool):
raise TaskConfigError(f"invalid pool: {config.pool.pool_name}")

check_target_exe(config, definition)

Expand Down