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

Add Struct-extending Params[<Resource Type>] and ParamsHash[] data types

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Duplicate
    • Affects Version/s: PUP 4.9.0
    • Fix Version/s: None
    • Component/s: Language
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      Hide

      1. Params[<Type>] must inherit and specialize Struct[<ParamDef>], so <ParamDef> is a Hash with automatically extracted definition of parameters for <Type>

      2. ParamsHash[<Type>] should inherit and specialize Hash[<TitleDef>, Params[<Type>]], so <TitleDef> has all constraints of <Type>'s type

      Show
      1. Params [<Type>] must inherit and specialize Struct [<ParamDef>] , so <ParamDef> is a Hash with automatically extracted definition of parameters for <Type> 2. ParamsHash [<Type>] should inherit and specialize Hash[<TitleDef>, Params [<Type>] ], so <TitleDef> has all constraints of <Type>'s type
    • Team:
      Puppet Developer Experience
    • QA Risk Assessment:
      Needs Assessment

      Description

      There is a common idiom with Hiera data and module writing. Example:

      define mymodule::mytype(
         /*... a long list of params ... */
      ) {
      }
       
      class mymodule(
          $mytypes = {},
      ) {
          create_resources('mymodule::mytype', $mytypes)
      }
      

      The new feature would allow strict parameter checking without any duplication required. Example:

      class mymodule(
          Hash[String[1], Params[Mymodule::Mytype]]
              $mytypes ,
      ) { ... }
      

      To further improve the standard case:

      class mymodule(
          ParamsHash[Mymodule::Mytype]
              $mytypes ,
      ) { ... }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              andvgal Andrey Galkin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support