File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ def fact_type(file)
40
40
41
41
def txt_parser ( file )
42
42
File . readlines ( file ) . each do |line |
43
- if line =~ /^(. +)=(.+)$/
43
+ if line =~ /^([^=] +)=(.+)$/
44
44
var = $1; val = $2
45
45
46
46
Facter . add ( var ) do
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+ require 'facter/facter_dot_d'
3
+
4
+ describe Facter ::Util ::DotD do
5
+
6
+ context 'returns a simple fact' do
7
+ before :each do
8
+ Facter . stubs ( :version ) . returns ( '1.6.1' )
9
+ subject . stubs ( :entries ) . returns ( [ '/etc/facter/facts.d/fake_fact.txt' ] )
10
+ File . stubs ( :readlines ) . with ( '/etc/facter/facts.d/fake_fact.txt' ) . returns ( [ 'fake_fact=fake fact' ] )
11
+ subject . create
12
+ end
13
+
14
+ it 'should return successfully' do
15
+ Facter . fact ( :fake_fact ) . value . should == 'fake fact'
16
+ end
17
+ end
18
+
19
+ context 'returns a fact with equals signs' do
20
+ before :each do
21
+ Facter . stubs ( :version ) . returns ( '1.6.1' )
22
+ subject . stubs ( :entries ) . returns ( [ '/etc/facter/facts.d/foo.txt' ] )
23
+ File . stubs ( :readlines ) . with ( '/etc/facter/facts.d/foo.txt' ) . returns ( [ 'foo=1+1=2' ] )
24
+ subject . create
25
+ end
26
+
27
+ it 'should return successfully' do
28
+ Facter . fact ( :foo ) . value . should == '1+1=2'
29
+ end
30
+ end
31
+ end
You can’t perform that action at this time.
0 commit comments