Skip to content

Commit

Permalink
Allow cluster batch_connect_ssh_allow? to return nil if not defined (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock authored May 27, 2021
1 parent c20cbeb commit 68737cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ood_core/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ def allow?
end

# Whether this cluster supports SSH to batch connect nodes
# @return [Boolean] whether cluster supports SSH to batch connect node
# @return [Boolean, nil] whether cluster supports SSH to batch connect node
def batch_connect_ssh_allow?
return @batch_connect_ssh_allow if defined?(@batch_connect_ssh_allow)
return @batch_connect_ssh_allow = true if batch_connect_config.nil?
return @batch_connect_ssh_allow = nil if batch_connect_config.nil?

@batch_connect_ssh_allow = batch_connect_config.fetch(:ssh_allow, true)
@batch_connect_ssh_allow = batch_connect_config.fetch(:ssh_allow, nil)
end

# The comparison operator
Expand Down
5 changes: 5 additions & 0 deletions spec/cluster_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
end

it 'has default for batch_connect_ssh_allow?' do
expect(owens.batch_connect_ssh_allow?).to be_nil
end

it 'can enable batch_connect_ssh_allow?' do
owens = OodCore::Cluster.new({id: "owens", batch_connect: { ssh_allow: true } })
expect(owens.batch_connect_ssh_allow?).to be true
end

Expand Down

0 comments on commit 68737cb

Please sign in to comment.