Skip to content

Logging for unmanaged resources #204

Open
@DavidS

Description

@DavidS

Use Case

The Resource API should not make odious validations when using its formatting logging methods.

See also https://github.com/puppetlabs/puppet-specifications/blob/master/language/resource-api/README.md#logging-for-unmanaged-instances

Describe the Solution You Would Like

The formatting logging methods should not validate titles passed in. Instead any title (simple string, or composite namevar hash) should be accepted and properly rendered.

Additional Context

See the following code-locations for needing a fix.

raise "#{__method__} only accepts a single resource title" if title.respond_to?(:each)

raise "#{__method__} only accepts a single resource title" if title.respond_to?(:each)

def format_titles(titles)
if titles.length.zero? && !titles.is_a?(String)
@type.name
else
"#{@type.name}[#{[titles].flatten.compact.join(', ')}]"
end
end

This was originally https://tickets.puppetlabs.com/browse/PDK-534

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions