Skip to content

Commit

Permalink
Compact down config extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisroberts committed Jul 10, 2024
1 parent ad92256 commit b71b9b5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugins/providers/docker/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,8 @@ def network_defined?(subnet_string)

network_info = inspect_network(all_networks)
network_info.each do |network|
next if !network["IPAM"]
config = network["IPAM"]["Config"]
next if !config || config.size < 1
config = Array(network.dig("IPAM", "Config"))
next if config.empty? || !config.first.is_a?(Hash)
if (config.first["Subnet"] == subnet_string)
@logger.debug("Found existing network #{network["Name"]} already configured with #{subnet_string}")
return network["Name"]
Expand Down

0 comments on commit b71b9b5

Please sign in to comment.