Skip to content

Commit

Permalink
fix voxpupuli#254 use a tag to disable parsing for a single attribute…
Browse files Browse the repository at this point in the history
… value
  • Loading branch information
lbetz authored and n00by committed Apr 26, 2018
1 parent be87a1a commit b014c30
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/puppet_x/icinga2/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def self.attribute_types(attr)
def self.parse(row)
result = ''

# parser is disabled
if row =~ /^-:(.*)$/
return $1
end

# scan function
if row =~ /^\{{2}(.+)\}{2}$/
result += "{{%s}}" % [ $1 ]
Expand Down
16 changes: 16 additions & 0 deletions spec/defines/object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@
end


context "#{os} with attrs => { vars => { bar => unparsed string } }" do
let(:params) { {:attrs => { 'vars' => { 'bar' => '-:"unparsed string"' } }, :object_type => 'foo', :target => '/bar/baz', :order => '10'} }

it { is_expected.to contain_concat__fragment('bar')
.with_content(/vars.bar = "unparsed string"/) }
end


context "#{os} with attrs => { vars => { bar => {} } }" do
let(:params) { {:attrs => { 'vars' => { 'bar' => {} } }, :object_type => 'foo', :target => '/bar/baz', :order => '10'} }

Expand Down Expand Up @@ -447,6 +455,14 @@
end


context "Windows 2012 R2 with attrs => { vars => { bar => unparsed string } }" do
let(:params) { {:attrs => { 'vars' => { 'bar' => '-:"unparsed string"' } }, :object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} }

it { is_expected.to contain_concat__fragment('bar')
.with_content(/vars.bar = "unparsed string"/) }
end


context "Windows 2012 R2 with attrs => { vars => { bar => {} } }" do
let(:params) { {:attrs => { 'vars' => { 'bar' => {} } }, :object_type => 'foo', :target => 'C:/bar/baz', :order => '10'} }

Expand Down

0 comments on commit b014c30

Please sign in to comment.