X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/a86724a8db309dcdafff46b762171af67b1bb05e..56fcbc5d4f195f3973c08a2155037ec9103c1c01:/cookbooks/chef/libraries/persistent_token.rb diff --git a/cookbooks/chef/libraries/persistent_token.rb b/cookbooks/chef/libraries/persistent_token.rb new file mode 100644 index 000000000..8299e8550 --- /dev/null +++ b/cookbooks/chef/libraries/persistent_token.rb @@ -0,0 +1,20 @@ +require "digest" + +class Chef + module Mixin + module PersistentToken + def persistent_token(*args) + sha256 = Digest::SHA256.new + sha256.update(node[:machine_id]) + args.each do |arg| + sha256.update(arg) + end + sha256.hexdigest + end + end + end + + class Recipe + include Chef::Mixin::PersistentToken + end +end