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: b917fa5a57a4eb4c245bc85365b75b5bc3788cae
4
- data.tar.gz: 7a88c8f76e74a88bdbe8c94eb07e1cbd969120d4
3
+ metadata.gz: d3d10df2c7b071d4eece86403d9dc3be7304912c
4
+ data.tar.gz: 362c74abd1317fec6059adda1beb9cdb8d15b83f
5
5
  SHA512:
6
- metadata.gz: 2c86ee28f8422c7760ebb1a4ec6cc14b1a3c3757b19d4baf816fba5ce8d94dcf81d9f5dd4772bb9f6ddbe62f56e00060003f2e12041e1ba56bfa47fd1c01fce3
7
- data.tar.gz: 1f37dfff9a06eb572fff46635e6fbaa7635c457a9fea195425fee13bf26399b52f4a739a41d44b5be2b0241d2fab901f7a78a62e17cd4f925dd0a0d343238651
6
+ metadata.gz: 482039af7d12eb4f5f8d81bf0a66c5e73a31f96308af6a45ac3d908a44d32f18a58b7212bc3783e8d524f2695b624ff907c27f35def76c2a82e6d322b8fe5183
7
+ data.tar.gz: 0b97e49d87015c71666f8b3497b69065b2c7e83e06dd8cb8bc7840095a3548b4f51330fdf1f419618c43b63657ff45ac7df25b1279dee4be064374e6bea0bae4
@@ -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/embedded/sv'
7
- SERVICE_DIR = '/opt/chef/embedded/service'
7
+ SV_DIR = '/opt/chef/sv'
8
+ SERVICE_DIR = '/opt/chef/service'
8
9
  end
9
10
  end
10
11
  end
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  module Container
3
- VERSION = "0.0.2-dev8"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -72,11 +72,14 @@ class Chef
72
72
  end
73
73
 
74
74
  def run_script_content
75
- "#!/bin/sh\nexec #{new_resource.command} 2&>1"
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\nexec svlogd -tt /var/log/#{new_resource.service_name}"
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
- shell_out!("#{Chef::Container::Runit::SV_BIN} start #{sv_dir_name}")
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 #{sv_dir_name}")
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 #{sv_dir_name}")
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 #{sv_dir_name}")
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 #{sv_dir_name}")
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.2.pre.dev8
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-16 00:00:00.000000000 Z
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: 1.3.1
99
+ version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
102
  rubygems_version: 2.2.2