Change servicekeyworker to use a data interface
This commit is contained in:
parent
0afc222214
commit
932db23a5c
4 changed files with 53 additions and 8 deletions
19
workers/servicekeyworker/models_pre_oci.py
Normal file
19
workers/servicekeyworker/models_pre_oci.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from data import model
|
||||
from workers.servicekeyworker.models_interface import ServiceKeyWorkerDataInterface
|
||||
|
||||
class PreOCIModel(ServiceKeyWorkerDataInterface):
|
||||
def set_key_expiration(self, kid, expiration_date):
|
||||
model.service_keys.set_key_expiration(kid, expiration_date)
|
||||
|
||||
def create_service_key_for_testing(self, expiration):
|
||||
key = model.service_keys.create_service_key('test', 'somekid', 'quay', '', {}, expiration)
|
||||
return key.kid
|
||||
|
||||
def get_service_key_expiration(self, kid):
|
||||
try:
|
||||
key = model.service_keys.get_service_key(kid, approved_only=False)
|
||||
return key.expiration_date
|
||||
except model.ServiceKeyDoesNotExist:
|
||||
return None
|
||||
|
||||
pre_oci_model = PreOCIModel()
|
Reference in a new issue