hookit 0.9.0 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hookit/logger.rb +2 -0
- data/lib/hookit/resource/mount.rb +18 -3
- data/lib/hookit/resource/service.rb +4 -4
- data/lib/hookit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5c3f231b006d73bcced104ed279d8badd17ae9d
|
4
|
+
data.tar.gz: 4f31cb12066a30328060d4d967c8d17ffafbb774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b57bc696382a86fd72e81acb87875787c0fbe9c80b0d8019b242544c31c9cdf16f7ced569532949e3ff018fe73e783b0d13f154c2d8b9a0c5a499240dfcb3060
|
7
|
+
data.tar.gz: d8fb49dc30e0f57b09d48117094979bd8caec876a7445ce82597480ae3c0c940f6185962358c015f5eb10f88a82da4e64411c9a580d327545f503efaa1d1241e
|
data/lib/hookit/logger.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
module Hookit
|
2
2
|
class Logger
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
5
|
attr_reader :log_file, :log_level
|
5
6
|
|
6
7
|
def initialize(file, level)
|
7
8
|
@log_file = file || '/var/log/hookit/hookit.log'
|
8
9
|
@log_level = level || :error
|
10
|
+
::FileUtils.mkdir_p(File.dirname(@log_file))
|
9
11
|
end
|
10
12
|
|
11
13
|
def log(level, message)
|
@@ -41,7 +41,12 @@ module Hookit
|
|
41
41
|
|
42
42
|
def mount!
|
43
43
|
::FileUtils.mkdir_p(mount_point)
|
44
|
-
|
44
|
+
case platform.name
|
45
|
+
when 'smartos'
|
46
|
+
run_command! "mount -O -F #{fstype} -o retry=5,timeo=300 #{options!(as_arg=true)} #{device} #{mount_point}"
|
47
|
+
when 'ubuntu'
|
48
|
+
run_command! "mount -t #{fstype} -o retry=5,timeo=300 #{options!(as_arg=true)} #{device} #{mount_point}"
|
49
|
+
end
|
45
50
|
end
|
46
51
|
|
47
52
|
def umount!
|
@@ -50,11 +55,21 @@ module Hookit
|
|
50
55
|
|
51
56
|
def enable!
|
52
57
|
entry = "#{device}\t#{device =~ /^\/dev/ ? device : "-"}\t#{mount_point}\t#{fstype}\t#{pass}\tyes\t#{options!}"
|
53
|
-
|
58
|
+
case platform.name
|
59
|
+
when 'smartos'
|
60
|
+
`echo "#{entry}" >> /etc/vfstab`
|
61
|
+
when 'ubuntu'
|
62
|
+
`echo "#{entry}" >> /etc/fstab`
|
63
|
+
end
|
54
64
|
end
|
55
65
|
|
56
66
|
def disable!
|
57
|
-
|
67
|
+
case platform.name
|
68
|
+
when 'smartos'
|
69
|
+
`egrep -v "#{device}.*#{mount_point}" /etc/vfstab > /tmp/vfstab.tmp; mv -f /tmp/vfstab.tmp /etc/vfstab`
|
70
|
+
when 'ubuntu'
|
71
|
+
`egrep -v "#{device}.*#{mount_point}" /etc/fstab > /tmp/vfstab.tmp; mv -f /tmp/vfstab.tmp /etc/vfstab`
|
72
|
+
end
|
58
73
|
end
|
59
74
|
|
60
75
|
def options!(as_arg=false)
|
@@ -49,7 +49,7 @@ module Hookit
|
|
49
49
|
when :runit
|
50
50
|
run_command! "sv start #{service_name}"
|
51
51
|
else
|
52
|
-
Hookit::Error::UnsupportedOption
|
52
|
+
Hookit::Error::UnsupportedOption "Unsupported init schema '#{init}'"
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -60,7 +60,7 @@ module Hookit
|
|
60
60
|
when :runit
|
61
61
|
run_command! "sv stop #{service_name}"
|
62
62
|
else
|
63
|
-
Hookit::Error::UnsupportedOption
|
63
|
+
Hookit::Error::UnsupportedOption "Unsupported init schema '#{init}'"
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -71,7 +71,7 @@ module Hookit
|
|
71
71
|
when :runit
|
72
72
|
disable!; enable!
|
73
73
|
else
|
74
|
-
Hookit::Error::UnsupportedOption
|
74
|
+
Hookit::Error::UnsupportedOption "Unsupported init schema '#{init}'"
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -80,7 +80,7 @@ module Hookit
|
|
80
80
|
when :smf
|
81
81
|
run_command! "svcadm refresh #{service_name}"
|
82
82
|
else
|
83
|
-
Hookit::Error::UnsupportedOption
|
83
|
+
Hookit::Error::UnsupportedOption "Unsupported init schema '#{init}'"
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
data/lib/hookit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hookit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Flint
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tilt
|