Jira (PUP-10270) Allow testing for data types with defined()

8 views
Skip to first unread message

Matthias Baur (JIRA)

unread,
Feb 6, 2020, 6:00:05 AM2/6/20
to puppe...@googlegroups.com
Matthias Baur updated an issue
 
Puppet / Improvement PUP-10270
Allow testing for data types with defined()
Change By: Matthias Baur
Summary: Allow testing of for data types with defined()
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
Feb 6, 2020, 6:19:04 AM2/6/20
to puppe...@googlegroups.com
Henrik Lindberg commented on Improvement PUP-10270
 
Re: Allow testing for data types with defined()

For anyone implementing this: it is important to know that when asking for a data type, all types that are not explicitly defined are by design a Resource datatype (yes, for historical reasons it needs to do this). Since the ask for a data type must use a string the logic ends up doing this:

            # Find a resource type, definition or class definition
            Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type_or_class(scope, val)

I think it may need to do that first, and if not found, then try the 4.x loaders to load the data type - i.e. something like this:

        loader = Puppet.lookup(:loaders).private_environment_loader()
        type = loader.load(:type, type_name)

But, in Puppet 6 it may work to only use the 4.x loaders.

Jorie Tappa (JIRA)

unread,
Feb 10, 2020, 2:30:04 PM2/10/20
to puppe...@googlegroups.com

Jorie Tappa (JIRA)

unread,
Feb 10, 2020, 2:30:05 PM2/10/20
to puppe...@googlegroups.com
Jorie Tappa updated an issue
Change By: Jorie Tappa
Sub-team: Language
Reply all
Reply to author
Forward
0 new messages