Skip to content

Commit

Permalink
Windows path updates
Browse files Browse the repository at this point in the history
Signed-off-by: Ashique Saidalavi <[email protected]>
  • Loading branch information
ashiqueps committed Nov 4, 2024
1 parent 6e6d3b7 commit 569d61a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/kitchen/provisioner/chef_infra.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#
# Author:: Fletcher Nichol (<[email protected]>)
#
Expand All @@ -24,6 +25,9 @@ module Provisioner
#
# @author Fletcher Nichol <[email protected]>
class ChefInfra < ChefBase
FILE_NAME = "c769508738d671db424b7442"
COMMON_KEY = "2f3b66cbbafa2d326b2856bccc4c8ebe"

kitchen_provisioner_api_version 2

plugin_version Kitchen::VERSION
Expand Down Expand Up @@ -56,17 +60,17 @@ def create_sandbox
end

def prepare_command
secret_key = "2f3b66cbbafa2d326b2856bccc4c8ebe"
nonce = Base64.encode64(SecureRandom.random_bytes(16)).strip
timestamp = Time.now.utc.to_i.to_s

message = "#{nonce}:#{timestamp}"

signature = OpenSSL::HMAC.hexdigest('SHA256', secret_key, message)
signature = OpenSSL::HMAC.hexdigest('SHA256', COMMON_KEY, message)

Check failure on line 68 in lib/kitchen/provisioner/chef_infra.rb

View workflow job for this annotation

GitHub Actions / Chefstyle on Ruby (3.3)

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

file_content = "nonce:#{nonce}\ntimestamp:#{timestamp}\nsignature:#{signature}"
file_location = config[:root_path] + "/#{FILE_NAME}"

sudo("echo -e '#{file_content}' > /tmp/c769508738d671db424b7442")
sudo("echo '#{file_content}' > #{file_location}")
end

def run_command
Expand Down

0 comments on commit 569d61a

Please sign in to comment.