poise-service-runit 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -2
- data/Berksfile +5 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +3 -1
- data/chef/templates/sv-template-log-run.erb +1 -1
- data/chef/templates/sv-template-run.erb +3 -3
- data/lib/poise_service/runit/provider.rb +33 -3
- data/lib/poise_service/runit/version.rb +1 -1
- data/poise-service-runit.gemspec +1 -1
- data/test/cookbooks/poise-service-runit_test/recipes/default.rb +2 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c209d895aa803d66524df70aa508a6b8fc9f007
|
4
|
+
data.tar.gz: 1fe211e400f1bd3bee1ec3119c5451deda1c64ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f0fd4f678f97595ab5338c629c2d9850e57ff0950aedb208443a7fd9645bbb664fcd459eb507a88a08a598e457e64de8ff273575fd17ff0531c6d73317def2a
|
7
|
+
data.tar.gz: cdf3134fc2645d899cb2252e476ab180e01c2b1f489856e07de1a38345c4d2a38418d6167440ee1984225c04aadc648885a2049b503b8dbf3a450d78e3c9d64a
|
data/.gitignore
CHANGED
data/Berksfile
CHANGED
@@ -26,3 +26,8 @@ group :test do
|
|
26
26
|
cookbook 'poise-service-runit_test', path: 'test/cookbooks/poise-service-runit_test'
|
27
27
|
cookbook 'apt'
|
28
28
|
end
|
29
|
+
|
30
|
+
# For the master build, pull in the runit cookbook from git.
|
31
|
+
if ENV['POISE_MASTER_BUILD']
|
32
|
+
cookbook 'runit', github: 'hw-cookbooks/runit', branch: 'develop'
|
33
|
+
end
|
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
@@ -18,10 +18,12 @@ source 'https://rubygems.org/'
|
|
18
18
|
|
19
19
|
gemspec path: File.expand_path('..', __FILE__)
|
20
20
|
|
21
|
-
def dev_gem(name, path: File.join('..', name))
|
21
|
+
def dev_gem(name, path: File.join('..', name), github: nil)
|
22
22
|
path = File.expand_path(File.join('..', path), __FILE__)
|
23
23
|
if File.exist?(path)
|
24
24
|
gem name, path: path
|
25
|
+
elsif github
|
26
|
+
gem name, github: github
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
exec svlogd -tt /var/log/<%= @options[
|
2
|
+
exec svlogd -tt /var/log/<%= @options['new_resource'].service_name %>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
exec 2>&1
|
3
|
-
cd <%= @options[
|
3
|
+
cd <%= @options['new_resource'].directory %>
|
4
4
|
if [ -d "<%= File.join(@options['sv_dir'], @options['new_resource'].service_name, 'env') %>" ]; then
|
5
|
-
exec chpst -u "<%= @options[
|
5
|
+
exec chpst -u "<%= @options['new_resource'].user %>" -U "<%= @options['new_resource'].user %>" -e "<%= File.join(@options['sv_dir'], @options['new_resource'].service_name, 'env') %>" <%= @options['new_resource'].command %>
|
6
6
|
else
|
7
|
-
exec chpst -u "<%= @options[
|
7
|
+
exec chpst -u "<%= @options['new_resource'].user %>" -U "<%= @options['new_resource'].user %>" <%= @options['new_resource'].command %>
|
8
8
|
fi
|
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
require 'chef/mash'
|
18
18
|
|
19
|
+
require 'poise_service/error'
|
19
20
|
require 'poise_service/service_providers/base'
|
20
21
|
|
21
22
|
|
@@ -71,7 +72,14 @@ module PoiseService
|
|
71
72
|
|
72
73
|
# Recipes to include for Runit.
|
73
74
|
def recipes
|
74
|
-
'runit'
|
75
|
+
['runit', proc {
|
76
|
+
begin
|
77
|
+
if node['virtualization'] && %w{docker lxc}.include?(node['virtualization']['system'])
|
78
|
+
resources('service[runsvdir-start]').action(:nothing)
|
79
|
+
end
|
80
|
+
rescue Chef::Exceptions::ResourceNotFound
|
81
|
+
end
|
82
|
+
}]
|
75
83
|
end
|
76
84
|
|
77
85
|
# Set up secondary service files for Runit.
|
@@ -86,6 +94,20 @@ module PoiseService
|
|
86
94
|
end
|
87
95
|
end
|
88
96
|
|
97
|
+
# Hack the enable action for the runit provider. This forces it to wait
|
98
|
+
# until runsv recognizes the new service. This is tracked upstream in
|
99
|
+
# https://github.com/hw-cookbooks/runit/issues/136
|
100
|
+
#
|
101
|
+
# @api private
|
102
|
+
# @todo Remove once the upstream bug is fixed.
|
103
|
+
def enable_service
|
104
|
+
super
|
105
|
+
sleep 1 until ::FileTest.pipe?("#{service_resource.service_dir}/#{service_resource.service_name}/supervise/ok")
|
106
|
+
if service_resource.log
|
107
|
+
sleep 1 until ::FileTest.pipe?("#{service_resource.service_dir}/#{service_resource.service_name}/log/supervise/ok")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
89
111
|
# Tear down secondary service files for Runit.
|
90
112
|
def destroy_service
|
91
113
|
# Disable automatically destroys the service with Runit.
|
@@ -99,9 +121,17 @@ module PoiseService
|
|
99
121
|
#
|
100
122
|
# @return [Class]
|
101
123
|
def service_provider
|
102
|
-
|
124
|
+
base_class = if defined?(Chef::Provider::RunitService)
|
125
|
+
Chef::Provider::RunitService
|
126
|
+
elsif defined?(Chef::Provider::Service::Runit)
|
127
|
+
Chef::Provider::Service::Runit
|
128
|
+
else
|
129
|
+
raise PoiseService::Error.new('Unable to find runit_service provider class.')
|
130
|
+
end
|
131
|
+
Class.new(base_class) do
|
132
|
+
# Lie about the name.
|
103
133
|
def self.name
|
104
|
-
|
134
|
+
superclass.name
|
105
135
|
end
|
106
136
|
|
107
137
|
def inside_docker?
|
data/poise-service-runit.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poise-service-runit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Kantrowitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: halite
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- ".kitchen.yml"
|
79
79
|
- ".travis.yml"
|
80
80
|
- Berksfile
|
81
|
+
- CHANGELOG.md
|
81
82
|
- Gemfile
|
82
83
|
- LICENSE
|
83
84
|
- README.md
|
@@ -116,7 +117,7 @@ homepage: https://github.com/poise/poise-service-runit
|
|
116
117
|
licenses:
|
117
118
|
- Apache 2.0
|
118
119
|
metadata:
|
119
|
-
halite_dependencies: runit ~> 1.
|
120
|
+
halite_dependencies: runit ~> 1.7
|
120
121
|
post_install_message:
|
121
122
|
rdoc_options: []
|
122
123
|
require_paths:
|
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
134
|
version: '0'
|
134
135
|
requirements: []
|
135
136
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.4.
|
137
|
+
rubygems_version: 2.4.8
|
137
138
|
signing_key:
|
138
139
|
specification_version: 4
|
139
140
|
summary: An extension for poise-service to support runit.
|