+ 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