add Timestamp to multiple models (#796)

Expose the Azure storage table's "Timestamp" for the models where Timestamp should be user-accessible and remove the Timestamp field from models that did not sign up for it.

The behavior where Timestamp is only set by Azure Storage is kept.
This commit is contained in:
bmc-msft
2021-04-13 15:03:25 -04:00
committed by GitHub
parent 39464dc606
commit 470e95c833
5 changed files with 19 additions and 8 deletions

View File

@ -42,6 +42,7 @@ PROXY_LOG_PREFIX = "scaleset-proxy: "
# This isn't intended to ever be shared to the client, hence not being in
# onefuzztypes
class Proxy(ORMMixin):
timestamp: Optional[datetime.datetime] = Field(alias="Timestamp")
region: Region
state: VmState = Field(default=VmState.init)
auth: Authentication = Field(default_factory=build_auth)
@ -179,12 +180,12 @@ class Proxy(ORMMixin):
)
return False
elif not self.heartbeat and self.Timestamp and self.Timestamp < ten_minutes_ago:
elif not self.heartbeat and self.timestamp and self.timestamp < ten_minutes_ago:
logging.error(
PROXY_LOG_PREFIX + "no heartbeat in the last 10 minutes: "
"%s timestamp: %s compared_to:%s",
self.region,
self.Timestamp,
self.timestamp,
ten_minutes_ago,
)
return False