specinfra 1.9.0 → 1.10.0

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: 4eeb384bd812671cb87c1f274afddb397675c6e1
4
- data.tar.gz: 487011418240f72292df698c40a1831ff7791ff9
3
+ metadata.gz: 70f7556e9dcace36186080224bef836c802b3fcf
4
+ data.tar.gz: ae8e0d6ece4a05af3cf412d192e2037f2d2560c3
5
5
  SHA512:
6
- metadata.gz: f7390e25288b043c110fdc3d4457f8ef954295ed328fc92323c90f61612eb4327aa55b9faaa5cc5354c5c084b5927b89573ebba93c190876b12703f877e9b336
7
- data.tar.gz: 19f3f6388cd7eb6479efd3393d717ffd02791c1b234a53f74634c253430d99e286aa461208fc06cea0ff7be44eb3fcb04f4f2c5b8095dd919dbb431263bfa8c4
6
+ metadata.gz: 407b914ed6cac6229abef08620af2f46e03742bc8ff3ea4a06710b6576af9a64f77844ac31ab51787b7e77d65b9b37f0d0849ec24fa52004bcab03f41b131188
7
+ data.tar.gz: 48b97124a501b9b53b1ea54f6713b6414aef318da473a2fa09d090a09744e8c5a9165963c063620ee5d841bd6557abd890c16a46e01c41b2e75134e8c82cfce1
@@ -181,12 +181,24 @@ module SpecInfra
181
181
 
182
182
  def check_os
183
183
  return SpecInfra.configuration.os if SpecInfra.configuration.os
184
- if run_command('ls /etc/redhat-release').success?
184
+ # Fedora also has an /etc/redhat-release so the Fedora check must
185
+ # come before the RedHat check
186
+ if run_command('ls /etc/fedora-release').success?
187
+ line = run_command('cat /etc/redhat-release').stdout
188
+ if line =~ /release (\d[\d]*)/
189
+ release = $1
190
+ end
191
+ { :family => 'Fedora', :release => release }
192
+ elsif run_command('ls /etc/redhat-release').success?
185
193
  line = run_command('cat /etc/redhat-release').stdout
186
194
  if line =~ /release (\d[\d.]*)/
187
195
  release = $1
188
196
  end
189
- { :family => 'RedHat', :release => release }
197
+ if release =~ /7./
198
+ { :family => 'RedHat7', :release => release }
199
+ else
200
+ { :family => 'RedHat', :release => release }
201
+ end
190
202
  elsif run_command('ls /etc/system-release').success?
191
203
  { :family => 'RedHat', :release => nil } # Amazon Linux
192
204
  elsif run_command('ls /etc/SuSE-release').success?
@@ -0,0 +1,29 @@
1
+ module SpecInfra
2
+ module Command
3
+ class Fedora < RedHat
4
+ def check_enabled(service, target="multi-user.target")
5
+ host = SpecInfra.configuration.ssh ? SpecInfra.configuration.ssh.host : 'localhost'
6
+ if property.has_key?(:os_by_host) && property[:os_by_host][host][:release].to_i < 15
7
+ super
8
+ else
9
+ # Fedora 15+ uses systemd which no longer has runlevels but targets
10
+ # For backwards compatibility, Fedora provides pseudo targets for
11
+ # runlevels
12
+ if target.is_a? Integer
13
+ target = "runlevel#{target}.target"
14
+ end
15
+ "systemctl --plain list-dependencies #{target} | grep '^#{escape(service)}.service$'"
16
+ end
17
+ end
18
+
19
+ def check_running(service)
20
+ host = SpecInfra.configuration.ssh ? SpecInfra.configuration.ssh.host : 'localhost'
21
+ if property.has_key?(:os_by_host) && property[:os_by_host][host][:release].to_i < 15
22
+ super
23
+ else
24
+ "systemctl is-active #{escape(service)}.service"
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ module SpecInfra
2
+ module Command
3
+ class RedHat7 < RedHat
4
+ def check_enabled(service, level=3)
5
+ "systemctl --plain list-dependencies runlevel#{level}.target | grep '^#{escape(service)}.service$'"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -8,7 +8,9 @@ require "specinfra/command/ubuntu"
8
8
  require "specinfra/command/gentoo"
9
9
  require "specinfra/command/plamo"
10
10
  require "specinfra/command/redhat"
11
+ require "specinfra/command/redhat7"
11
12
  require "specinfra/command/suse"
13
+ require "specinfra/command/fedora"
12
14
 
13
15
  # Solaris
14
16
  require "specinfra/command/solaris"
@@ -6,12 +6,14 @@ module SpecInfra
6
6
  'Arch',
7
7
  'Darwin',
8
8
  'Debian',
9
+ 'Fedora',
9
10
  'FreeBSD',
10
11
  'FreeBSD10',
11
12
  'Gentoo',
12
13
  'OpenBSD',
13
14
  'Plamo',
14
15
  'RedHat',
16
+ 'RedHat7',
15
17
  'SuSE',
16
18
  'SmartOS',
17
19
  'Solaris',
@@ -1,3 +1,3 @@
1
1
  module SpecInfra
2
- VERSION = "1.9.0"
2
+ VERSION = "1.10.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.9.0
4
+ version: 1.10.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-05-06 00:00:00.000000000 Z
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,6 +125,7 @@ files:
125
125
  - lib/specinfra/command/base.rb
126
126
  - lib/specinfra/command/darwin.rb
127
127
  - lib/specinfra/command/debian.rb
128
+ - lib/specinfra/command/fedora.rb
128
129
  - lib/specinfra/command/freebsd.rb
129
130
  - lib/specinfra/command/freebsd10.rb
130
131
  - lib/specinfra/command/gentoo.rb
@@ -132,6 +133,7 @@ files:
132
133
  - lib/specinfra/command/openbsd.rb
133
134
  - lib/specinfra/command/plamo.rb
134
135
  - lib/specinfra/command/redhat.rb
136
+ - lib/specinfra/command/redhat7.rb
135
137
  - lib/specinfra/command/smartos.rb
136
138
  - lib/specinfra/command/solaris.rb
137
139
  - lib/specinfra/command/solaris10.rb