Jira (PUP-11229) Update puppet `instance?` methods to use `instance_of?` instead of `is_a?`

7 views
Skip to first unread message

Victor Bobosila (Jira)

unread,
Aug 24, 2021, 3:44:04 AM8/24/21
to puppe...@googlegroups.com
Victor Bobosila created an issue
 
Puppet / Improvement PUP-11229
Update puppet `instance?` methods to use `instance_of?` instead of `is_a?`
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2021/08/24 12:43 AM
Priority: Normal Normal
Reporter: Victor Bobosila

The Jira issue PUP-10105, solved an issue where puppet resource --to_yaml would emit puppet class tags by updating the way PScalarDataType#instance? checks whether an object is an instance of the said type. 

The problem was that some of the resource's fields would be ProcessOutput objects, which is a child class of ruby String, and the instance? method used `is_a?` to check whether the ProcessOutput object was an instance. In this case, due to the way `is_a?` works, the instance? method would return true, since the object is a child of String. 

To fix this issue, we updated the method to use `instance_of?` when checking Strings, so it would only return true for actual ruby Strings.

The next step would be to update the `instance?` methods for the rest of Data and RichData data types such as (Integer/Float/Fixnum/Bignum/Rational)

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Ciprian Badescu (Jira)

unread,
Sep 21, 2021, 5:17:03 AM9/21/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
May 17, 2023, 2:12:02 PM5/17/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Labels: performance
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Josh Cooper (Jira)

unread,
May 17, 2023, 2:12:03 PM5/17/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
May 17, 2023, 2:12:03 PM5/17/23
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages