Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Poise: Reusable Cookbook Patterns
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Noah Kantrowitz
April 16, 2014
Programming
1
730
Poise: Reusable Cookbook Patterns
Noah Kantrowitz
April 16, 2014
Tweet
Share
More Decks by Noah Kantrowitz
See All by Noah Kantrowitz
The Long Hello World
coderanger
0
17
The Long Hello World (with notes)
coderanger
0
56
What Python Can Learn From Other Languages
coderanger
0
79
What Python Can Learn From Other Languages (with notes)
coderanger
0
200
Swiss Army Django: Small Footprint ETL (with notes) - DjangoCon US
coderanger
0
310
Swiss Army Django: Small Footprint ETL - DjangoCon US
coderanger
0
79
How to look at space: PyCon AU
coderanger
0
130
Swiss Army Django: Small Footprint ETL
coderanger
0
110
Swiss Army Django: Small Footprint ETL (with notes)
coderanger
0
98
Other Decks in Programming
See All in Programming
Grafana:建立系統全知視角的捷徑
blueswen
0
330
Basic Architectures
denyspoltorak
0
670
ThorVG Viewer In VS Code
nors
0
770
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
110
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
160
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.3k
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
370
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
2.5k
SourceGeneratorのススメ
htkym
0
190
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
710
Implementation Patterns
denyspoltorak
0
280
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
Featured
See All Featured
The Invisible Side of Design
smashingmag
302
51k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
Thoughts on Productivity
jonyablonski
74
5k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
The Curious Case for Waylosing
cassininazir
0
230
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
160
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
430
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
250
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Transcript
Cookbook Patterns Poise Noah Kantrowitz
Me •PSF + PyCon •Balanced •Chef •Making things
•What? •Why? •How?
None
None
None
cook·book A description of a piece of infrastructure
Role Cookbook Recipe Resource
None
leak·y ab·strac·tion Incomplete hiding of internal details
None
•Fork (and patch) •Wrapper •Rewind
Inheritance
None
10x
Poise
•Helpers •DSL extensions •Patterns
None
•jenkins •jenkins_job •jenkins_credential •jenkins_plugin
•ci_job •ci_pipeline •name_ci_pipeline
Using Poise
class Chef class ... ... end end
Resource::Foo < Resource Provider::Foo < Provider
•Foo => foo •FooBar => foo_bar •FOO => f_o_o
class ... include Poise ... end
action(:one, :two) attribute(:name, kind_of: String)
attribute(:opts, option_collector: true ) opts do foo 'bar' end
attribute(:path, default: lazy { ... })
attribute(:config, template: true) attribute('', template: true)
foo ... do source 'cfg.erb' end foo ... do content
'x=1' end
file ... do content nr.content end
class Provider... def action_one ... end end
notifying_block do ... end
include_recipe ...
Putting It Together
class Res::Foo < Res include Poise action(:one) attribute(:pkg) attribute(:ver) end
def action_one notifying_block do install_pkg write_config end end
def install_pkg package nr.pkg do version nr.ver end end
def install_pkg r = super r.package_name( 'my-thing') r end
Next Steps
Subresources
Cookbook Tiers
•poise-proxy •poise-appenv •poise-service?
•attribute(node: ...) •group do ... end •after(:one)
None
Thank You