Set a static node GUID for travis. (#3497)

Signed-off-by: Jared Quick <jquick@chef.io>
This commit is contained in:
Jared Quick 2018-10-11 21:14:30 -04:00 committed by GitHub
parent 8c9c1e0cc3
commit 7a52419b64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,6 +16,19 @@ chef_gem 'inspec' do
source '/root/inspec-core-local.gem'
end
def uuid_from_string(string)
require 'digest/sha1'
hash = Digest::SHA1.new
hash.update(string)
ary = hash.digest.unpack('NnnnnN')
ary[2] = (ary[2] & 0x0FFF) | (5 << 12)
ary[3] = (ary[3] & 0x3FFF) | 0x8000
'%08x-%04x-%04x-%04x-%04x%08x' % ary
end
# set a static node uuid for our testing nodes
Chef::Config[:chef_guid] = uuid_from_string(node.name)
# container preparation
include_recipe('os_prepare::prep_container')