Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect loading of container name when links are present. #204

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion providers/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ def load_current_resource
docker_containers.each do |ps|
next unless container_matches?(ps)
Chef::Log.debug('Matched docker container: ' + ps['line'].squeeze(' '))
@current_resource.container_name(ps['names'])
detected_container_name = ps['names']. # out of all raw names,
split(','). # extract the different names,
reject { |n| n.include?('/') }. # filter out links (eg. 'my-app/db')
fetch(0) # returning main name (always exist)
@current_resource.container_name(detected_container_name)
@current_resource.created(ps['created'])
@current_resource.id(ps['id'])
@current_resource.status(ps['status'])
Expand Down