mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Set a static node GUID for travis. (#3497)
Signed-off-by: Jared Quick <jquick@chef.io>
This commit is contained in:
parent
8c9c1e0cc3
commit
7a52419b64
1 changed files with 13 additions and 0 deletions
|
@ -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')
|
||||
|
||||
|
|
Loading…
Reference in a new issue