chef-container 0.0.2.pre.dev2 → 0.0.2.pre.dev4

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: 10085099c619b210b6a938b668558020e7a206b5
4
- data.tar.gz: 75cfd4f7254929ed475efbdca261d59f18485bb2
3
+ metadata.gz: 838894583d23c9ba150b4c3df093dcc49761cb13
4
+ data.tar.gz: 6da49bd76cac3a52cdbe4b1be447ee41bad80c01
5
5
  SHA512:
6
- metadata.gz: b120529e92fd0ec02f2d57c2cde9a903392c199ad31c66126c598e5fb872b3cc953f950a1b5d8fc345d2102e69bffc53720d8d06d511240e0e721976ca63d90d
7
- data.tar.gz: bdddc004dda0e3dbbce45b7dc90562749b16831e9426152d3b2de58e88eb57d85a0688821344caa9ff56b5d1c0d4c43ddea8f8cecb2cda0d8b281dc932804e5d
6
+ metadata.gz: 1fe20cb8e05149858b31e37ff2d8504932d6099f1e7fa6cfe247f8b8906567d0f76a4e4959bcdfc91ce1738f7220f417c5a85aa64b2813c9ba72b9fe0714bcf7
7
+ data.tar.gz: 6c307306a8912e068978c462590626e252c3ce1957628d4b738186efdcae5e788b787cd49d5a9d885434d9788caf0e47bba1f3ba3bca191020e1e84c04f4cac8
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  module Container
3
- VERSION = "0.0.2-dev2"
3
+ VERSION = "0.0.2-dev4"
4
4
  end
5
5
  end
@@ -33,6 +33,23 @@ class Chef
33
33
  super
34
34
  end
35
35
 
36
+ def load_current_resource
37
+ @current_resource = Chef::Resource::RunitService.new(new_resource.name)
38
+ @current_resource.service_name(new_resource.service_name)
39
+
40
+ Chef::Log.debug("Checking status of service #{new_resource.service_name}")
41
+
42
+ # verify Runit was installed properly
43
+ unless ::File.exist?(Chef::Container::Runit::SV_BIN) && ::File.executable?(Chef::Container::Runit::SV_BIN)
44
+ no_runit_message = "Could not locate main runit sv_bin at \"#{Chef::Container::Runit::SV_BIN}\"."
45
+ fail no_runit_message
46
+ end
47
+
48
+ @current_resource.running(running?)
49
+ @current_resource.enabled(enabled?)
50
+ @current_resource
51
+ end
52
+
36
53
  #
37
54
  # Override Service Actions
38
55
  #
@@ -77,6 +94,15 @@ class Chef
77
94
  end
78
95
 
79
96
 
97
+ def running?
98
+ cmd = shell_out("#{Chef::Container::Runit::SV_BIN} status #{service_dir_name}")
99
+ (cmd.stdout =~ /^run:/ && cmd.exitstatus == 0)
100
+ end
101
+
102
+ def enabled?
103
+ ::File.exists?(::File.join(service_dir_name, 'run'))
104
+ end
105
+
80
106
  #
81
107
  # Helper Resource Methods
82
108
  #
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.dev2
4
+ version: 0.0.2.pre.dev4
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-15 00:00:00.000000000 Z
11
+ date: 2014-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef