Sha256: f1a890063842bcba875f131447d510f16ca082b07208e00cd2e5569400a009fc

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

module DockerCookbook
  class DockerInstallationScript < DockerBase
    #####################
    # Resource properties
    #####################
    resource_name :docker_installation_script

    provides :docker_installation, os: 'linux'

    property :repo, %w(main test experimental), default: 'main', desired_state: false
    property :script_url, String, default: lazy { default_script_url }, desired_state: false

    default_action :create

    ################
    # helper methods
    ################

    def default_script_url
      case repo
      when 'main'
        'https://get.docker.com/'
      when 'test'
        'https://test.docker.com/'
      when 'experimental'
        'https://experimental.docker.com/'
      end
    end

    #########
    # Actions
    #########

    action :create do
      package 'curl' do
        action :install
      end

      execute 'install docker' do
        command "curl -sSL #{script_url} | sh"
        creates '/usr/bin/docker'
      end
    end

    action :delete do
      package 'docker-engine' do
        action :remove
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chef-12.11.18-universal-mingw32 acceptance/top-cookbooks/test_run/docker/libraries/docker_installation_script.rb
chef-12.11.18 acceptance/top-cookbooks/test_run/docker/libraries/docker_installation_script.rb