Class: Chef::Provider::DockerContainer

Inherits:
LWRPBase
  • Object
show all
Includes:
ChefMetalDocker::Helpers::Container
Defined in:
lib/chef/provider/docker_container.rb

Instance Method Summary collapse

Methods included from ChefMetalDocker::Helpers::Container::Actions

#commit, #cp, #export, #kill, #redeploy, #remove, #restart, #run, #service_action, #service_create, #service_create_runit, #service_create_systemd, #service_create_sysv, #service_create_upstart, #service_remove, #service_remove_runit, #service_remove_systemd, #service_remove_sysv, #service_remove_upstart, #service_restart, #service_start, #service_stop, #service_template, #start, #stop, #wait

Methods included from ChefMetalDocker::Helpers::Container::Helpers

#cidfile, #command_timeout_error_message, #container_command_matches_if_exists?, #container_id_matches?, #container_image_matches?, #container_name, #container_name_matches_if_exists?, #docker_containers, #exists?, #get_ranges, #port, #running?, #service?, #service_name, #sockets

Methods included from ChefMetalDocker::Helpers

#cli_args, #command_timeout_error_message, #docker_cmd, #docker_cmd!, #docker_inspect, #docker_inspect_id, #dockercfg_parse, #dockercfg_parse_auth, #execute_cmd, #execute_cmd!, #timeout, #wait_until_ready!

Instance Method Details

#load_current_resourceObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/chef/provider/docker_container.rb', line 12

def load_current_resource
  @current_resource = Chef::Resource::DockerContainer.new(new_resource)
  wait_until_ready!
  docker_containers.each do |ps|
    unless container_id_matches?(ps['id'])
      next unless container_image_matches?(ps['image'])
      next unless container_command_matches_if_exists?(ps['command'])
      next unless container_name_matches_if_exists?(ps['names'])
    end
    Chef::Log.debug('Matched docker container: ' + ps['line'].squeeze(' '))
    @current_resource.container_name(ps['names'])
    @current_resource.created(ps['created'])
    @current_resource.id(ps['id'])
    @current_resource.status(ps['status'])
    break
  end
  @current_resource
end

#whyrun_supported?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/chef/provider/docker_container.rb', line 8

def whyrun_supported?
  true
end