mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-14 11:08:06 +00:00
Add user_info to Jobs & Repro (#327)
This adds information about the user that created a job or repro VM to the respective resources. This expands on the addition made to tasks in #303.
This commit is contained in:
@ -11,7 +11,7 @@ from azure.mgmt.compute.models import VirtualMachine
|
||||
from onefuzztypes.enums import OS, ContainerType, ErrorCode, VmState
|
||||
from onefuzztypes.models import Error
|
||||
from onefuzztypes.models import Repro as BASE_REPRO
|
||||
from onefuzztypes.models import ReproConfig, TaskVm
|
||||
from onefuzztypes.models import ReproConfig, TaskVm, UserInfo
|
||||
|
||||
from .azure.auth import build_auth
|
||||
from .azure.containers import StorageType, save_blob
|
||||
@ -219,7 +219,9 @@ class Repro(BASE_REPRO, ORMMixin):
|
||||
return cls.search(query=query)
|
||||
|
||||
@classmethod
|
||||
def create(cls, config: ReproConfig) -> Union[Error, "Repro"]:
|
||||
def create(
|
||||
cls, config: ReproConfig, user_info: Optional[UserInfo]
|
||||
) -> Union[Error, "Repro"]:
|
||||
report = get_report(config.container, config.path)
|
||||
if not report:
|
||||
return Error(
|
||||
@ -233,6 +235,8 @@ class Repro(BASE_REPRO, ORMMixin):
|
||||
vm = cls(config=config, task_id=task.task_id, os=task.os, auth=build_auth())
|
||||
if vm.end_time is None:
|
||||
vm.end_time = datetime.utcnow() + timedelta(hours=config.duration)
|
||||
|
||||
vm.user_info = user_info
|
||||
vm.save()
|
||||
|
||||
return vm
|
||||
|
Reference in New Issue
Block a user