]> git.openstreetmap.org Git - chef.git/blob - cookbooks/chef/libraries/persistent_token.rb
supybot: osmosis now uses main branch
[chef.git] / cookbooks / chef / libraries / persistent_token.rb
1 require "digest"
2
3 module OpenStreetMap
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 end
17
18 Chef::DSL::Recipe.include(OpenStreetMap::Mixin::PersistentToken)