• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: Commit

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


Commit MetaInfo

Revision6ccd9e54f5260fa061ce854cc726aeb9df24f7e1 (tree)
Zeit2017-11-30 22:12:27
Autorwhitestar <whitestar@user...>
Commiterwhitestar

Log Message

bumps up hypercontainer version.

Ändern Zusammenfassung

Diff

--- a/cookbooks/hypercontainer/CHANGELOG.md
+++ b/cookbooks/hypercontainer/CHANGELOG.md
@@ -1,5 +1,10 @@
11 # hypercontainer CHANGELOG
22
3+0.2.0
4+-----
5+- bumps up hypercontainer version.
6+- adds the `['hypercontainer']['daemon_extra_options']` attribute.
7+
38 0.1.1
49 -----
510 - improves install method.
--- a/cookbooks/hypercontainer/README.md
+++ b/cookbooks/hypercontainer/README.md
@@ -32,12 +32,13 @@ This cookbook sets up a HyperContainer.
3232 |:--|:--|:--|:--|
3333 |`['hypercontainer']['install_flavor']`|String|`'script'` or `'direct_download'`|`'script'`|
3434 |`['hypercontainer']['fallback_direct_download_install']`|Boolean|fallback from install via script to direct download install.|`true`|
35-|`['hypercontainer']['package']['version']`|String||`'0.8.1-1'`|
35+|`['hypercontainer']['package']['version']`|String||`'1.0.0-1'`|
3636 |`['hypercontainer']['package']['download_url_context']`|String|URL context path for package download.|`"https://hypercontainer-download.s3-us-west-1.amazonaws.com/#{ver_ctx}/#{platform}"`|
3737 |`['hypercontainer']['package']['hypercontainer']`|String|hypercontainer package file name.|See `attributes/default.rb`|
3838 |`['hypercontainer']['package']['hyperstart']`|String|hyperstart package file name.|See `attributes/default.rb`|
3939 |`['hypercontainer']['auto_upgrade']`|Boolean|enable auto upgrade by Chef.|`false`|
4040 |`['hypercontainer']['hypervisor']`|String|`'qemu'` or `'xen'` for Debian family.|`'qemu'`|
41+|`['hypercontainer']['daemon_extra_options']`|String||`'--log_dir=/var/log/hyper'`|
4142
4243 ## Usage
4344
--- a/cookbooks/hypercontainer/attributes/default.rb
+++ b/cookbooks/hypercontainer/attributes/default.rb
@@ -24,11 +24,17 @@ platform = node['platform']
2424
2525 default['hypercontainer']['install_flavor'] = 'script' # 'script' or 'direct_download'
2626 default['hypercontainer']['fallback_direct_download_install'] = true
27-default['hypercontainer']['package']['version'] = '0.8.1-1'
27+default['hypercontainer']['package']['version'] = '1.0.0-1'
2828 ver = node['hypercontainer']['package']['version']
2929 ver_ctx = ver.slice(/^(\d+\.\d+)\./, 1) # e.g. '0.8'
30+pf_ctx = \
31+ if ver_ctx >= '1.0' && (platform == 'debian' || platform == 'ubuntu')
32+ 'debian_or_ubuntu'
33+ else
34+ platform
35+ end
3036 default['hypercontainer']['package']['download_url_context'] \
31- = "https://hypercontainer-download.s3-us-west-1.amazonaws.com/#{ver_ctx}/#{platform}"
37+ = "https://hypercontainer-download.s3-us-west-1.amazonaws.com/#{ver_ctx}/#{pf_ctx}"
3238
3339 case platform
3440 when 'centos'
@@ -41,3 +47,4 @@ end
4147
4248 default['hypercontainer']['auto_upgrade'] = false
4349 default['hypercontainer']['hypervisor'] = 'qemu' # 'qemu' or 'xen' for Debian family.
50+default['hypercontainer']['daemon_extra_options'] = '--log_dir=/var/log/hyper'
--- a/cookbooks/hypercontainer/recipes/default.rb
+++ b/cookbooks/hypercontainer/recipes/default.rb
@@ -21,10 +21,18 @@ file_cache_path = Chef::Config['file_cache_path']
2121 platform_family = node['platform_family']
2222 install_flavor = node['hypercontainer']['install_flavor']
2323 fallback_direct_download_install = node['hypercontainer']['fallback_direct_download_install']
24-expected_ver = node['hypercontainer']['package']['version'].slice(/^(\d+\.\d+\.\d+)\./, 1)
24+expected_ver = node['hypercontainer']['package']['version'].slice(/^(\d+\.\d+\.\d+)-/, 1)
2525 download_url_context = node['hypercontainer']['package']['download_url_context']
2626 status_file = '/tmp/install_hypercontainer_status'
2727
28+systemctl_daemon_reload = 'systemctl_daemon-reload'
29+resources(bash: systemctl_daemon_reload) rescue bash systemctl_daemon_reload do
30+ code <<-EOH
31+ systemctl daemon-reload
32+ EOH
33+ action :nothing
34+end
35+
2836 pkgs = [
2937 'curl',
3038 ]
@@ -72,7 +80,7 @@ hc_pkgs.each {|pkg_name, pkg_file|
7280 notifies :create, "remote_file[#{pkg_file_path}]", :before
7381 if pkg_name == 'hyperstart'
7482 notifies :enable, 'service[hyperd]', :delayed
75- notifies :start, 'service[hyperd]', :delayed
83+ notifies :restart, 'service[hyperd]', :delayed
7684 end
7785 end
7886 }
@@ -81,13 +89,13 @@ hc_pkgs.each {|pkg_name, pkg_file|
8189 log 'install_hypercontainer_packages.' do
8290 action :nothing
8391 not_if "hyperctl version | grep #{expected_ver}"
84- notifies :install, 'package[hypercontainer]', :immediately
85- notifies :install, 'package[hyperstart]', :immediately
92+ notifies :upgrade, 'package[hypercontainer]', :immediately
93+ notifies :upgrade, 'package[hyperstart]', :immediately
8694 end
8795
8896 if install_flavor == 'script'
8997 execute 'install_hypercontainer_by_script' do
90- # `echo $?` for notifies
98+ # `echo $?` (always success) for notifies
9199 command "curl -sSL https://hypercontainer.io/install | bash; echo $? > #{status_file}"
92100 action :run
93101 not_if { File.exist?('/usr/bin/hyperctl') } unless node['hypercontainer']['auto_upgrade']
@@ -102,6 +110,29 @@ elsif install_flavor == 'direct_download'
102110 end
103111 end
104112
113+hyperd_opts = []
114+extra_options = node['hypercontainer']['daemon_extra_options']
115+hyperd_opts.push(extra_options) if !extra_options.nil? && !extra_options.empty?
116+
117+directory '/etc/systemd/system/hyperd.service.d' do
118+ owner 'root'
119+ group 'root'
120+ mode '0755'
121+ action :create
122+end
123+
124+template '/etc/systemd/system/hyperd.service.d/override.conf' do
125+ source 'etc/systemd/system/hyperd.service.d/override.conf'
126+ owner 'root'
127+ group 'root'
128+ mode '0644'
129+ variables(
130+ hyperd_opts: hyperd_opts
131+ )
132+ notifies :run, "bash[#{systemctl_daemon_reload}]", :immediately
133+ notifies :restart, 'service[hyperd]'
134+end
135+
105136 srv = 'hyperd'
106137 resources(service: srv) rescue service srv do
107138 action [:enable, :start]
--- /dev/null
+++ b/cookbooks/hypercontainer/templates/default/etc/systemd/system/hyperd.service.d/override.conf
@@ -0,0 +1,3 @@
1+[Service]
2+ExecStart=
3+ExecStart=/usr/bin/hyperd <%= @hyperd_opts.join(' ') %>
--- a/cookbooks/hypercontainer/version
+++ b/cookbooks/hypercontainer/version
@@ -1 +1 @@
1-0.1.1
1+0.2.0
Show on old repository browser