Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-11229

Update puppet `instance?` methods to use `instance_of?` instead of `is_a?`

    XMLWordPrintable

Details

    • Improvement
    • Status: Accepted
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • None
    • Phoenix
    • Needs Assessment

    Description

      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)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              victor.bobosila Victor Bobosila
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Zendesk Support