Skip to content

Commit

Permalink
[339] fix handling of missing current cluster config
Browse files Browse the repository at this point in the history
  • Loading branch information
moklidia committed Oct 9, 2023
1 parent 9ee0946 commit 633133a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/uffizzi/cli/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def handle_update_kubeconfig_command(project_slug, command_args)
end

def handle_sleep_command(project_slug, command_args)
cluster_name = command_args[:cluster_name] || ConfigFile.read_option(:current_cluster).fetch(:name)
cluster_name = command_args[:cluster_name] || ConfigFile.read_option(:current_cluster)&.fetch(:name)
return handle_missing_cluster_name_error if cluster_name.nil?

response = scale_down_cluster(ConfigFile.read_option(:server), project_slug, cluster_name)
Expand All @@ -256,7 +256,7 @@ def handle_sleep_command(project_slug, command_args)
end

def handle_wake_command(project_slug, command_args)
cluster_name = command_args[:cluster_name] || ConfigFile.read_option(:current_cluster).fetch(:name)
cluster_name = command_args[:cluster_name] || ConfigFile.read_option(:current_cluster)&.fetch(:name)
return handle_missing_cluster_name_error if cluster_name.nil?

response = scale_up_cluster(ConfigFile.read_option(:server), project_slug, cluster_name)
Expand Down

0 comments on commit 633133a

Please sign in to comment.