SlideShare a Scribd company logo
1 of 20
Austin Puppet Users Group
(ATXPUG)
Managing Puppet Complexity
Modules & Complexity
Complexity is generally used to characterize
something with many parts where those parts
interact with each other in multiple ways.
Style
• Make quality a requirement
• Know when to stop (don’t over optimize)
• DRY – Don’t Repeat Yourself
DRY – Don’t repeat yourself
• Imposed Duplication – Apparent lack of
choice
• Inadvertent Duplication – Not realize that
they’re duplicating information
• Impatient Duplication – lazy / duplicate
because it seems easier
• Interdeveloper Duplication – Multiple people
on teams / multiple teams.
Code
• Keep low level knowledge in code
• Reserve Comments for high level expectations
• Foster an environment where it’s easier to
find and reuse existing stuff than to write it
yourself.
Avoid Global data
• Every time you reference global data it ties
you to the other components that share data
– frowned upon since 2.x days but still in a lot
of puppet code
Orthogonal - Safe to Fail
• Independent / lightly coupled systems
– Eliminates effects of unrelated things
– Design self contained things
• Increased productivity & contained risk
Prototype (experiment)
• Architecture
• New functionality in existing systems
• Structure or contents of external data
• Third party tools or components
• Performance issues
• User interface / experience / design
Experiements
• Worry less about correctness, completeness,
robustness and style.
• Focus on design / definition
• Is coupling minimized?
• Can you identify potential sources of
duplication?
Style Guides
• https://docs.puppetlabs.com/guides/style_gui
de.html
Test
• Loosely coupled systems easier to test –
interactions between components are limited.
– Unit testing is easier
– Test in CI pipeline
• Beaker / rspect / puppet lint
Refactor
• Avoid code rot. Don’t let bad code fester and
turn all your code into abandonware
It’s code
• Version control
• Test
• Refactor
• Share.
• forge
Module Template
• Puppet Module Generate – use the boiler
plate
• Use Garethr’s boiler plate – nice & updated
https://github.com/garethr/puppet-module-
skeleton (more assumptions though)
Data Separation
• Some use hiera.. Me no like
• ENC
– Puppet PE
– Foreman
– Homebrew
– ?
• Single source of truth? How?
Parameterized Classes
• Great for ENCs
• Easy to set default values
• Portable / Shareable
Class Inheritance
• Use within a module to reduce repetition
(DRY)
• Inheriting from other modules decreases
modularity, but hard to avoid
– ENC confusion
Code Defensively
• Catch unexpected events before they break
things – gracefully bow out if you don’t
support platform
• Puppet Future parser helps –
– Line error failure reporting
– Type checking (out of stdlib)
I wish
• More modules exposed puppet resources
• Augeus (or similar) was internalized across
every platform so there was an easy meta
catalog instead of is osfamily = yaddy yaddy
yadda
• Open source puppet had strong direction.. 3.7
PE is out.. What next for OS?
Discussions
• I’m out of slides, time for interaction

More Related Content

What's hot

Java design patterns
Java design patternsJava design patterns
Java design patterns
Brian Zitzow
 

What's hot (6)

Lrug
LrugLrug
Lrug
 
Selenium Camp 2016 - Effective UI tests scaling on Java
Selenium Camp 2016 - Effective UI tests scaling on JavaSelenium Camp 2016 - Effective UI tests scaling on Java
Selenium Camp 2016 - Effective UI tests scaling on Java
 
Java design patterns
Java design patternsJava design patterns
Java design patterns
 
Austin Python Learners Meetup - Everything you need to know about programming...
Austin Python Learners Meetup - Everything you need to know about programming...Austin Python Learners Meetup - Everything you need to know about programming...
Austin Python Learners Meetup - Everything you need to know about programming...
 
An Experimentation Toolkit for Robotics Control and Manipulation Tasks using ...
An Experimentation Toolkit for Robotics Control and Manipulation Tasks using ...An Experimentation Toolkit for Robotics Control and Manipulation Tasks using ...
An Experimentation Toolkit for Robotics Control and Manipulation Tasks using ...
 
AATC2016: Exploratory testing an API
AATC2016: Exploratory testing an APIAATC2016: Exploratory testing an API
AATC2016: Exploratory testing an API
 

Similar to ATXPUG Meetup 11/11/14 - Managing complexity in Puppet Code

Puppet Camp Austin 2015: Getting Started with Puppet
Puppet Camp Austin 2015: Getting Started with PuppetPuppet Camp Austin 2015: Getting Started with Puppet
Puppet Camp Austin 2015: Getting Started with Puppet
Puppet
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
Stephen Ritchie
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle core
Dan Poltawski
 
Type mock isolator
Type mock isolatorType mock isolator
Type mock isolator
MaslowB
 
Type mock isolator
Type mock isolatorType mock isolator
Type mock isolator
MaslowB
 

Similar to ATXPUG Meetup 11/11/14 - Managing complexity in Puppet Code (20)

Puppet Camp Austin 2015: Getting Started with Puppet
Puppet Camp Austin 2015: Getting Started with PuppetPuppet Camp Austin 2015: Getting Started with Puppet
Puppet Camp Austin 2015: Getting Started with Puppet
 
PuppetCamp Austin 2015 Talk - Getting started with puppet
PuppetCamp Austin 2015 Talk - Getting started with puppetPuppetCamp Austin 2015 Talk - Getting started with puppet
PuppetCamp Austin 2015 Talk - Getting started with puppet
 
Generalization in Auto-Testing. How we put what we had into new Technological...
Generalization in Auto-Testing. How we put what we had into new Technological...Generalization in Auto-Testing. How we put what we had into new Technological...
Generalization in Auto-Testing. How we put what we had into new Technological...
 
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
 
Java and the JVM
Java and the JVMJava and the JVM
Java and the JVM
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle core
 
Php traits
Php traitsPhp traits
Php traits
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 
Type mock isolator
Type mock isolatorType mock isolator
Type mock isolator
 
Browser Fuzzing with a Twist (and a Shake) -- ZeroNights 2015
Browser Fuzzing with a Twist (and a Shake) -- ZeroNights 2015Browser Fuzzing with a Twist (and a Shake) -- ZeroNights 2015
Browser Fuzzing with a Twist (and a Shake) -- ZeroNights 2015
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black Hole
 
Guide to Destroying Codebases The Demise of Clever Code
Guide to Destroying Codebases   The Demise of Clever CodeGuide to Destroying Codebases   The Demise of Clever Code
Guide to Destroying Codebases The Demise of Clever Code
 
Terraform training - Modules 🎒
Terraform training - Modules 🎒Terraform training - Modules 🎒
Terraform training - Modules 🎒
 
Modern Module Development
Modern Module DevelopmentModern Module Development
Modern Module Development
 
Design_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.pptDesign_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.ppt
 
Eurosport's Kodakademi #2
Eurosport's Kodakademi #2Eurosport's Kodakademi #2
Eurosport's Kodakademi #2
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Type mock isolator
Type mock isolatorType mock isolator
Type mock isolator
 

Recently uploaded

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

ATXPUG Meetup 11/11/14 - Managing complexity in Puppet Code

  • 1. Austin Puppet Users Group (ATXPUG) Managing Puppet Complexity
  • 2. Modules & Complexity Complexity is generally used to characterize something with many parts where those parts interact with each other in multiple ways.
  • 3. Style • Make quality a requirement • Know when to stop (don’t over optimize) • DRY – Don’t Repeat Yourself
  • 4. DRY – Don’t repeat yourself • Imposed Duplication – Apparent lack of choice • Inadvertent Duplication – Not realize that they’re duplicating information • Impatient Duplication – lazy / duplicate because it seems easier • Interdeveloper Duplication – Multiple people on teams / multiple teams.
  • 5. Code • Keep low level knowledge in code • Reserve Comments for high level expectations • Foster an environment where it’s easier to find and reuse existing stuff than to write it yourself.
  • 6. Avoid Global data • Every time you reference global data it ties you to the other components that share data – frowned upon since 2.x days but still in a lot of puppet code
  • 7. Orthogonal - Safe to Fail • Independent / lightly coupled systems – Eliminates effects of unrelated things – Design self contained things • Increased productivity & contained risk
  • 8. Prototype (experiment) • Architecture • New functionality in existing systems • Structure or contents of external data • Third party tools or components • Performance issues • User interface / experience / design
  • 9. Experiements • Worry less about correctness, completeness, robustness and style. • Focus on design / definition • Is coupling minimized? • Can you identify potential sources of duplication?
  • 11. Test • Loosely coupled systems easier to test – interactions between components are limited. – Unit testing is easier – Test in CI pipeline • Beaker / rspect / puppet lint
  • 12. Refactor • Avoid code rot. Don’t let bad code fester and turn all your code into abandonware
  • 13. It’s code • Version control • Test • Refactor • Share. • forge
  • 14. Module Template • Puppet Module Generate – use the boiler plate • Use Garethr’s boiler plate – nice & updated https://github.com/garethr/puppet-module- skeleton (more assumptions though)
  • 15. Data Separation • Some use hiera.. Me no like • ENC – Puppet PE – Foreman – Homebrew – ? • Single source of truth? How?
  • 16. Parameterized Classes • Great for ENCs • Easy to set default values • Portable / Shareable
  • 17. Class Inheritance • Use within a module to reduce repetition (DRY) • Inheriting from other modules decreases modularity, but hard to avoid – ENC confusion
  • 18. Code Defensively • Catch unexpected events before they break things – gracefully bow out if you don’t support platform • Puppet Future parser helps – – Line error failure reporting – Type checking (out of stdlib)
  • 19. I wish • More modules exposed puppet resources • Augeus (or similar) was internalized across every platform so there was an easy meta catalog instead of is osfamily = yaddy yaddy yadda • Open source puppet had strong direction.. 3.7 PE is out.. What next for OS?
  • 20. Discussions • I’m out of slides, time for interaction