[PUP-5948] write puppet-generate to transform ruby resource type to pcore resource type Created: 2016/02/20  Updated: 2016/08/17  Resolved: 2016/08/10

Status: Closed
Project: Puppet
Component/s: Docs
Affects Version/s: None
Fix Version/s: PUP 4.6.0

Type: New Feature Priority: Normal
Reporter: Henrik Lindberg Assignee: qa
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relates to PUP-6603 Acceptance: Add test for puppet-generate Closed
Epic Link: Puppet Resource Types
Story Points: 5
Sprint: Language 2016-07-13, Language 2016-07-27, Language 2016-08-10
Release Notes: Bug Fix
Release Notes Summary: The feature in this ticket is part of a larger feature (environment isolation). However - the work on this changes {{create_resources}} slightly in that the created resources are not immediately evaluated - instead they follow the same rules as if the same resource had been created in the manifest at the point where the call to {{create_resources}} is made. This changes the order of evaluation between the created resources and those created in manifests. Earlier the resources added to the catalog using {{create_resoures}} "jumped the queue" and were added before any unevaluated resources. The resources created by {{create_resources}} are now lazily evaluated just like all other resources. Logic that depends on the order of evaluation between resources created in one call to {{create_resources}} and manifest created resources may need to be changed as a consequence when relying on manifest ordering to define the order of application or when using calls to {{defined}} immediately after a call to {{create_resources}}.


Implement a tool that loads a module's / puppet core's types and writes PCore representations of those types.

The tools should generate the .pp logic that describes a resource type as best it can, and for constructs that cannot be automatically translated, issue warnings/help how to work around those issues.

This tool is considered a one time translation. If changes are made to the underlying ruby type, the user should manually bring the pcore representation up to date, or regenerate it from Ruby source.

  • The tools should prevent accidental overwrite of existing code
  • Generated code should contain comments that instruct user how to overcome non translatable constructs.
  • The tools should encourage users to add typing of parameters where typing does not exist.
  • When encountering a non translatable construct the tool should encourage users to modify the implementation (or be prepared to maintain the Pcore representation manually).

Comment by Peter Huene [ 2016/07/11 ]

I'm going to mark this as ready for merge so we can review what has already been committed to https://github.com/peterhuene/puppet-generate. It needs unit tests still, but I'm waiting on the OK from product regarding the expected user story and experience for this tool.

Comment by Henrik Lindberg [ 2016/07/31 ]

The PR to puppet contains all of the work Peter Huene did in his repository. In addition it adjust both the generation and implementation for which it is generating code (adjustments to handling of title patterns, the name of the runtime class, and how it is instantiated (args by position instead of args in a hash). PR also contains unit and integration tests.

Comment by Thomas Hallgren [ 2016/08/01 ]

Merged to master at 97676bd.

Comment by Henrik Lindberg [ 2016/08/11 ]

Ping Jorie Tappa - note the special release note information regarding a consequence of this ticket that needs to be release noted.

Generated at Mon Dec 09 14:06:38 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.