Skip to content

Commit

Permalink
Merge branch 'master' into enhancement/icingadb
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz authored Dec 12, 2022
2 parents 68ed065 + 78a4a48 commit 2c92615
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## [v3.4.1](https://github.com/icinga/puppet-icinga2/tree/v3.4.1) (2022-10-15)
[Full Changelog](https://github.com/icinga/puppet-icinga2/compare/v3.4.0...v3.4.1)

**Fixed bugs:**

- Object\#=~ is called on TrueClass [\#711](https://github.com/Icinga/puppet-icinga2/issues/711)

## [v3.4.0](https://github.com/icinga/puppet-icinga2/tree/v3.4.0) (2022-06-27)
[Full Changelog](https://github.com/icinga/puppet-icinga2/compare/v3.3.1...v3.4.0)

Expand Down
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5497,7 +5497,7 @@ The ticket salt of the Icinga CA.

Type: Puppet Language

This function parse icinga object attributes.
The icinga2::parse function.

#### `icinga2::parse(Hash[String, Any] $attrs, Integer $indent = 0, Array[String] $reserved = [], Hash[String, Any] $constants = {})`

Expand Down
3 changes: 3 additions & 0 deletions functions/parse.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# @summary
# This function parse icinga object attributes.

# @return
# The parsed string.
#
# @return
# The parsed string.
Expand Down
7 changes: 4 additions & 3 deletions lib/puppet_x/icinga2/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,14 @@ def self.attribute_types(attr)
end

def self.parse(row)
row = row.to_s
result = ''

# parser is disabled
if row =~ %r{^-:(.*)$}m
return Regexp.last_match(1)
end

if row =~ %r{^\{{2}(.+)\}{2}$}m
# scan function
result += '{{%{expr}}}' % { expr: Regexp.last_match(1) }
Expand Down Expand Up @@ -275,7 +276,7 @@ def self.process_hash(attrs, indent = 2, level = 3, prefix = ' ' * indent)
end
else
# String: attr = '+ value' -> attr += 'value'
if value =~ %r{^([\+,-])\s+}
if value.to_s =~ %r{^([\+,-])\s+}
operator = "#{Regexp.last_match(1)}="
value = value.sub(%r{^[\+,-]\s+}, '')
else
Expand Down Expand Up @@ -348,7 +349,7 @@ def self.attributes(attrs, globals, consts, indent = 2)
elsif value.is_a?(Array)
op = value.delete_at(0) if value[0] == '+' || value[0] == '-'
"%{ind}%{att} #{op}= [ %{lst}]\n" % { ind: ' ' * indent, att: attr, lst: process_array(value) }
elsif value =~ %r{^([\+,-])\s+}
elsif value.to_s =~ %r{^([\+,-])\s+}
# String: attr = '+ config' -> attr += config
"%{ind}%{att} #{Regexp.last_match(1)}= %{expr}\n" % { ind: ' ' * indent, att: attr, expr: parse(value.sub(%r{^[\+,-]\s+}, '')) }
else
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "icinga-icinga2",
"version": "3.4.0",
"version": "3.4.1",
"author": "Icinga Development Team",
"summary": "Icinga 2 Puppet Module",
"license": "Apache-2.0",
Expand Down

0 comments on commit 2c92615

Please sign in to comment.