Add support for binary data in /proc/self on Illumos, see
https://github.com/puppetlabs/facter/pull/249. Bump PKGREVISION.
This commit is contained in:
parent
21477b67f3
commit
98fff0ad85
4 changed files with 64 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.15 2012/06/14 15:16:07 taca Exp $
|
||||
# $NetBSD: Makefile,v 1.16 2012/08/02 08:36:40 fhajny Exp $
|
||||
|
||||
DISTNAME= facter-1.6.10
|
||||
PKGNAME= ${RUBY_PKGPREFIX}-${DISTNAME}
|
||||
PKGREVISION= 1
|
||||
CATEGORIES= sysutils
|
||||
|
||||
MAINTAINER= tonnerre@NetBSD.org
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
$NetBSD: distinfo,v 1.14 2012/06/14 15:16:07 taca Exp $
|
||||
$NetBSD: distinfo,v 1.15 2012/08/02 08:36:40 fhajny Exp $
|
||||
|
||||
SHA1 (facter-1.6.10.gem) = f6a547a343a263c3acdfbc2780f4209b3305c957
|
||||
RMD160 (facter-1.6.10.gem) = 7f1688c6657d45dad542c784b886bc6be67c69d0
|
||||
Size (facter-1.6.10.gem) = 130560 bytes
|
||||
SHA1 (patch-lib_facter_util_virtual.rb) = 9c15ed5019485a4ef4b0dbfca9e0f6a56d322d12
|
||||
SHA1 (patch-spec_unit_util__virtual_spec.rb) = 074499fd2d58be48f8ab9bb4a932a56e8a5f0b1f
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
$NetBSD: patch-lib_facter_util_virtual.rb,v 1.1 2012/08/02 08:36:40 fhajny Exp $
|
||||
|
||||
Add support for Illumos, as per https://github.com/puppetlabs/facter/pull/249
|
||||
--- lib/facter/util/virtual.rb.orig 2012-08-01 12:08:54.829488784 +0000
|
||||
+++ lib/facter/util/virtual.rb
|
||||
@@ -31,7 +31,7 @@ module Facter::Util::Virtual
|
||||
|
||||
def self.vserver?
|
||||
return false unless FileTest.exists?("/proc/self/status")
|
||||
- txt = File.read("/proc/self/status")
|
||||
+ txt = File.open("/proc/self/status", "rb").read
|
||||
return true if txt =~ /^(s_context|VxID):[[:blank:]]*[0-9]/
|
||||
return false
|
||||
end
|
|
@ -0,0 +1,45 @@
|
|||
$NetBSD: patch-spec_unit_util__virtual_spec.rb,v 1.1 2012/08/02 08:36:40 fhajny Exp $
|
||||
|
||||
Add support for Illumos, as per https://github.com/puppetlabs/facter/pull/249
|
||||
--- spec/unit/util/virtual_spec.rb.orig 2012-08-01 12:08:54.859082399 +0000
|
||||
+++ spec/unit/util/virtual_spec.rb
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
require 'facter/util/virtual'
|
||||
+require 'stringio'
|
||||
|
||||
describe Facter::Util::Virtual do
|
||||
|
||||
@@ -64,19 +65,19 @@ describe Facter::Util::Virtual do
|
||||
|
||||
it "should detect vserver when vxid present in process status" do
|
||||
FileTest.stubs(:exists?).with("/proc/self/status").returns(true)
|
||||
- File.stubs(:read).with("/proc/self/status").returns("VxID: 42\n")
|
||||
+ File.stubs(:open).with("/proc/self/status", "rb").returns(StringIO.new("VxID: 42\n"))
|
||||
Facter::Util::Virtual.should be_vserver
|
||||
end
|
||||
|
||||
it "should detect vserver when s_context present in process status" do
|
||||
FileTest.stubs(:exists?).with("/proc/self/status").returns(true)
|
||||
- File.stubs(:read).with("/proc/self/status").returns("s_context: 42\n")
|
||||
+ File.stubs(:open).with("/proc/self/status", "rb").returns(StringIO.new("s_context: 42\n"))
|
||||
Facter::Util::Virtual.should be_vserver
|
||||
end
|
||||
|
||||
it "should not detect vserver when vserver flags not present in process status" do
|
||||
FileTest.stubs(:exists?).with("/proc/self/status").returns(true)
|
||||
- File.stubs(:read).with("/proc/self/status").returns("wibble: 42\n")
|
||||
+ File.stubs(:open).with("/proc/self/status", "rb").returns(StringIO.new("wibble: 42\n"))
|
||||
Facter::Util::Virtual.should_not be_vserver
|
||||
end
|
||||
|
||||
@@ -94,7 +95,7 @@ describe Facter::Util::Virtual do
|
||||
it "should detect vserver as #{expected.inspect}" do
|
||||
status = File.read(status_file)
|
||||
FileTest.stubs(:exists?).with("/proc/self/status").returns(true)
|
||||
- File.stubs(:read).with("/proc/self/status").returns(status)
|
||||
+ File.stubs(:open).with("/proc/self/status", "rb").returns(StringIO.new(status))
|
||||
Facter::Util::Virtual.vserver?.should == expected
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue