Skip to content

Commit

Permalink
nitpic
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Webb <dan.webb@damacus.io>
  • Loading branch information
damacus committed Dec 11, 2024
1 parent b7b1864 commit fc117dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libraries/helpers_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def ip_address_from_container_networks(container)
end
end

def normalize_network_mode(mode)
def normalize_container_network_mode(mode)
return mode unless mode.is_a?(String) && mode.start_with?('container:')

# Extract container name/id from network mode
Expand Down
8 changes: 4 additions & 4 deletions resources/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def to_snake_case(name)
value = (value / (10**9)).to_i
when 'NetworkMode'
property_name = 'network_mode'
value = normalize_network_mode(value)
value = normalize_container_network_mode(value)
else
property_name = to_snake_case(key)
end
Expand Down Expand Up @@ -504,7 +504,7 @@ def load_container_labels
'MemorySwappiness' => new_resource.memory_swappiness,
'MemoryReservation' => new_resource.memory_reservation,
'NanoCpus' => new_resource.cpus,
'NetworkMode' => normalize_network_mode(new_resource.network_mode),
'NetworkMode' => normalize_container_network_mode(new_resource.network_mode),
'OomKillDisable' => new_resource.oom_kill_disable,
'OomScoreAdj' => new_resource.oom_score_adj,
'Privileged' => new_resource.privileged,
Expand Down Expand Up @@ -747,10 +747,10 @@ def read_env_file
new_resource.env_file.map { |f| ::File.readlines(f).map(&:strip) }.flatten
end

def normalize_network_mode(value)
def normalize_container_network_mode(value)
if value.is_a?(String) && value.start_with?('container:')
# Use the network helper method for container network mode
DockerCookbook::DockerHelpers::Network.normalize_network_mode(value)
DockerCookbook::DockerHelpers::Network.normalize_container_network_mode(value)
else
case value
when 'host'
Expand Down

0 comments on commit fc117dd

Please sign in to comment.