specinfra 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9d36561ba5c3bec832fa2088e7eaa25f0da4edd
4
- data.tar.gz: 6e2a9f7498671b0a7c0cfb87cd82e0900dea92ba
3
+ metadata.gz: b548e8f643d9527287040b11a7599cc51c56d57f
4
+ data.tar.gz: b169d8328b68007758c12d6f8af34db7e98ed627
5
5
  SHA512:
6
- metadata.gz: 0a1eed7f15f4e770955e3957265c5009615f6b786691057e441b4e797abb98e69fca75a876814f551d06957e09a5c7b22707e308cd2dd6f4d88560db9d865725
7
- data.tar.gz: 1a01e0781977ce32a18ace566a8a5eb6d3a8db3cedc0293df8a8e4d75ac34418b1036df1a28853949729de9d5d8c605dec54578566a0fc3cbf7b52944f08bd02
6
+ metadata.gz: a438b642d651c0d743cdcb8bb5f6a220610ee83021a2b0e9dfc1d57294f235caf658cfec17dc645679d62c2c872f278576e3d8999dfac138676dfeb788f79386
7
+ data.tar.gz: ee4fcf7d5284b9fa305fa45e4c53e0c61ef372a6f57256417b7909111e9f73357546a746d8514c31bc8e6aa18e046b930281ee91443451ddc590e3f8b8de1574
@@ -235,6 +235,8 @@ module SpecInfra
235
235
  end
236
236
  elsif run_command('uname -sr').stdout =~ /Arch/i
237
237
  { :family => 'Arch', :release => nil }
238
+ elsif run_command('uname -s').stdout =~ /OpenBSD/i
239
+ { :family => 'OpenBSD', :release => nil }
238
240
  else
239
241
  { :family => 'Base', :release => nil }
240
242
  end
@@ -78,7 +78,6 @@ module SpecInfra
78
78
 
79
79
  channel.on_extended_data do |ch, type, data|
80
80
  if data.match /you must have a tty to run sudo/
81
- puts data
82
81
  abort 'Please set "SpecInfra.configuration.request_pty = true" or "c.request_pty = true" in your spec_helper.rb or other appropreate file.'
83
82
  end
84
83
 
@@ -0,0 +1,77 @@
1
+ module SpecInfra
2
+ module Command
3
+ class OpenBSD < Base
4
+ def check_enabled(service, level=3)
5
+ "egrep '(#{escape(service)}_flags=|^pkg_scripts=\"(.*)#{escape(service)}(.*)\")' /etc/rc.conf.local | grep -v \=NO"
6
+ end
7
+
8
+ def check_file_md5checksum(file, expected)
9
+ regexp = "^#{expected}"
10
+ "cksum -qa md5 #{escape(file)} | grep -w #{escape(regexp)}"
11
+ end
12
+
13
+ def check_file_sha256checksum(file, expected)
14
+ regexp = "^#{expected}"
15
+ "cksum -qa sha256 #{escape(file)} | grep -w #{escape(regexp)}"
16
+ end
17
+
18
+ def check_login_shell(user, path_to_shell)
19
+ "getent passwd #{escape(user)} | cut -f 7 -d ':' | grep #{escape(path_to_shell)}"
20
+ end
21
+
22
+ def check_home_directory(user, path_to_home)
23
+ "getent passwd #{escape(user)} | cut -f 6 -d ':' | grep #{escape(path_to_home)}"
24
+ end
25
+
26
+ def check_installed(package, version=nil)
27
+ if version
28
+ "pkg_info -a | cut -d ' ' -f 1 | grep #{escape(package)}-#{escape(version)}"
29
+ else
30
+ "pkg_info -a | cut -d ' ' -f 1 | grep #{escape(package)}"
31
+ end
32
+ end
33
+
34
+ def get_interface_speed_of(name)
35
+ "ifconfig #{name} | grep 'media\:' | perl -pe 's|.*media\:.*\\((.*?)\\)|\\1|'"
36
+ end
37
+
38
+ def check_ipv4_address(interface, ip_address)
39
+ "ifconfig #{interface} | grep -w inet | cut -d ' ' -f 2"
40
+ end
41
+
42
+ def check_listening(port)
43
+ "netstat -nat -f inet | egrep '((tcp|udp).*\.#{port}.*LISTEN$)'"
44
+ end
45
+
46
+ def check_mail_alias(recipient, target)
47
+ "egrep '^#{escape(recipient)}:.*#{escape(target)}' /etc/mail/aliases"
48
+ end
49
+
50
+ def check_mode(file, mode)
51
+ regexp = "^#{mode}$"
52
+ "stat -f%Lp #{escape(file)} | grep #{escape(regexp)}"
53
+ end
54
+
55
+ def check_mounted(path)
56
+ regexp = "on #{path} "
57
+ "mount | grep #{escape(regexp)}"
58
+ end
59
+
60
+ # def check_routing_table(destination)
61
+ # "route -n show -gateway | egrep '(^default|#{destination})' | head -1"
62
+ # end
63
+
64
+ def check_running(service)
65
+ "/etc/rc.d/#{escape(service)} status"
66
+ end
67
+
68
+ def get_mode(file)
69
+ "stat -f%Lp #{escape(file)}"
70
+ end
71
+
72
+ def install(package)
73
+ "pkg_add #{package}"
74
+ end
75
+ end
76
+ end
77
+ end
@@ -21,4 +21,5 @@ require "specinfra/command/aix"
21
21
  require "specinfra/command/darwin"
22
22
  require "specinfra/command/freebsd"
23
23
  require "specinfra/command/freebsd10"
24
+ require "specinfra/command/openbsd"
24
25
  require "specinfra/command/windows"
@@ -9,6 +9,7 @@ module SpecInfra
9
9
  'FreeBSD',
10
10
  'FreeBSD10',
11
11
  'Gentoo',
12
+ 'OpenBSD',
12
13
  'Plamo',
13
14
  'RedHat',
14
15
  'SuSE',
@@ -1,3 +1,3 @@
1
1
  module SpecInfra
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-19 00:00:00.000000000 Z
11
+ date: 2014-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,6 +128,7 @@ files:
128
128
  - lib/specinfra/command/freebsd10.rb
129
129
  - lib/specinfra/command/gentoo.rb
130
130
  - lib/specinfra/command/linux.rb
131
+ - lib/specinfra/command/openbsd.rb
131
132
  - lib/specinfra/command/plamo.rb
132
133
  - lib/specinfra/command/redhat.rb
133
134
  - lib/specinfra/command/smartos.rb