• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: コミット

Grid環境構築用のChefリポジトリです。


コミットメタ情報

リビジョンa876eed85e6c63b995faa6a6fb6854eda73c4c8b (tree)
日時2018-08-22 12:30:37
作者whitestar <whitestar@user...>
コミッターwhitestar

ログメッセージ

adds the ['docker-grid']['compose']['version'] attribute.

変更サマリ

差分

--- a/cookbooks/docker-grid/CHANGELOG.md
+++ b/cookbooks/docker-grid/CHANGELOG.md
@@ -3,6 +3,7 @@
33 1.2.1
44 -----
55 - adds docker-compose cleanup before installing it.
6+- adds the `['docker-grid']['compose']['version']` attribute.
67
78 1.2.0
89 -----
--- a/cookbooks/docker-grid/README.md
+++ b/cookbooks/docker-grid/README.md
@@ -50,8 +50,9 @@ This cookbook sets up Docker engine etc.
5050 |`['docker-grid']['yum_repo']['gpgkey']`|String|for the old repository only.|`'https://yum.dockerproject.org/gpg'`|
5151 |`['docker-grid']['compose']['install_flavor']`|String|`'dockerproject'` or `'os-repository'` or `'pypi'`|`'dockerproject'`|
5252 |`['docker-grid']['compose']['skip_setup']`|Boolean||`false`|
53-|`['docker-grid']['compose']['auto_upgrade']`|Boolean|upgrade/reinstall the docker-compose automatically.|`false`|
54-|`['docker-grid']['compose']['release_base_url']`|String||`'https://github.com/docker/compose/releases/download/1.9.0'`|
53+|`['docker-grid']['compose']['auto_upgrade']`|Boolean|upgrade/reinstall the docker-compose automatically. Note: this flag is ignored in the case of `os-repository`.|`false`|
54+|`['docker-grid']['compose']['version']`|String|Note: this version is ignored in the case of `os-repository`, do not use empty value.|`'1.21.1'`|
55+|`['docker-grid']['compose']['release_base_url']`|String||`"https://github.com/docker/compose/releases/download/#{['docker-grid']['compose']['version']}"`|
5556 |`['docker-grid']['compose']['release_url']`|String||`"#{node['docker-grid']['compose']['release_base_url']}/docker-compose-#{node['kernel']['name']}-#{node['kernel']['machine']}"`|
5657 |`['docker-grid']['compose']['home_dir']`|String||`'/opt/docker-compose'`|
5758 |`['docker-grid']['compose']['app_dir']`|String||`"#{node['docker-grid']['compose']['home_dir']}/app"`|
--- a/cookbooks/docker-grid/attributes/default.rb
+++ b/cookbooks/docker-grid/attributes/default.rb
@@ -58,7 +58,8 @@ default['docker-grid']['compose']['skip_setup'] = false
5858 # os-repository (CentOS): none.
5959 default['docker-grid']['compose']['auto_upgrade'] = false
6060 # latest: 'https://github.com/docker/compose/releases/download/1.22.0'
61-default['docker-grid']['compose']['release_base_url'] = 'https://github.com/docker/compose/releases/download/1.21.2'
61+default['docker-grid']['compose']['version'] = '1.21.2'
62+default['docker-grid']['compose']['release_base_url'] = "https://github.com/docker/compose/releases/download/#{node['docker-grid']['compose']['version']}"
6263 default['docker-grid']['compose']['release_url'] = "#{node['docker-grid']['compose']['release_base_url']}/docker-compose-#{node['kernel']['name']}-#{node['kernel']['machine']}"
6364 default['docker-grid']['compose']['home_dir'] = '/opt/docker-compose'
6465 default['docker-grid']['compose']['app_dir'] = "#{node['docker-grid']['compose']['home_dir']}/app"
--- a/cookbooks/docker-grid/recipes/compose.rb
+++ b/cookbooks/docker-grid/recipes/compose.rb
@@ -20,6 +20,7 @@
2020 # See: https://docs.docker.com/compose/install/
2121
2222 install_flavor = node['docker-grid']['compose']['install_flavor']
23+auto_upgrade = node['docker-grid']['compose']['auto_upgrade']
2324
2425 if node['docker-grid']['compose']['skip_setup']
2526 log 'Skip the Docker Compose setup.'
@@ -74,14 +75,14 @@ end
7475
7576 case install_flavor
7677 when 'dockerproject'
77- excepted_ver = node['docker-grid']['compose']['release_url'].match(/(\d+\.\d+.\d+)/)[1]
78+ expected_ver = node['docker-grid']['compose']['release_url'].match(/(\d+\.\d+.\d+)/)[1]
7879
7980 execute 'install_docker_compose' do
8081 user 'root'
8182 command "curl -L \"#{node['docker-grid']['compose']['release_url']}\" -o #{docker_compose_path} && chmod +x #{docker_compose_path}"
8283 action :run
83- not_if "#{docker_compose_path} -v | grep #{excepted_ver},"
84- not_if { ::File.exist?(docker_compose_path) } unless node['docker-grid']['compose']['auto_upgrade']
84+ not_if "#{docker_compose_path} -v | grep #{expected_ver},"
85+ not_if { ::File.exist?(docker_compose_path) } unless auto_upgrade
8586 end
8687
8788 # for sudo secure_path on RHEL family OS
@@ -90,18 +91,24 @@ when 'dockerproject'
9091 only_if { node['platform_family'] == 'rhel' }
9192 end
9293 when 'os-repository'
94+ act = auto_upgrade ? :upgrade : :install
9395 package 'docker-compose' do
94- action :install
96+ action act
9597 end
9698 when 'pypi'
99+ expected_ver = node['docker-grid']['compose']['version']
100+ expected_ver = '' if expected_ver.nil?
101+ pin_ver = expected_ver.empty? ? '' : "==#{expected_ver}"
102+
97103 include_recipe 'platform_utils::pip'
98104
99105 # Note: installed to /usr/local/bin/docker-compose
100106 execute 'pip_install_docker_compose' do
101107 user 'root'
102108 environment 'HOME' => '/root' # = sudo -H
103- command 'pip install docker-compose'
109+ command "pip install docker-compose#{pin_ver}"
104110 action :run
105- not_if 'pip list | grep docker-compose'
111+ not_if "pip list | grep docker-compose | grep '(#{expected_ver})'" unless expected_ver.empty?
112+ not_if "pip list | grep docker-compose" unless auto_upgrade
106113 end
107114 end
旧リポジトリブラウザで表示