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

Add pattern matching to Runtime Type

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 4.5.0
    • None
    • None
    • Not Needed
    • This is a highly specialized feature that can be considered internal. You have to be super expert to benefit from this. It is also part of the larger Pcore feature.

    Description

      Currently the Runtime type can describe only one class at the time. As we plan to use this to provide mappings from general models to an implementation (e.g. to bind AST related classes like Locator, or the AST itself) to puppet names in such a way that implementations in different languages can read/write a data stream where instances are identified by the puppet name), it is onerous having to individually define those mappings (AST =~ 100 classes).

      To support this, the Runtime type should provide regular expression substitution support by stating a Regular expression and a substitution. Currently it only accepts a single classname.

      $in_my_package_t = Runtime[ruby, [/MyPackage::(.*)/, 'MyModule::\1']]
      

      can then be used to answer if an implementation instance is an instance of that runtime type.

      ACCEPTANCE CRITERIA


      There is very little that can be done with instances of Runtime in Puppet. Consider this an internal enablement that needs to be covered by unit tests.

      Attachments

        Issue Links

          Activity

            People

              qa qa
              henrik.lindberg Henrik Lindberg
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support