Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 9be4298d authored by SIMONIN Matthieu's avatar SIMONIN Matthieu
Browse files

api/utils: fail hard if roles as dict is detected

parent cc8aefc8
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,13 @@ def _hostslike_to_roles(input: Optional[RolesLike]) -> Optional[Roles]:
return input
if isinstance(input, Host):
return Roles(all=[input])
return Roles(all=input)
if isinstance(input, list):
return Roles(all=input)
error = (
f"{type(input)} isn't an acceptable type for RolesLike"
"=Union[Roles, List[Host], Host]"
)
raise ValueError(error)
def get_address(host: Host, networks: Optional[List[Network]] = None) -> str:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment