diff --git a/cratedb_toolkit/cluster/croud.py b/cratedb_toolkit/cluster/croud.py index ddcc71b1..1215db07 100644 --- a/cratedb_toolkit/cluster/croud.py +++ b/cratedb_toolkit/cluster/croud.py @@ -62,7 +62,7 @@ def list_clusters(self): wr = CroudWrapper(call=call) return wr.invoke() - def create_project(self, name: str): + def create_project(self, name: str, organization_id: str = None): """ Create project. @@ -74,10 +74,14 @@ def create_project(self, name: str): from croud.__main__ import command_tree from croud.projects.commands import project_create + # TODO: Refactor elsewhere. + organization_id = organization_id or os.environ.get("CRATEDB_CLOUD_ORGANIZATION_ID") + call = CroudCall( fun=project_create, specs=command_tree["projects"]["commands"]["create"]["extra_args"], arguments=[ + f"--org-id={organization_id}", f"--name={name}", ], ) diff --git a/tests/cluster/test_examples.py b/tests/cluster/test_examples.py index 19cc51c0..3a2da0c9 100644 --- a/tests/cluster/test_examples.py +++ b/tests/cluster/test_examples.py @@ -43,6 +43,7 @@ def test_example_cloud_cluster_with_deploy(mocker, mock_cloud_cluster_deploy): mocker.patch.dict( "os.environ", { + "CRATEDB_CLOUD_ORGANIZATION_ID": "4148156d-b842-4a86-8024-ecb380be1fc2", "CRATEDB_CLOUD_SUBSCRIPTION_ID": "f33a2f55-17d1-4f21-8130-b6595d7c52db", "CRATEDB_CLOUD_CLUSTER_NAME": "testcluster", "CRATEDB_USERNAME": "crate",