chef-container 0.0.2.pre.dev8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3d10df2c7b071d4eece86403d9dc3be7304912c
|
4
|
+
data.tar.gz: 362c74abd1317fec6059adda1beb9cdb8d15b83f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 482039af7d12eb4f5f8d81bf0a66c5e73a31f96308af6a45ac3d908a44d32f18a58b7212bc3783e8d524f2695b624ff907c27f35def76c2a82e6d322b8fe5183
|
7
|
+
data.tar.gz: 0b97e49d87015c71666f8b3497b69065b2c7e83e06dd8cb8bc7840095a3548b4f51330fdf1f419618c43b63657ff45ac7df25b1279dee4be064374e6bea0bae4
|
data/lib/chef/container/runit.rb
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
class Chef
|
3
3
|
module Container
|
4
4
|
module Runit
|
5
|
+
RUNSV_BIN = '/opt/chef/embedded/bin/runsv'
|
5
6
|
SV_BIN = '/opt/chef/embedded/bin/sv'
|
6
|
-
SV_DIR = '/opt/chef/
|
7
|
-
SERVICE_DIR = '/opt/chef/
|
7
|
+
SV_DIR = '/opt/chef/sv'
|
8
|
+
SERVICE_DIR = '/opt/chef/service'
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
@@ -72,11 +72,14 @@ class Chef
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def run_script_content
|
75
|
-
"#!/bin/sh
|
75
|
+
"#!/bin/sh
|
76
|
+
exec 2>&1
|
77
|
+
exec #{new_resource.command} 2>&1"
|
76
78
|
end
|
77
79
|
|
78
80
|
def log_run_script_content
|
79
|
-
"#!/bin/sh
|
81
|
+
"#!/bin/sh
|
82
|
+
exec svlogd -tt /var/log/#{new_resource.service_name}"
|
80
83
|
end
|
81
84
|
|
82
85
|
end
|
@@ -32,6 +32,8 @@ class Chef
|
|
32
32
|
|
33
33
|
def initialize(*args)
|
34
34
|
super
|
35
|
+
@service_link = nil
|
36
|
+
@new_resource.supports[:status] = true
|
35
37
|
end
|
36
38
|
|
37
39
|
def load_current_resource
|
@@ -80,23 +82,28 @@ class Chef
|
|
80
82
|
end
|
81
83
|
|
82
84
|
def start_service
|
83
|
-
|
85
|
+
if ::File.exists?(service_dir_name)
|
86
|
+
shell_out!("#{Chef::Container::Runit::SV_BIN} start #{service_dir_name}")
|
87
|
+
else
|
88
|
+
service_link.run_action(:create)
|
89
|
+
shell_out!("#{Chef::Container::Runit::RUNSV_BIN} #{service_dir_name} &")
|
90
|
+
end
|
84
91
|
end
|
85
92
|
|
86
93
|
def stop_service
|
87
|
-
shell_out!("#{Chef::Container::Runit::SV_BIN} stop #{
|
94
|
+
shell_out!("#{Chef::Container::Runit::SV_BIN} stop #{service_dir_name}")
|
88
95
|
end
|
89
96
|
|
90
97
|
def restart_service
|
91
|
-
shell_out!("#{Chef::Container::Runit::SV_BIN} restart #{
|
98
|
+
shell_out!("#{Chef::Container::Runit::SV_BIN} restart #{service_dir_name}")
|
92
99
|
end
|
93
100
|
|
94
101
|
def reload_service
|
95
|
-
shell_out!("#{Chef::Container::Runit::SV_BIN} force-reload #{
|
102
|
+
shell_out!("#{Chef::Container::Runit::SV_BIN} force-reload #{service_dir_name}")
|
96
103
|
end
|
97
104
|
|
98
105
|
def running?
|
99
|
-
cmd = shell_out("#{Chef::Container::Runit::SV_BIN} status #{
|
106
|
+
cmd = shell_out("#{Chef::Container::Runit::SV_BIN} status #{service_dir_name}")
|
100
107
|
(cmd.stdout =~ /^run:/ && cmd.exitstatus == 0)
|
101
108
|
end
|
102
109
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-container
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Duffield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
@@ -94,9 +94,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- - "
|
97
|
+
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
99
|
+
version: '0'
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
102
|
rubygems_version: 2.2.2
|