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

type validation should not run for `puppet resource`

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
      None
    • Template:
    • Team:
      Coremunity

      Description

      tl;dr: puppet resource creates resource types without attributes, which causes the type's global validate block to fail. It should initialize the type with values from the provider so that it can be validated.

      Puppet types can have per-parameter or per-property validate blocks, but can also have a global validate block.

      Oddly, when running puppet resource <whatever> the per-attribute validates are not called (as no attributes are passed), but the global validate is. Validation is usually done on the resource coming from the catalog, which is self in the context of the global validate. When using puppet resource there is no true catalog per-say, but if no arguments are passed then the resource types @parameter hash is not initialized and thus validation will fail.

      If the @parameter hash was merged with the values from self.provider's @property_hash then the global validation block would still be validating any values that were passed on the command-line, or just the values returned by self.instances if there are no arguments.

      This *should* still work for normal catalog application, as a resource returned by self.instances and thus passing global validation is already configured correctly.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                hunter Hunter (Hunner) Haugen
              • Votes:
                4 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: