]> git.openstreetmap.org Git - chef.git/blob - cookbooks/chef/libraries/persistent_token.rb
Respond with 429 to abusive "ping" requests
[chef.git] / cookbooks / chef / libraries / persistent_token.rb
1 require "digest"
2
3 class Chef
4   module Mixin
5     module PersistentToken
6       def persistent_token(*args)
7         sha256 = Digest::SHA256.new
8         sha256.update(node[:machine_id])
9         args.each do |arg|
10           sha256.update(arg)
11         end
12         sha256.hexdigest
13       end
14     end
15   end
16
17   class Recipe
18     include Chef::Mixin::PersistentToken
19   end
20 end