OSDN Git Service

adds the latest Ubuntu support. docker-grid-1.3.2
authorwhitestar <whitestar@users.osdn.me>
Sun, 23 Sep 2018 07:39:05 +0000 (16:39 +0900)
committerwhitestar <whitestar@users.osdn.me>
Sun, 23 Sep 2018 07:39:05 +0000 (16:39 +0900)
cookbooks/docker-grid/CHANGELOG.md
cookbooks/docker-grid/recipes/engine.rb
cookbooks/docker-grid/templates/default/etc/apt/sources.list.d/docker.list
cookbooks/docker-grid/version
roles/docker4latest_ubuntu.rb

index d57d135..f3a1545 100644 (file)
@@ -1,5 +1,9 @@
 # docker-grid CHANGELOG
 
 # docker-grid CHANGELOG
 
+1.3.2
+-----
+- adds the latest Ubuntu support.
+
 1.3.1
 -----
 - removes an extra attribute.
 1.3.1
 -----
 - removes an extra attribute.
index a08c36e..34d5996 100644 (file)
@@ -287,6 +287,7 @@ when 'debian'
       owner 'root'
       group 'root'
       mode '0644'
       owner 'root'
       group 'root'
       mode '0644'
+      helpers Chef::Mixin::ShellOut
       notifies :run, 'bash[apt-key_adv_docker_tools_key]', :before
       notifies :run, "execute[#{apt_get_update}]", :immediately
     end
       notifies :run, 'bash[apt-key_adv_docker_tools_key]', :before
       notifies :run, "execute[#{apt_get_update}]", :immediately
     end
index 5611a98..16c32a9 100644 (file)
@@ -14,13 +14,35 @@ if !override_apt_line.nil? && !override_apt_line.empty?
 <%= override_apt_line %>
 <%
 else
 <%= override_apt_line %>
 <%
 else
+  apt_repo_url = node['docker-grid']['apt_repo']['url']
+
   if enable_new_repo
   if enable_new_repo
+    codename = node['lsb']['codename']
+    codename = +codename  # unfreeze
+
+    # for the latest Ubuntu
+    if node['platform'] == 'ubuntu'
+      lap_behind = ['trusty', 'xenial', 'yakkety', 'zesty']
+      result = shell_out!(%q(curl -sS https://download.docker.com/linux/ubuntu/dists/ | awk -F'</?a[^>]*>' '/<\/a>/ {print $2}' | tr -d / | grep -v '\.\.' | sort))
+      codenames = result.stdout.chomp.split("\n") if result.exitstatus.zero? && !result.stdout.chomp.empty?
+      if codenames.include?(codename)
+          Chef::Log.info("Ubuntu #{codename} is supported by the dockerproject.")
+      else
+        codenames.reverse_each {|cn|
+          next if lap_behind.include?(cn)
+
+          Chef::Log.warn("Ubuntu #{codename} is not supported by the dockerproject yet, use #{cn} repository instead.")
+          codename = cn  # latest codename
+          break
+        }
+      end
+    end
 -%>
 -%>
-deb [arch=<%= arch %>] <%= node['docker-grid']['apt_repo']['url'] %> <%= node['lsb']['codename'] %> <%= node['docker-grid']['dockerproject']['apt_new_repo_sections'] %>
+deb [arch=<%= arch %>] <%= apt_repo_url %> <%= codename %> <%= node['docker-grid']['dockerproject']['apt_new_repo_sections'] %>
 <%
   else
 -%>
 <%
   else
 -%>
-deb <%= node['docker-grid']['apt_repo']['url'] %> <%= platform %>-<%= node['lsb']['codename'] %> main
+deb <%= apt_repo_url %> <%= platform %>-<%= codename %> main
 <%
   end
 end
 <%
   end
 end
index 3992e4b..ee95ee1 100644 (file)
@@ -1,5 +1,5 @@
 #
 #
-# Copyright 2016-2017, whitestar
+# Copyright 2016-2018, whitestar
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
 #
 
 name 'docker4latest_ubuntu'
 #
 
 name 'docker4latest_ubuntu'
-description 'Docker for the latest Ubuntu'
+description '*DEPRECATED* Docker for the latest Ubuntu'
 
 run_list(
   'role[docker]',
 
 run_list(
   'role[docker]',
@@ -36,8 +36,8 @@ override_attributes(
     'apt_repo' => {
       # new repo.
       # Check https://download.docker.com/linux/ubuntu/dists
     'apt_repo' => {
       # new repo.
       # Check https://download.docker.com/linux/ubuntu/dists
-      'override_apt_line' => 'deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable',
-      #'override_apt_line' => 'deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable',
+      'override_apt_line' => 'deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable',
+      #'override_apt_line' => 'deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable',
       # old repo.
       #'override_apt_line' => 'deb https://apt.dockerproject.org/repo ubuntu-zesty main',
       #'override_apt_line' => 'deb https://apt.dockerproject.org/repo ubuntu-xenial main',
       # old repo.
       #'override_apt_line' => 'deb https://apt.dockerproject.org/repo ubuntu-zesty main',
       #'override_apt_line' => 'deb https://apt.dockerproject.org/repo ubuntu-xenial main',