Skip to content

Commit

Permalink
backend: add function for creating a storage based on StorageEnum
Browse files Browse the repository at this point in the history
This isn't necessary and we could get by with `storage_for_job` but I
think this is a good first step towards decoupling storage from jobs,
as we discoused a couple of times already.
  • Loading branch information
FrostyX committed Jun 24, 2024
1 parent 06d270a commit b655d6e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/copr_backend/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ def storage_for_job(job, opts, log):
"""
Return an appropriate storage object for a given job
"""
if job.storage == StorageEnum.pulp:
return storage_for_enum(job.storage, opts, log)


def storage_for_enum(enum_value, opts, log):
"""
Return an appropriate `StorageEnum` value
"""
if enum_value == StorageEnum.pulp:
return PulpStorage(opts, log)
return BackendStorage(opts, log)

Expand Down

0 comments on commit b655d6e

Please sign in to comment.