Skip to content

Commit

Permalink
Move POptionalType handling close to where it is used
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidS committed May 22, 2018
1 parent 62222e1 commit c42df5e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/puppet/resource_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,16 @@ def insync?(is)
end
end

if type.instance_of? Puppet::Pops::Types::POptionalType
type = type.type
end

# puppet symbolizes some values through puppet/parameter/value.rb (see .convert()), but (especially) Enums
# are strings. specifying a munge block here skips the value_collection fallback in puppet/parameter.rb's
# default .unsafe_munge() implementation.
munge { |v| v }

# provide hints to `puppet type generate` for better parsing
if type.instance_of? Puppet::Pops::Types::POptionalType
type = type.type
end

case type
when Puppet::Pops::Types::PStringType
# require any string value
Expand Down

0 comments on commit c42df5e

Please sign in to comment.