Skip to content

How to get the content of a rendered .erb template as a string? #778

@enricovianello

Description

@enricovianello

I have a resource which creates an XML file via an erb template and I'd like to test its content via XPath. I found Nokogiri library and it works but I need to access the content of the rendered file as a string.

I tried:

content = catalogue.resource('file', '/path/to/file.xml').send(:parameters)[:content]

but I get:

undefined method `parameters' for nil:NilClass

My puppet version is 5.5.17.
Is there an alternative way to access the content of a rendered .erb template as a string?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions