diff --git a/skyline_apiserver/api/v1/login.py b/skyline_apiserver/api/v1/login.py index e4d5941..8b1cc80 100644 --- a/skyline_apiserver/api/v1/login.py +++ b/skyline_apiserver/api/v1/login.py @@ -173,9 +173,10 @@ async def login( regex=constants.INBOUND_HEADER_REGEX, ), ) -> schemas.Profile: + region = credential.region or CONF.openstack.default_region try: project_scope, unscope_token, default_project_id = await _get_projects_and_unscope_token( - region=credential.region, + region=region, domain=credential.domain, username=credential.username, password=credential.password, @@ -186,13 +187,13 @@ async def login( default_project_id = None project_scope_token = await get_project_scope_token( keystone_token=unscope_token, - region=credential.region, + region=region, project_id=default_project_id or project_scope[0].id, ) profile = await generate_profile( keystone_token=project_scope_token, - region=credential.region, + region=region, ) profile = await _patch_profile(profile, x_openstack_request_id) diff --git a/skyline_apiserver/schemas/login.py b/skyline_apiserver/schemas/login.py index 1b193a6..9c80b9a 100644 --- a/skyline_apiserver/schemas/login.py +++ b/skyline_apiserver/schemas/login.py @@ -24,7 +24,7 @@ from skyline_apiserver.types import constants class Credential(BaseModel): - region: str = Field(..., description="Credential user region") + region: Optional[str] = Field(None, description="Credential identity service region") domain: str = Field(..., description="Credential user domain") username: str = Field(..., description="Credential username") password: str = Field(..., description="Credential password for user") diff --git a/swagger.json b/swagger.json index de89e87..4f07a65 100644 --- a/swagger.json +++ b/swagger.json @@ -2229,7 +2229,6 @@ "Credential": { "title": "Credential", "required": [ - "region", "domain", "username", "password" @@ -2239,7 +2238,7 @@ "region": { "title": "Region", "type": "string", - "description": "Credential user region" + "description": "Credential identity service region" }, "domain": { "title": "Domain", diff --git a/tox.ini b/tox.ini index e58c8ff..d85bffe 100644 --- a/tox.ini +++ b/tox.ini @@ -106,6 +106,7 @@ commands = description = Generate swagger files. envdir = {toxworkdir}/shared +allowlist_externals = skyline-swagger-generator commands = skyline-swagger-generator -o swagger.json @@ -113,6 +114,7 @@ commands = description = Generate config files. envdir = {toxworkdir}/shared +allowlist_externals = skyline-sample-config-generator commands = skyline-sample-config-generator -o etc/skyline.yaml.sample