tasks must use pools not VMs (#1105)

using config.vm depricated prior to 1.0.0
This commit is contained in:
bmc-msft
2021-07-23 10:10:51 -04:00
committed by GitHub
parent 55366e751a
commit b90ee03fd9

View File

@ -18,6 +18,7 @@ from ..azure.containers import blob_exists, container_exists, get_container_sas_
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")
@ -143,15 +144,12 @@ 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)
err = "specifying task config vm is no longer supported"
raise TaskConfigError(err)
elif config.pool:
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,
@ -160,8 +158,10 @@ def check_config(config: TaskConfig) -> None:
)
LOGGER.error(err)
raise TaskConfigError(err)
else:
raise TaskConfigError("either the vm or pool must be specified")
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)