Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object_storage: config models improvements #136

Merged
merged 6 commits into from
Aug 24, 2023

Conversation

rominf
Copy link
Contributor

@rominf rominf commented Aug 23, 2023

About this change - What it does

  • common: introduce StrEnum class
  • object_storage: introduce StorageDriver enum
  • object_storage: hide object storage config secrets in representation
  • object_storage: make object storage config field types more precise
  • object_storage: split object storage config models

Why this way

To allow downstream use rohmu configs instead of code duplication. See commit messages for more info.

@rominf rominf force-pushed the rominf-object-storage-configs branch from 64ac6fd to b562e7a Compare August 23, 2023 18:48
@rominf rominf marked this pull request as ready for review August 23, 2023 18:53
@rominf rominf requested review from akudiyar and a team August 23, 2023 18:54
@rominf rominf force-pushed the rominf-object-storage-configs branch 3 times, most recently from fa0c76e to c4f84ef Compare August 24, 2023 10:43
Roman Inflianskas added 6 commits August 24, 2023 13:54
Note that this class is not the same as Python 3.11 `StrEnum`, it is
much more basic, but it suits our needs.
This will allow to use object storage configs in nested pydantic models
downstream in Discriminated Unions, see:
https://docs.pydantic.dev/1.10/usage/types/#discriminated-unions-aka-tagged-unions
This field is present in transfer class (it is optional) - everything
will work.
For some object storage operations bucket name is not required (for
listing bucket for example).
@rominf rominf force-pushed the rominf-object-storage-configs branch from c4f84ef to 0e8c61e Compare August 24, 2023 10:55


class LocalObjectStorageConfig(StorageModel):
directory: str
directory: DirectoryPath
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory this may break something, as object is no longer string, but I hope not (and local target should be really primarily used for testing in any case).

Copy link
Collaborator

@kmichel-aiven kmichel-aiven Aug 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did break things :(
It became impossible to create that model without the validation failing because the folder does not exist at the time the configuration is created. That breaks tests and will break use cases where the configuration is prepared and (de)serialized in a different environment (chroot, container, server, etc...) or just before that directory is created.

I'll prepare a revert PR.

[edit] #140

@fingon fingon merged commit 3142922 into main Aug 24, 2023
8 checks passed
@fingon fingon deleted the rominf-object-storage-configs branch August 24, 2023 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants