Skip to content

Commit

Permalink
fix: Attribute error Name while executing the sample code (#205)
Browse files Browse the repository at this point in the history
* Fix attribute error `Name` while getting the status of cluster

`cluster.status.State.Name(cluster.status.state),`  this code will throw an attribute error when executed because it's trying to access State.Name which is not a function of class ClusterStatus.State
A better approach will be to use the `cluster.status.state.name` as State is of enum type

* fix:attribute error Name while getting the status of cluster
  • Loading branch information
vikrant-sinha authored Jul 2, 2021
1 parent 977b6c8 commit 16e9388
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def list_clusters(dataproc, project, region):
(
"{} - {}".format(
cluster.cluster_name,
cluster.status.State.Name(cluster.status.state),
cluster.status.state.name
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def list_clusters_with_details(dataproc, project, region):
(
"{} - {}".format(
cluster.cluster_name,
cluster.status.State.Name(cluster.status.state),
cluster.status.state.name,
)
)
)
Expand Down

0 comments on commit 16e9388

Please sign in to comment.