|
| 1 | +<!SLIDE > |
| 2 | +# Creating a Module - The Old Way |
| 3 | + |
| 4 | + @@@ Console nochrome |
| 5 | + $ puppet module generate author-modulename --skip-interview |
| 6 | + $ cd modulename |
| 7 | + |
| 8 | +*...Lots of editing...* |
| 9 | + |
| 10 | + @@@ Console nochrome |
| 11 | + $ puppet module build |
| 12 | + |
| 13 | +*...Upload to Forge...* |
| 14 | + |
| 15 | +<!SLIDE > |
| 16 | +# What's Wrong With the Old Way? |
| 17 | + |
| 18 | +* Module skeleton quality varied wildly. |
| 19 | +* Often easier to create everything from scratch. |
| 20 | +* The skeleton was only used as an initial template. |
| 21 | +* `puppet module generate` [was deprecated in Puppet 5.4.0](https://puppet.com/docs/puppet/5.4/release_notes.html#deprecations). |
| 22 | + |
| 23 | +<!SLIDE > |
| 24 | +# Creating a Module - The New Way |
| 25 | + |
| 26 | + @@@ Console nochrome |
| 27 | + $ pdk new module author-modulename |
| 28 | + $ cd modulename |
| 29 | + $ pdk new class modulename |
| 30 | + |
| 31 | +*...Lots of editing...* |
| 32 | + |
| 33 | + @@@ Console nochrome |
| 34 | + $ pdk validate |
| 35 | + $ pdk test unit |
| 36 | + $ pdk build |
| 37 | + |
| 38 | +*...Upload to Forge...* |
| 39 | + |
| 40 | +<!SLIDE > |
| 41 | +# Why is this better? |
| 42 | + |
| 43 | +* Generated code follows best practices. |
| 44 | +* `pdk new class classname` creates ***manifests/classname.pp*** *and* ***spec/classes/classname_spec.rb***. |
| 45 | + * Testing out of the box! |
| 46 | +* The default templates (https://github.com/puppetlabs/pdk-templates) include lots of goodies: |
| 47 | + * CI configurations for Travis CI, GitLab CI/CD, and AppVeyor |
| 48 | + * *operatingsystem_support* and *requirements* in ***metadata.json*** |
| 49 | + * Git configuration (***.gitignore***, ***.gitattributes***) |
| 50 | + * [Puppet Strings](https://github.com/puppetlabs/puppet-strings) in generated code |
| 51 | +* Updates to the templates can be applied to (some files in) the module. |
| 52 | +* Interaction with Ruby tooling (`bundle`, `rake`) is not required. |
| 53 | +* Did I mention that `puppet module generate` [was deprecated in Puppet 5.4.0](https://puppet.com/docs/puppet/5.4/release_notes.html#deprecations)? |
| 54 | + |
| 55 | +<!SLIDE > |
| 56 | +# Using PDK |
| 57 | + |
| 58 | +## Create a new module |
| 59 | + |
| 60 | + @@@ Console nochrome |
| 61 | + $ pdk new module mynewmodule |
| 62 | + |
| 63 | +(Or you can skip the interview...) |
| 64 | + |
| 65 | + @@@ Console nochrome |
| 66 | + $ pdk new module mynewmodule --skip-interview |
| 67 | + |
| 68 | +## Convert an existing module to PDK format |
| 69 | + |
| 70 | + @@@ Console nochrome |
| 71 | + $ pdk convert |
| 72 | + |
| 73 | +*(Note that this does not add tests for existing classes, defined types, etc.)* |
| 74 | + |
| 75 | +## Update from the templates in an existing PDK-format module |
| 76 | + |
| 77 | + @@@ Console nochrome |
| 78 | + $ pdk update |
| 79 | + |
| 80 | +<!SLIDE > |
| 81 | +# Using PDK |
| 82 | + |
| 83 | +## Create a new class |
| 84 | + |
| 85 | + @@@ Console nochrome |
| 86 | + $ pdk new class classname |
| 87 | + |
| 88 | +## Create a new defined type |
| 89 | + |
| 90 | + @@@ Console nochrome |
| 91 | + $ pdk new defined_type typename |
| 92 | + |
| 93 | +## Create a new task |
| 94 | + |
| 95 | + @@@ Console nochrome |
| 96 | + $ pdk new task taskname |
0 commit comments