chef-container 0.1.0 → 0.1.1

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: d3d10df2c7b071d4eece86403d9dc3be7304912c
4
- data.tar.gz: 362c74abd1317fec6059adda1beb9cdb8d15b83f
3
+ metadata.gz: 82bc1bcdeba795d1a39aca62bc28bc36e001655a
4
+ data.tar.gz: dbcbe47207290a73c98ac994c24b57f415688491
5
5
  SHA512:
6
- metadata.gz: 482039af7d12eb4f5f8d81bf0a66c5e73a31f96308af6a45ac3d908a44d32f18a58b7212bc3783e8d524f2695b624ff907c27f35def76c2a82e6d322b8fe5183
7
- data.tar.gz: 0b97e49d87015c71666f8b3497b69065b2c7e83e06dd8cb8bc7840095a3548b4f51330fdf1f419618c43b63657ff45ac7df25b1279dee4be064374e6bea0bae4
6
+ metadata.gz: 8c4d6ad5f9f60b8a560ce237684066c35b2f66352f69cae7efd338f891963fecd7ca82bdf4de2a4c447c72af4f56dea2d4e31c06ef0c171a4145503ac8075ee5
7
+ data.tar.gz: 232ae2343b256746a081f64d59811b54101f7ed8748843f38453a9e2722615ad2d48cafcdf69331517b3c967646e77a3ea1193948f7e5d3b58e7c41d0ea33f95
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  module Container
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -33,6 +33,7 @@ class Chef
33
33
  def initialize(*args)
34
34
  super
35
35
  @service_link = nil
36
+ @service_endpoint = sv_dir_name
36
37
  @new_resource.supports[:status] = true
37
38
  end
38
39
 
@@ -60,6 +61,7 @@ class Chef
60
61
  def enable_service
61
62
  Chef::Log.debug("Creating symlink in service_dir for #{new_resource.service_name}")
62
63
  service_link.run_action(:create)
64
+ @service_endpoint = service_dir_name
63
65
 
64
66
  Chef::Log.debug("waiting until named pipe #{service_dir_name}/supervise/ok exists.")
65
67
  until ::FileTest.pipe?("#{service_dir_name}/supervise/ok")
@@ -75,35 +77,34 @@ class Chef
75
77
  end
76
78
 
77
79
  def disable_service
78
- shell_out("#{Chef::Container::Runit::SV_BIN} down #{sv_dir_name}")
80
+ shell_out("#{Chef::Container::Runit::SV_BIN} down #{service_dir_name}")
79
81
  Chef::Log.debug("#{new_resource} down")
80
82
  FileUtils.rm(service_dir_name)
81
83
  Chef::Log.debug("#{new_resource} service symlink removed")
82
84
  end
83
85
 
84
86
  def start_service
85
- if ::File.exists?(service_dir_name)
86
- shell_out!("#{Chef::Container::Runit::SV_BIN} start #{service_dir_name}")
87
+ if enabled?
88
+ shell_out!("#{Chef::Container::Runit::SV_BIN} start #{@service_endpoint}")
87
89
  else
88
- service_link.run_action(:create)
89
- shell_out!("#{Chef::Container::Runit::RUNSV_BIN} #{service_dir_name} &")
90
+ shell_out!("#{Chef::Container::Runit::RUNSV_BIN} #{@service_endpoint} &")
90
91
  end
91
92
  end
92
93
 
93
94
  def stop_service
94
- shell_out!("#{Chef::Container::Runit::SV_BIN} stop #{service_dir_name}")
95
+ shell_out!("#{Chef::Container::Runit::SV_BIN} stop #{@service_endpoint}")
95
96
  end
96
97
 
97
98
  def restart_service
98
- shell_out!("#{Chef::Container::Runit::SV_BIN} restart #{service_dir_name}")
99
+ shell_out!("#{Chef::Container::Runit::SV_BIN} restart #{@service_endpoint}")
99
100
  end
100
101
 
101
102
  def reload_service
102
- shell_out!("#{Chef::Container::Runit::SV_BIN} force-reload #{service_dir_name}")
103
+ shell_out!("#{Chef::Container::Runit::SV_BIN} force-reload #{@service_endpoint}")
103
104
  end
104
105
 
105
106
  def running?
106
- cmd = shell_out("#{Chef::Container::Runit::SV_BIN} status #{service_dir_name}")
107
+ cmd = shell_out("#{Chef::Container::Runit::SV_BIN} status #{@service_endpoint}")
107
108
  (cmd.stdout =~ /^run:/ && cmd.exitstatus == 0)
108
109
  end
109
110
 
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.1.0
4
+ version: 0.1.1
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-19 00:00:00.000000000 Z
11
+ date: 2014-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef