From b2ea9f3aff6bcf29bb65a6d77b313eb9dea98ac5 Mon Sep 17 00:00:00 2001 From: sonicaj Date: Thu, 24 Feb 2022 20:11:02 +0500 Subject: [PATCH] Make migrate generic --- .../1.5.0/migrations/{migrate_from_1.4.24 => migrate} | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) rename test/minio/1.5.0/migrations/{migrate_from_1.4.24 => migrate} (92%) diff --git a/test/minio/1.5.0/migrations/migrate_from_1.4.24 b/test/minio/1.5.0/migrations/migrate similarity index 92% rename from test/minio/1.5.0/migrations/migrate_from_1.4.24 rename to test/minio/1.5.0/migrations/migrate index 7171454a73..155c8ff372 100755 --- a/test/minio/1.5.0/migrations/migrate_from_1.4.24 +++ b/test/minio/1.5.0/migrations/migrate @@ -14,6 +14,11 @@ def path_in_locked_datasets(path: str) -> bool: return c.call('pool.dataset.path_in_locked_datasets', path) +def get_configured_user_group(path: str) -> dict: + with Client() as c: + return c.call('filesystem.stat', path) + + def get_host_path_attachments(path: str) -> set: with Client() as c: return { @@ -82,9 +87,13 @@ def migrate(values: dict) -> dict: else: app_dataset = values["appVolumeMounts"]["export"]["datasetName"] host_path = os.path.join( - "/mnt", k8s_config['dataset'], "releases", values["release_name"], app_dataset + "/mnt", k8s_config['dataset'], "releases", values["release_name"], "volumes/ix_volumes", app_dataset ) + current_config = get_configured_user_group(host_path) + if current_config["uid"] == uid and current_config["gid"] == gid: + return values + validate_host_path(host_path, values['release_name'], verrors) verrors.check() # chown the host path