Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvll committed Dec 12, 2022
1 parent f3a5488 commit b164b73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sky/backends/backend_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ def _query_status_azure(

def _check_user_identity(cloud: clouds.Cloud, cluster_name: str):
"""Check if the current user is the same as the user who created the cluster."""
user_identity = global_user_state.get_cluster_user_identity()
user_identity = global_user_state.get_cluster_user_identity(cluster_name)
current_user_identity = cloud.get_user_identity()
if user_identity is None:
if current_user_identity is not None:
Expand Down
2 changes: 2 additions & 0 deletions sky/global_user_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,14 @@ def set_cluster_metadata(cluster_name: str, metadata: Dict[str, Any]) -> None:
if count == 0:
raise ValueError(f'Cluster {cluster_name} not found.')


def get_cluster_user_identity(cluster_name: str) -> Optional[str]:
metadata = get_cluster_metadata(cluster_name)
if metadata is None:
return None
return metadata.get('user_identity')


def set_cluster_user_identity(cluster_name: str, user_identity: str) -> None:
# This must be called when the lock is acquired for the cluster.
metadata = get_cluster_metadata(cluster_name)
Expand Down

0 comments on commit b164b73

Please sign in to comment.