Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal of this PR started out as being able to handle tasks that require machines with specific tags, but then it got WAY bigger!
Things that I have improved:
conf/az.conf
,modules/machinery/az.py
conf/web.conf
,lib/cuckoo/common/web_utils.py
,lib/cuckoo/core/database.py
lib/cuckoo/common/abstracts.py
,lib/cuckoo/core/database.py
lib/cuckoo/common/web_utils
true
/false
,yes
/no
,on
/off
,0
/1
and can be any case.utils/db_migration/versions/2_3_3_expand_error_message.py
,lib/cuckoo/core/database.py
message
field because it could not contain theCuckooGuestCriticalTimeout
erroralembic
SCHEMA_VERSION
of thedatabase.py
filelib/cuckoo/core/scheduler.py
,lib/cuckoo/core/database.py
is_relevant_machine_available
method that determines if a machine is relevant to a task and available to be assignedfetch
method intofetch_task
for tasks that do not require a VM. This really simplifies the logic for this method.lib/cuckoo/core/database.py
guest_stop
method, we should check if the guest exists before trying to shut it down. This can occur in dynamic machineries such asaz
oraws
.list_machines
so that you can also filter bylocked
asTrue
/False
, machine label and the machine architecturelock_machine
to include the selection criteria that was attemptedget_available_machines
now joins ontags
options_not_like
inlist_tasks
since this is a way that we can replicate the use ofnot_("node=")
in the originalfetch
method https://github.com/kevoreilly/CAPEv2/blob/master/lib/cuckoo/core/database.py#L815order_by
keyword argument inlist_tasks
, so that we can pass multiple items tolist_tasks
to order tasks bylib/cuckoo/core/plugins.py
lib/cuckoo/core/resultserver.py
lib/cuckoo/core/scheduler.py
check_file
method, we should check if sample exists before trying to access it'ssha256
attribute.acquire
, determine which task tags are the architecture and which are just tags, and then pass these values toacquire
CuckooGuestCriticalTimeout
error that will unlock the machinemodules/machinery/az.py
number_of_new_cpus_available
according to the quota is less than 0, and if so, set the minimumnumber_of_relevant_machines_required
. This was causing errors when the 5 VM buffer was too close to the limit.tests/test_scheduler.py
acquire
andmock_tags
utils/cleaners.py