SlideShare une entreprise Scribd logo
1  sur  54
Télécharger pour lire hors ligne
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Knee deep in the undef:
Tales from refactoring old
Puppet codebases
Peter Souter
Senior Professional Services Engineer | Puppet
@petersouter
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
2
Who
am I?
@petersouter
Senior Professional
Services Engineer
5 years using Puppet
2 years @ Puppet Inc
Help customers deploy
Puppet
Teach Puppet classes
Contribute to the
community and
open-source
petems
IRC/Slack/GitHub
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Warning: I speak quickly
And I have a different accent...
3
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
“Regardless of what we discover, we understand and truly
believe that everyone did the best job they could, given
what they knew at the time, their skills and abilities, the
resources available, and the situation at hand.”
- http://www.retrospectives.com/pages/retroPrimeDirective.html
4
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Show of hands in the room
What version of Puppet are you on now?
5
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Show of hands in the room
How old is your Puppet codebase? When was your first
commit?
6
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
7
The King is Dead… Long live the king!
Puppet 3.X is now EOL
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Some customers we hadn’t talked to in a
while...
This is a good time for an upgrade or refactor of code
8
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Noticed a few repeating anti-patterns
and issues with a lot of these customers
And similar issues with people asking for community help
in Slack and IRC
9
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
10
commit bbdecbeb1c199b7132f94c33ee44a66e265fa456
Author: Jane Doe <jane.doe@example.com>
Date: Tue Jun 4 10:46:13 2013 +0100
Initial commit
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
11
commit ac4b7c3312d75c3584ef069c272f7ad4ff610eb4
Author: John Doe <john.doe@example.com>
Date: Thu Mar 3 15:46:59 2011 +0000
Import
git-svn-id: https://svn.example.com/svn/puppet/trunk@1
3d7401f0-959d-0410-a61e-fbe730d1da08
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
I’m not going to talk about the Puppet 4
upgrade stuff
Lots of talks on that… but it’s a common time for people to
look over their codebases when upgrading
12
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
13
1. Hiera overload/Too much data
2. Lack of validation/CI
3. Reinventing the wheel
4. Lack of VCS best practises
5. Make the newbie experience better
5 Key Areas that came up over again
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Hiera overload/Too much data
Hiera is simultaneously the best and worst thing to happen
to Puppet
14
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
YAML management is the biggest pain
point in the DevOps world...
Not just limited to Puppet...
15
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Why is this a problem?
Two main issues...
16
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
First: Context switching is the mind killer
Humans suck at multitasking
17
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
18
“The trick here is that when you manage programmers, specifically,
task switches take a really, really, really long time. That's because
programming is the kind of task where you have to keep a lot of things
in your head at once. The more things you remember at once, the
more productive you are at programming. A programmer coding at
full throttle is keeping zillions of things in their head at once: everything
from names of variables, data structures, important APIs, the names of
utility functions that they wrote and call a lot, even the name of the
subdirectory where they store their source code.”
Human Task Switches Considered Harmful - Joel Spolsky
http://www.joelonsoftware.com/articles/fog0000000022.html
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
19
● Get the people who are maintaining the code to look at
what's written
● How long does it take them to find out how something’s
done in your code?
● Ask them if they can easily understand what’s
happening and why
To fix it: Get an outsider's perspective
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Second: Maintaining this data is costly
Both technically and mentally
20
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
21
$ find . -type f | wc -l
587
Hiera can become bloated over time
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
22
● Minimise node specific data: it’s the hardest to maintain
and easiest to get stale
● Abstract information into a hierarchy to DRY it up
● Purge irrelevant data
● Remember, it’ll be in the git history still!
Clean up your hiera!
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
23
PR I’ve been meaning to resurrect:
maybe at the contributor summit?
- https://github.com/voxpupuli/puppet-syntax/pull/57
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Lack of validation/CI
The earlier you can catch errors, the cheaper it is to fix
them.
24
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
25
Gareth’s talk about the Future of Puppet testing
https://speakerdeck.com/garethr/the-future-o
f-testing-puppet-code
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
26
● Puppet-syntax checks puppet, yaml, erb and epp files
● When you get that under control, use puppet-lint for
style checks
● Then rspec-puppet for unit tests
● Then beaker/testkitchen for acceptance tests
● If you don’t have CI, fix that! Or at least use git pre/post
commit hooks as a basic gate
At its most basic, a syntax error should not be
deployable
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
27
Testing with containers makes tests fast and
repeatable
http://cfgmgmtcamp.eu/schedule/testing/andy-henriod.html
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Lack of VCS best practises
Monolithic repos make it hard to upgrade modules and for
multiple people to work on the module at one time
28
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Make the newbie experience better
People change teams, new people join. Make sure they
can contribute as soon as possible
29
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
● If you want people to follow specific workflows or
requirements make it easy as possible
● Prevent risky newbie mistakes with CI and tooling
(puppet-lint, rubocop, rake tasks etc)
● Pair-programming is not just about the code: it’s about
learning the processes and improving the experience
for both new and old users
30
The bar should be low enough to trip over
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
313131
● Comments can be a crutch
● The best comment is a good name for a method or
variable
● Sometimes your hand is forced: make sure you
comment clearly and concisely
● Give the full context in the commit message
Code should be self-documenting
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
323232
https://blog.codinghorror.com/code-smells/
“There's a fine line between comments that illuminate and comments
that obscure. Are the comments necessary? Do they explain ‘why’ and
not ‘what’? Can you refactor the code so the comments aren't required?
And remember, you're writing comments for people, not
machines.”
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
333333
● Separate subject from body with a blank line
● Limit the subject line to 50 characters
● Capitalize the subject line
● Do not end the subject line with a period
● Use the imperative mood in the subject line
● Wrap the body at 72 characters
● Use the body to explain what and why vs. how
Git Commit best practices
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
343434
http://chris.beams.io/posts/git-commit/
“Re-establishing the context of a piece of code is wasteful. We can't
avoid it completely, so our efforts should go to reducing it [as much] as
possible. Commit messages can do exactly that and as a result, a
commit message shows whether a developer is a good
collaborator.”
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
35
Commit Often, Perfect Later, Publish Once
Learn how rebasing and amending works
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
363636
An example of good git commits at work
http://www.philandstuff.com/2014/02/09/git-pickaxe.html
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
373737
The Git Pickaxe
The reason I care about commit messages is because I'm an avid user of the git
pickaxe. If I'm ever confused about a line of code, and I want to know what
was going through the mind of the developer when they were writing it, the
pickaxe is the first tool I'll reach for. For example, let's say I was looking at this line
from our puppet-graphite module:
exec <%= @root_dir %>/bin/carbon-cache.py --debug start
That --debug option looks suspect. I might think to myself: "Why are we running
carbon-cache in --debug mode? Isn't that wasteful? Do we capture the output?
Why was it added in the first place?" In order to answer these questions, I'd like to
find the commit that added the switch.
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
383838
commit 5288d5804a3fc20dae4f3b2deeaa7f687595aff1
Author: Philip Potter <philip.g.potter@gmail.com>
Date: Tue Dec 17 09:33:59 2013 +0000
Re-add --debug option (reverts #11)
The --debug option is somewhat badly named -- it *both* adds debug
output, *and* causes carbon-cache to run in the foreground. Removing the
option in #11 caused the upstart script to lose track of the process as
carbon-cache started unexpectedly daemonizing.
Ideally we want to have a way of running through upstart without the
debug output, but this will fix the immediate problem.
Ta-dah, mystery solved!
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Reinventing the wheel
There are existing modules, use them!
39
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
404040
The more existing boilerplate and modules you can
leverage:
● The less work you have to do (Yay for you!)
● The more maintainable it will be (Yay for your team!)
● The more supportable it will be (Yay for everyone!)
Start off on the right foot
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
4141414141
Start with the puppet control repo
41https://github.com/puppetlabs/control-repo
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
424242424242
Use as supported modules as your number 1 choice
https://forge.puppet.com/modules?endorsements=supported
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
4343
Use approved modules as your number 2 choice
43https://forge.puppet.com/modules?endorsements=approved
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
4444
If there’s no supported or approved, use your best judgement...
44https://forge.puppet.com/modules?utf-8=%E2%9C%93&sort=downloads&q=limits
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
When writing new modules, use a custom module skeleton
https://github.com/petems/petems-puppet-module-skeleton 45
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
46
Write as little as possible
Code is like a puppy: anything you write you are responsible
for
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
47
Summary
What have we learnt?
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
48
Get your hiera under control
Clean up old files, validate and try and abstract
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
49
Get validation and CI on your codebase
syntax, lint, spec, acceptance
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
50
Don’t reinvent the wheel
Try and reuse as much as possible,
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
51
Make sure you’re VCS is top notch
Git is the primary place to show your intentions and the
history of the code
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
52
Ensure your newbie experience is great
Make the bar low enough to fall over
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
● PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob
Nelson, AT&T 71 views
http://www.slideshare.net/PuppetLabs/puppetconf-2016-enjoying-the-journey-
from-puppet-3x-to-4x-rob-nelson-att
● Does Your Configuration Code Smell? - Tushar Sharma, Marios
Fragkoulis and Diomidis Spinellis - Dept of Management Science and
Technology
http://www.tusharma.in/wp-content/uploads/2016/03/ConfigurationSmells_pre
print.pdf
● Roles and profiles: A complete example
https://docs.puppet.com/pe/2016.5/r_n_p_full_example.html
● Puppet Design Patterns - David Danzilio, Kovarus
http://www.slideshare.net/DavidDanzilio/puppet-design-patterns-puppetconf
53
Want to know more?
Knee deep in the undef
Tales from refactoring old Puppet codebases
@petersouter
Q&A
54

Contenu connexe

Tendances

{'python': 'dict'}
{'python': 'dict'}{'python': 'dict'}
{'python': 'dict'}nybon
 
Minimal MVC in JavaScript
Minimal MVC in JavaScriptMinimal MVC in JavaScript
Minimal MVC in JavaScriptMosky Liu
 
The state of PHPUnit
The state of PHPUnitThe state of PHPUnit
The state of PHPUnitEdorian
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Ontico
 
Keep it simple web development stack
Keep it simple web development stackKeep it simple web development stack
Keep it simple web development stackEric Ahn
 
The Anatomy of an Exploit
The Anatomy of an ExploitThe Anatomy of an Exploit
The Anatomy of an ExploitPatricia Aas
 
Richard wartell malware is hard. let's go shopping!!
Richard wartell   malware is hard.  let's go shopping!!Richard wartell   malware is hard.  let's go shopping!!
Richard wartell malware is hard. let's go shopping!!Shakacon
 
Astricon 2013: "Asterisk and Database"
Astricon 2013: "Asterisk and Database"Astricon 2013: "Asterisk and Database"
Astricon 2013: "Asterisk and Database"Francesco Prior
 
Getting Started with Puppet on Windows - PuppetConf 2014
Getting Started with Puppet on Windows - PuppetConf 2014Getting Started with Puppet on Windows - PuppetConf 2014
Getting Started with Puppet on Windows - PuppetConf 2014Puppet
 
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON
 
HTTP and Your Angry Dog
HTTP and Your Angry DogHTTP and Your Angry Dog
HTTP and Your Angry DogRoss Tuck
 
Learning Python from Data
Learning Python from DataLearning Python from Data
Learning Python from DataMosky Liu
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby SystemsEngine Yard
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging RubyAman Gupta
 
Docker @ Data Science Meetup
Docker @ Data Science MeetupDocker @ Data Science Meetup
Docker @ Data Science MeetupDaniel Nüst
 
Docker for data science
Docker for data scienceDocker for data science
Docker for data scienceCalvin Giles
 

Tendances (20)

{'python': 'dict'}
{'python': 'dict'}{'python': 'dict'}
{'python': 'dict'}
 
Minimal MVC in JavaScript
Minimal MVC in JavaScriptMinimal MVC in JavaScript
Minimal MVC in JavaScript
 
The state of PHPUnit
The state of PHPUnitThe state of PHPUnit
The state of PHPUnit
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)
 
Keep it simple web development stack
Keep it simple web development stackKeep it simple web development stack
Keep it simple web development stack
 
The Anatomy of an Exploit
The Anatomy of an ExploitThe Anatomy of an Exploit
The Anatomy of an Exploit
 
Richard wartell malware is hard. let's go shopping!!
Richard wartell   malware is hard.  let's go shopping!!Richard wartell   malware is hard.  let's go shopping!!
Richard wartell malware is hard. let's go shopping!!
 
Astricon 2013: "Asterisk and Database"
Astricon 2013: "Asterisk and Database"Astricon 2013: "Asterisk and Database"
Astricon 2013: "Asterisk and Database"
 
Symfony Performance
Symfony PerformanceSymfony Performance
Symfony Performance
 
Getting Started with Puppet on Windows - PuppetConf 2014
Getting Started with Puppet on Windows - PuppetConf 2014Getting Started with Puppet on Windows - PuppetConf 2014
Getting Started with Puppet on Windows - PuppetConf 2014
 
Http error
Http errorHttp error
Http error
 
Sun raysetup
Sun raysetupSun raysetup
Sun raysetup
 
Python environments
Python environmentsPython environments
Python environments
 
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
 
HTTP and Your Angry Dog
HTTP and Your Angry DogHTTP and Your Angry Dog
HTTP and Your Angry Dog
 
Learning Python from Data
Learning Python from DataLearning Python from Data
Learning Python from Data
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging Ruby
 
Docker @ Data Science Meetup
Docker @ Data Science MeetupDocker @ Data Science Meetup
Docker @ Data Science Meetup
 
Docker for data science
Docker for data scienceDocker for data science
Docker for data science
 

En vedette

Compliance and auditing with Puppet
Compliance and auditing with PuppetCompliance and auditing with Puppet
Compliance and auditing with PuppetPeter Souter
 
Hardening Your Config Management - Security and Attack Vectors in Config Mana...
Hardening Your Config Management - Security and Attack Vectors in Config Mana...Hardening Your Config Management - Security and Attack Vectors in Config Mana...
Hardening Your Config Management - Security and Attack Vectors in Config Mana...Peter Souter
 
Puppet DSL: back to the basics
Puppet DSL: back to the basicsPuppet DSL: back to the basics
Puppet DSL: back to the basicsJulien Pivotto
 
Little Puppet Tools To Make Your Life Better
Little Puppet Tools To Make Your Life BetterLittle Puppet Tools To Make Your Life Better
Little Puppet Tools To Make Your Life BetterPeter Souter
 
Puppet module anti patterns
Puppet module anti patternsPuppet module anti patterns
Puppet module anti patternsPeter Souter
 
El camino hacia la nube hibrida y abierta de Red Hat
El camino hacia la nube hibrida y abierta de Red HatEl camino hacia la nube hibrida y abierta de Red Hat
El camino hacia la nube hibrida y abierta de Red HatGeneXus
 
Cloud Strategies for a modern hybrid datacenter - Dec 2015
Cloud Strategies for a modern hybrid datacenter - Dec 2015Cloud Strategies for a modern hybrid datacenter - Dec 2015
Cloud Strategies for a modern hybrid datacenter - Dec 2015Miguel Pérez Colino
 
Paris Container Day 2016 : Orchestrating Continuous Delivery (CloudBees)
Paris Container Day 2016 : Orchestrating Continuous Delivery (CloudBees) Paris Container Day 2016 : Orchestrating Continuous Delivery (CloudBees)
Paris Container Day 2016 : Orchestrating Continuous Delivery (CloudBees) Publicis Sapient Engineering
 
Beyond the Operating System: Red Hat's Open Strategy for the Modern Enterprise
Beyond the Operating System: Red Hat's Open Strategy for the Modern EnterpriseBeyond the Operating System: Red Hat's Open Strategy for the Modern Enterprise
Beyond the Operating System: Red Hat's Open Strategy for the Modern EnterpriseJames Falkner
 
Getting Started with Puppet - PuppetConf 2014
Getting Started with Puppet - PuppetConf 2014Getting Started with Puppet - PuppetConf 2014
Getting Started with Puppet - PuppetConf 2014Puppet
 
Simple_Movement_Class
Simple_Movement_ClassSimple_Movement_Class
Simple_Movement_ClassDavid Harris
 
PuppetConf track overview: Inside Puppet
PuppetConf track overview: Inside PuppetPuppetConf track overview: Inside Puppet
PuppetConf track overview: Inside PuppetPuppet
 
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, PuppetPuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, PuppetPuppet
 
PuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, Puppet
PuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, PuppetPuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, Puppet
PuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, PuppetPuppet
 
PuppetConf 2016: A Tale of Two Hierarchies: Group Policy & Puppet – Matt Ston...
PuppetConf 2016: A Tale of Two Hierarchies: Group Policy & Puppet – Matt Ston...PuppetConf 2016: A Tale of Two Hierarchies: Group Policy & Puppet – Matt Ston...
PuppetConf 2016: A Tale of Two Hierarchies: Group Policy & Puppet – Matt Ston...Puppet
 
November 11, 2014: Parent Meeting
November 11, 2014: Parent MeetingNovember 11, 2014: Parent Meeting
November 11, 2014: Parent Meetingmiltonsepac
 
Shadman sadab-Crash Course Session 01
Shadman sadab-Crash Course Session 01Shadman sadab-Crash Course Session 01
Shadman sadab-Crash Course Session 01Crash Course
 
Launching a product (bup)
Launching a product (bup)Launching a product (bup)
Launching a product (bup)Faria Rahman
 

En vedette (20)

Compliance and auditing with Puppet
Compliance and auditing with PuppetCompliance and auditing with Puppet
Compliance and auditing with Puppet
 
Lock it down
Lock it downLock it down
Lock it down
 
Hardening Your Config Management - Security and Attack Vectors in Config Mana...
Hardening Your Config Management - Security and Attack Vectors in Config Mana...Hardening Your Config Management - Security and Attack Vectors in Config Mana...
Hardening Your Config Management - Security and Attack Vectors in Config Mana...
 
Puppet DSL: back to the basics
Puppet DSL: back to the basicsPuppet DSL: back to the basics
Puppet DSL: back to the basics
 
AWS Account Best Practices
AWS Account Best PracticesAWS Account Best Practices
AWS Account Best Practices
 
Little Puppet Tools To Make Your Life Better
Little Puppet Tools To Make Your Life BetterLittle Puppet Tools To Make Your Life Better
Little Puppet Tools To Make Your Life Better
 
Puppet module anti patterns
Puppet module anti patternsPuppet module anti patterns
Puppet module anti patterns
 
El camino hacia la nube hibrida y abierta de Red Hat
El camino hacia la nube hibrida y abierta de Red HatEl camino hacia la nube hibrida y abierta de Red Hat
El camino hacia la nube hibrida y abierta de Red Hat
 
Cloud Strategies for a modern hybrid datacenter - Dec 2015
Cloud Strategies for a modern hybrid datacenter - Dec 2015Cloud Strategies for a modern hybrid datacenter - Dec 2015
Cloud Strategies for a modern hybrid datacenter - Dec 2015
 
Paris Container Day 2016 : Orchestrating Continuous Delivery (CloudBees)
Paris Container Day 2016 : Orchestrating Continuous Delivery (CloudBees) Paris Container Day 2016 : Orchestrating Continuous Delivery (CloudBees)
Paris Container Day 2016 : Orchestrating Continuous Delivery (CloudBees)
 
Beyond the Operating System: Red Hat's Open Strategy for the Modern Enterprise
Beyond the Operating System: Red Hat's Open Strategy for the Modern EnterpriseBeyond the Operating System: Red Hat's Open Strategy for the Modern Enterprise
Beyond the Operating System: Red Hat's Open Strategy for the Modern Enterprise
 
Getting Started with Puppet - PuppetConf 2014
Getting Started with Puppet - PuppetConf 2014Getting Started with Puppet - PuppetConf 2014
Getting Started with Puppet - PuppetConf 2014
 
Simple_Movement_Class
Simple_Movement_ClassSimple_Movement_Class
Simple_Movement_Class
 
PuppetConf track overview: Inside Puppet
PuppetConf track overview: Inside PuppetPuppetConf track overview: Inside Puppet
PuppetConf track overview: Inside Puppet
 
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, PuppetPuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
PuppetConf 2016: Puppet on Windows – Nicolas Corrarello, Puppet
 
PuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, Puppet
PuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, PuppetPuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, Puppet
PuppetConf 2016: The Future of Testing Puppet Code – Gareth Rushgrove, Puppet
 
PuppetConf 2016: A Tale of Two Hierarchies: Group Policy & Puppet – Matt Ston...
PuppetConf 2016: A Tale of Two Hierarchies: Group Policy & Puppet – Matt Ston...PuppetConf 2016: A Tale of Two Hierarchies: Group Policy & Puppet – Matt Ston...
PuppetConf 2016: A Tale of Two Hierarchies: Group Policy & Puppet – Matt Ston...
 
November 11, 2014: Parent Meeting
November 11, 2014: Parent MeetingNovember 11, 2014: Parent Meeting
November 11, 2014: Parent Meeting
 
Shadman sadab-Crash Course Session 01
Shadman sadab-Crash Course Session 01Shadman sadab-Crash Course Session 01
Shadman sadab-Crash Course Session 01
 
Launching a product (bup)
Launching a product (bup)Launching a product (bup)
Launching a product (bup)
 

Similaire à Knee deep in the undef - Tales from refactoring old Puppet codebases

Kubernetes: Learning from Zero to Production
Kubernetes: Learning from Zero to ProductionKubernetes: Learning from Zero to Production
Kubernetes: Learning from Zero to ProductionRosemary Wang
 
rake puppetexpert:create - Puppet Camp Silicon Valley 2014
rake puppetexpert:create - Puppet Camp Silicon Valley 2014rake puppetexpert:create - Puppet Camp Silicon Valley 2014
rake puppetexpert:create - Puppet Camp Silicon Valley 2014nvpuppet
 
I don't know what I'm Doing: A newbie guide for Golang for DevOps
I don't know what I'm Doing: A newbie guide for Golang for DevOpsI don't know what I'm Doing: A newbie guide for Golang for DevOps
I don't know what I'm Doing: A newbie guide for Golang for DevOpsPeter Souter
 
Everyone wants (someone else) to do it: writing documentation for open source...
Everyone wants (someone else) to do it: writing documentation for open source...Everyone wants (someone else) to do it: writing documentation for open source...
Everyone wants (someone else) to do it: writing documentation for open source...Jody Garnett
 
Puppet 3: Present and Future Tense
Puppet 3: Present and Future TensePuppet 3: Present and Future Tense
Puppet 3: Present and Future TenseEric Sorenson
 
Puppet 3: Present and Future Tense
Puppet 3: Present and Future TensePuppet 3: Present and Future Tense
Puppet 3: Present and Future TensePuppet
 
PuppetConf 2014 Killer R10K Workflow With Notes
PuppetConf 2014 Killer R10K Workflow With NotesPuppetConf 2014 Killer R10K Workflow With Notes
PuppetConf 2014 Killer R10K Workflow With NotesPhil Zimmerman
 
Prometheus as exposition format for eBPF programs running on Kubernetes
Prometheus as exposition format for eBPF programs running on KubernetesPrometheus as exposition format for eBPF programs running on Kubernetes
Prometheus as exposition format for eBPF programs running on KubernetesLeonardo Di Donato
 
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017Codemotion
 
How to write maintainable code
How to write maintainable codeHow to write maintainable code
How to write maintainable codePeter Hilton
 
Toplog candy elves - HOCM Talk
Toplog candy elves - HOCM TalkToplog candy elves - HOCM Talk
Toplog candy elves - HOCM TalkPatrick LaRoche
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Fwdays
 
Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009tudorprodan
 
Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2ice799
 
Complex things explained easily
Complex things explained easilyComplex things explained easily
Complex things explained easilyLuca Tumedei
 
Iteratively introducing Puppet technologies in the brownfield; Jeffrey Miller
Iteratively introducing Puppet technologies in the brownfield; Jeffrey MillerIteratively introducing Puppet technologies in the brownfield; Jeffrey Miller
Iteratively introducing Puppet technologies in the brownfield; Jeffrey MillerPuppet
 
Do you know all of Puppet?
Do you know all of Puppet?Do you know all of Puppet?
Do you know all of Puppet?Julien Pivotto
 
Containers for Science and High-Performance Computing
Containers for Science and High-Performance ComputingContainers for Science and High-Performance Computing
Containers for Science and High-Performance ComputingDmitry Spodarets
 
Pi, Python, and Paintball??? Innovating with Affordable Tech!
Pi, Python, and Paintball??? Innovating with Affordable Tech!Pi, Python, and Paintball??? Innovating with Affordable Tech!
Pi, Python, and Paintball??? Innovating with Affordable Tech!Barry Tarlton
 

Similaire à Knee deep in the undef - Tales from refactoring old Puppet codebases (20)

Kubernetes: Learning from Zero to Production
Kubernetes: Learning from Zero to ProductionKubernetes: Learning from Zero to Production
Kubernetes: Learning from Zero to Production
 
rake puppetexpert:create - Puppet Camp Silicon Valley 2014
rake puppetexpert:create - Puppet Camp Silicon Valley 2014rake puppetexpert:create - Puppet Camp Silicon Valley 2014
rake puppetexpert:create - Puppet Camp Silicon Valley 2014
 
Doing the Impossible
Doing the ImpossibleDoing the Impossible
Doing the Impossible
 
I don't know what I'm Doing: A newbie guide for Golang for DevOps
I don't know what I'm Doing: A newbie guide for Golang for DevOpsI don't know what I'm Doing: A newbie guide for Golang for DevOps
I don't know what I'm Doing: A newbie guide for Golang for DevOps
 
Everyone wants (someone else) to do it: writing documentation for open source...
Everyone wants (someone else) to do it: writing documentation for open source...Everyone wants (someone else) to do it: writing documentation for open source...
Everyone wants (someone else) to do it: writing documentation for open source...
 
Puppet 3: Present and Future Tense
Puppet 3: Present and Future TensePuppet 3: Present and Future Tense
Puppet 3: Present and Future Tense
 
Puppet 3: Present and Future Tense
Puppet 3: Present and Future TensePuppet 3: Present and Future Tense
Puppet 3: Present and Future Tense
 
PuppetConf 2014 Killer R10K Workflow With Notes
PuppetConf 2014 Killer R10K Workflow With NotesPuppetConf 2014 Killer R10K Workflow With Notes
PuppetConf 2014 Killer R10K Workflow With Notes
 
Prometheus as exposition format for eBPF programs running on Kubernetes
Prometheus as exposition format for eBPF programs running on KubernetesPrometheus as exposition format for eBPF programs running on Kubernetes
Prometheus as exposition format for eBPF programs running on Kubernetes
 
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
 
How to write maintainable code
How to write maintainable codeHow to write maintainable code
How to write maintainable code
 
Toplog candy elves - HOCM Talk
Toplog candy elves - HOCM TalkToplog candy elves - HOCM Talk
Toplog candy elves - HOCM Talk
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"
 
Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009
 
Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2
 
Complex things explained easily
Complex things explained easilyComplex things explained easily
Complex things explained easily
 
Iteratively introducing Puppet technologies in the brownfield; Jeffrey Miller
Iteratively introducing Puppet technologies in the brownfield; Jeffrey MillerIteratively introducing Puppet technologies in the brownfield; Jeffrey Miller
Iteratively introducing Puppet technologies in the brownfield; Jeffrey Miller
 
Do you know all of Puppet?
Do you know all of Puppet?Do you know all of Puppet?
Do you know all of Puppet?
 
Containers for Science and High-Performance Computing
Containers for Science and High-Performance ComputingContainers for Science and High-Performance Computing
Containers for Science and High-Performance Computing
 
Pi, Python, and Paintball??? Innovating with Affordable Tech!
Pi, Python, and Paintball??? Innovating with Affordable Tech!Pi, Python, and Paintball??? Innovating with Affordable Tech!
Pi, Python, and Paintball??? Innovating with Affordable Tech!
 

Dernier

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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 2024Rafal Los
 
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 productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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 WorkerThousandEyes
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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 CVKhem
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 organizationRadu Cotescu
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Dernier (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Knee deep in the undef - Tales from refactoring old Puppet codebases

  • 1. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Knee deep in the undef: Tales from refactoring old Puppet codebases Peter Souter Senior Professional Services Engineer | Puppet @petersouter
  • 2. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 2 Who am I? @petersouter Senior Professional Services Engineer 5 years using Puppet 2 years @ Puppet Inc Help customers deploy Puppet Teach Puppet classes Contribute to the community and open-source petems IRC/Slack/GitHub
  • 3. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Warning: I speak quickly And I have a different accent... 3
  • 4. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter “Regardless of what we discover, we understand and truly believe that everyone did the best job they could, given what they knew at the time, their skills and abilities, the resources available, and the situation at hand.” - http://www.retrospectives.com/pages/retroPrimeDirective.html 4
  • 5. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Show of hands in the room What version of Puppet are you on now? 5
  • 6. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Show of hands in the room How old is your Puppet codebase? When was your first commit? 6
  • 7. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 7 The King is Dead… Long live the king! Puppet 3.X is now EOL
  • 8. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Some customers we hadn’t talked to in a while... This is a good time for an upgrade or refactor of code 8
  • 9. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Noticed a few repeating anti-patterns and issues with a lot of these customers And similar issues with people asking for community help in Slack and IRC 9
  • 10. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 10 commit bbdecbeb1c199b7132f94c33ee44a66e265fa456 Author: Jane Doe <jane.doe@example.com> Date: Tue Jun 4 10:46:13 2013 +0100 Initial commit
  • 11. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 11 commit ac4b7c3312d75c3584ef069c272f7ad4ff610eb4 Author: John Doe <john.doe@example.com> Date: Thu Mar 3 15:46:59 2011 +0000 Import git-svn-id: https://svn.example.com/svn/puppet/trunk@1 3d7401f0-959d-0410-a61e-fbe730d1da08
  • 12. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter I’m not going to talk about the Puppet 4 upgrade stuff Lots of talks on that… but it’s a common time for people to look over their codebases when upgrading 12
  • 13. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 13 1. Hiera overload/Too much data 2. Lack of validation/CI 3. Reinventing the wheel 4. Lack of VCS best practises 5. Make the newbie experience better 5 Key Areas that came up over again
  • 14. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Hiera overload/Too much data Hiera is simultaneously the best and worst thing to happen to Puppet 14
  • 15. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter YAML management is the biggest pain point in the DevOps world... Not just limited to Puppet... 15
  • 16. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Why is this a problem? Two main issues... 16
  • 17. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter First: Context switching is the mind killer Humans suck at multitasking 17
  • 18. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 18 “The trick here is that when you manage programmers, specifically, task switches take a really, really, really long time. That's because programming is the kind of task where you have to keep a lot of things in your head at once. The more things you remember at once, the more productive you are at programming. A programmer coding at full throttle is keeping zillions of things in their head at once: everything from names of variables, data structures, important APIs, the names of utility functions that they wrote and call a lot, even the name of the subdirectory where they store their source code.” Human Task Switches Considered Harmful - Joel Spolsky http://www.joelonsoftware.com/articles/fog0000000022.html
  • 19. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 19 ● Get the people who are maintaining the code to look at what's written ● How long does it take them to find out how something’s done in your code? ● Ask them if they can easily understand what’s happening and why To fix it: Get an outsider's perspective
  • 20. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Second: Maintaining this data is costly Both technically and mentally 20
  • 21. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 21 $ find . -type f | wc -l 587 Hiera can become bloated over time
  • 22. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 22 ● Minimise node specific data: it’s the hardest to maintain and easiest to get stale ● Abstract information into a hierarchy to DRY it up ● Purge irrelevant data ● Remember, it’ll be in the git history still! Clean up your hiera!
  • 23. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 23 PR I’ve been meaning to resurrect: maybe at the contributor summit? - https://github.com/voxpupuli/puppet-syntax/pull/57
  • 24. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Lack of validation/CI The earlier you can catch errors, the cheaper it is to fix them. 24
  • 25. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 25 Gareth’s talk about the Future of Puppet testing https://speakerdeck.com/garethr/the-future-o f-testing-puppet-code
  • 26. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 26 ● Puppet-syntax checks puppet, yaml, erb and epp files ● When you get that under control, use puppet-lint for style checks ● Then rspec-puppet for unit tests ● Then beaker/testkitchen for acceptance tests ● If you don’t have CI, fix that! Or at least use git pre/post commit hooks as a basic gate At its most basic, a syntax error should not be deployable
  • 27. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 27 Testing with containers makes tests fast and repeatable http://cfgmgmtcamp.eu/schedule/testing/andy-henriod.html
  • 28. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Lack of VCS best practises Monolithic repos make it hard to upgrade modules and for multiple people to work on the module at one time 28
  • 29. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Make the newbie experience better People change teams, new people join. Make sure they can contribute as soon as possible 29
  • 30. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter ● If you want people to follow specific workflows or requirements make it easy as possible ● Prevent risky newbie mistakes with CI and tooling (puppet-lint, rubocop, rake tasks etc) ● Pair-programming is not just about the code: it’s about learning the processes and improving the experience for both new and old users 30 The bar should be low enough to trip over
  • 31. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 313131 ● Comments can be a crutch ● The best comment is a good name for a method or variable ● Sometimes your hand is forced: make sure you comment clearly and concisely ● Give the full context in the commit message Code should be self-documenting
  • 32. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 323232 https://blog.codinghorror.com/code-smells/ “There's a fine line between comments that illuminate and comments that obscure. Are the comments necessary? Do they explain ‘why’ and not ‘what’? Can you refactor the code so the comments aren't required? And remember, you're writing comments for people, not machines.”
  • 33. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 333333 ● Separate subject from body with a blank line ● Limit the subject line to 50 characters ● Capitalize the subject line ● Do not end the subject line with a period ● Use the imperative mood in the subject line ● Wrap the body at 72 characters ● Use the body to explain what and why vs. how Git Commit best practices
  • 34. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 343434 http://chris.beams.io/posts/git-commit/ “Re-establishing the context of a piece of code is wasteful. We can't avoid it completely, so our efforts should go to reducing it [as much] as possible. Commit messages can do exactly that and as a result, a commit message shows whether a developer is a good collaborator.”
  • 35. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 35 Commit Often, Perfect Later, Publish Once Learn how rebasing and amending works
  • 36. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 363636 An example of good git commits at work http://www.philandstuff.com/2014/02/09/git-pickaxe.html
  • 37. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 373737 The Git Pickaxe The reason I care about commit messages is because I'm an avid user of the git pickaxe. If I'm ever confused about a line of code, and I want to know what was going through the mind of the developer when they were writing it, the pickaxe is the first tool I'll reach for. For example, let's say I was looking at this line from our puppet-graphite module: exec <%= @root_dir %>/bin/carbon-cache.py --debug start That --debug option looks suspect. I might think to myself: "Why are we running carbon-cache in --debug mode? Isn't that wasteful? Do we capture the output? Why was it added in the first place?" In order to answer these questions, I'd like to find the commit that added the switch.
  • 38. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 383838 commit 5288d5804a3fc20dae4f3b2deeaa7f687595aff1 Author: Philip Potter <philip.g.potter@gmail.com> Date: Tue Dec 17 09:33:59 2013 +0000 Re-add --debug option (reverts #11) The --debug option is somewhat badly named -- it *both* adds debug output, *and* causes carbon-cache to run in the foreground. Removing the option in #11 caused the upstart script to lose track of the process as carbon-cache started unexpectedly daemonizing. Ideally we want to have a way of running through upstart without the debug output, but this will fix the immediate problem. Ta-dah, mystery solved!
  • 39. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Reinventing the wheel There are existing modules, use them! 39
  • 40. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 404040 The more existing boilerplate and modules you can leverage: ● The less work you have to do (Yay for you!) ● The more maintainable it will be (Yay for your team!) ● The more supportable it will be (Yay for everyone!) Start off on the right foot
  • 41. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 4141414141 Start with the puppet control repo 41https://github.com/puppetlabs/control-repo
  • 42. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 424242424242 Use as supported modules as your number 1 choice https://forge.puppet.com/modules?endorsements=supported
  • 43. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 4343 Use approved modules as your number 2 choice 43https://forge.puppet.com/modules?endorsements=approved
  • 44. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 4444 If there’s no supported or approved, use your best judgement... 44https://forge.puppet.com/modules?utf-8=%E2%9C%93&sort=downloads&q=limits
  • 45. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter When writing new modules, use a custom module skeleton https://github.com/petems/petems-puppet-module-skeleton 45
  • 46. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 46 Write as little as possible Code is like a puppy: anything you write you are responsible for
  • 47. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 47 Summary What have we learnt?
  • 48. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 48 Get your hiera under control Clean up old files, validate and try and abstract
  • 49. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 49 Get validation and CI on your codebase syntax, lint, spec, acceptance
  • 50. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 50 Don’t reinvent the wheel Try and reuse as much as possible,
  • 51. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 51 Make sure you’re VCS is top notch Git is the primary place to show your intentions and the history of the code
  • 52. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter 52 Ensure your newbie experience is great Make the bar low enough to fall over
  • 53. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter ● PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T 71 views http://www.slideshare.net/PuppetLabs/puppetconf-2016-enjoying-the-journey- from-puppet-3x-to-4x-rob-nelson-att ● Does Your Configuration Code Smell? - Tushar Sharma, Marios Fragkoulis and Diomidis Spinellis - Dept of Management Science and Technology http://www.tusharma.in/wp-content/uploads/2016/03/ConfigurationSmells_pre print.pdf ● Roles and profiles: A complete example https://docs.puppet.com/pe/2016.5/r_n_p_full_example.html ● Puppet Design Patterns - David Danzilio, Kovarus http://www.slideshare.net/DavidDanzilio/puppet-design-patterns-puppetconf 53 Want to know more?
  • 54. Knee deep in the undef Tales from refactoring old Puppet codebases @petersouter Q&A 54