svcdeps_tasks 0.1.1 → 0.1.2

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: f8b2aceec2d807b5c7e6f0ba2dd1796df6678077
4
- data.tar.gz: 913382aae5842f71882d477ad0d4bba381616ecc
3
+ metadata.gz: 4f78dcaa1dab61d87a26dbc1cd3fc3df31fcc3db
4
+ data.tar.gz: 11bcc31a33db06e307e49f28aa4f708cbfaaeac5
5
5
  SHA512:
6
- metadata.gz: 7e06debbf45246022671f62ce6ed35d0218d5c2b51ef04cccb2e4c0375c6abf916cd868da815dba91a55084f220ea777a4d447c23b6704bd4d2615c494024070
7
- data.tar.gz: 7e4d560315e5c9bc09de05f91f4d9b243dfcf00fa1823fb6ea291ad4bdcb63904847fb5ba54f92d03146cce77f69048c6d839d4c902764c012fcd7779820b501
6
+ metadata.gz: eef4bf1f6cba9dc1f547f4686270b0353943b3670655c19ee080a65ef2149a7b2934ff93927a0c2b6f7bd9ea589a5b16d70c10d8b842b5e8b55eb601292fb472
7
+ data.tar.gz: 3035cdf760be29381b32eaf7b885708009d260164e5bc8c32c97b38fde07910f973bb3c3f632364e12a956576ef4e6beac3bed687896d9b4bac6464a39b46600
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- svcdeps_tasks (0.1.1)
4
+ svcdeps_tasks (0.1.2)
5
5
  deep_merge (~> 1.2)
6
6
  rspec (~> 3.7)
7
7
 
data/README.md CHANGED
@@ -2,15 +2,24 @@
2
2
 
3
3
  ### USAGE
4
4
 
5
- Add the following to Rakefile:
5
+ 1. Install the gem
6
+ ```bash
7
+ gem install svcdeps_tasks
8
+ ```
6
9
 
10
+ 2. Add the following to Rakefile:
7
11
  ```ruby
8
12
  require 'svcdeps_tasks'
9
13
 
10
14
  ENV['SVCDEPS_PATH'] = '/etc/svcdeps'
11
15
  ```
12
16
 
13
- And save yaml files describing how to check the service dependencies, like:
17
+ 3. Create a directory for dependencies manifests, `/ec/svcdeps` in our case:
18
+ ```bash
19
+ mkdir /etc/svcdeps
20
+ ```
21
+
22
+ 4. Create dependencies manifests, which are yaml files describing how to check the service dependencies:
14
23
 
15
24
  ```yaml
16
25
  deps:
@@ -34,13 +43,12 @@ deps:
34
43
  desc: Should be able to hit https://www.google.com
35
44
 
36
45
  - type: command
37
- run_as: nobody
38
46
  command: ping -c 1 8.8.8.8
39
47
  timeout: 2
40
48
  desc: Should be able to ping 8.8.8.8
41
49
  ```
42
50
 
43
- Running:
51
+ 5. Run:
44
52
 
45
53
  ```
46
54
  # rake spec:svcdeps
data/lib/probe.rb CHANGED
@@ -33,7 +33,6 @@ class Probe
33
33
  def command_probe
34
34
  cmd = @opts[:command]
35
35
  run_as = @opts[:run_as]
36
-
37
36
  if run_as.nil?
38
37
  run_as = 'nobody' if Process.uid.zero?
39
38
  else
@@ -42,7 +41,7 @@ class Probe
42
41
  end
43
42
 
44
43
  Timeout::timeout(@timeout) do
45
- user = Etc.getpwnam('nobody')
44
+ user = Etc.getpwnam(run_as)
46
45
  pid = Process.fork do
47
46
  STDOUT.reopen('/dev/null')
48
47
  STDERR.reopen('/dev/null')
data/lib/specfile.rb CHANGED
@@ -13,6 +13,8 @@ raise "Environment variable 'SVCDEPS_PATH' must be set" unless deps_dir
13
13
 
14
14
  Dir.chdir(deps_dir)
15
15
  Dir.glob(File.join('**','*.yaml')).each {|f| deps_files << "#{deps_dir}/#{f}" }
16
+ Dir.glob(File.join('**','*.yml')).each {|f| deps_files << "#{deps_dir}/#{f}" }
17
+
16
18
 
17
19
  def symbolize_keys(hash)
18
20
  hash.inject({}){|memo,(k,v)| memo[k.to_sym] = v ; memo }
@@ -29,5 +31,5 @@ describe 'Service Dependencies' do
29
31
  p = Probe.new( dep )
30
32
  expect { p.run }.to_not raise_error
31
33
  end
32
- end
34
+ end if deps['deps']
33
35
  end
@@ -1,3 +1,3 @@
1
1
  module SvcdepsTasks
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svcdeps_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Lopo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-02 00:00:00.000000000 Z
11
+ date: 2018-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec