From 860c23820ea83124d14cf2c0b372f2c3033a04f9 Mon Sep 17 00:00:00 2001 From: Ramesh Sencha Date: Thu, 3 Aug 2023 14:07:47 +0530 Subject: [PATCH] (CAT-1269) - CI Fixes --- spec/acceptance/user_spec.rb | 42 ++++++++++------------------ spec/spec_helper_acceptance_local.rb | 5 +++- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/spec/acceptance/user_spec.rb b/spec/acceptance/user_spec.rb index aa8e955..545ff08 100644 --- a/spec/acceptance/user_spec.rb +++ b/spec/acceptance/user_spec.rb @@ -13,20 +13,13 @@ ensure => directory, before => Accounts::User['hunner'], } - if $facts['puppetversion'][0] == '6' { - $key_test = [ - 'ssh-rsa #{test_key} vagrant', - 'command="/bin/echo Hello",from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2' - ] - } - else { - $key_test = [#{' '} - 'ssh-rsa #{test_key} vagrant', - 'command="/bin/echo Hello",from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2', - 'ecdsa-sha2-nistp256 #{ecdsa_test_key} vagrant3', - 'sk-ecdsa-sha2-nistp256@openssh.com #{ecdsa_sk_test_key} vagrant4' - ] - } + + $key_test = [#{' '} + 'ssh-rsa #{test_key} vagrant', + 'command="/bin/echo Hello",from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2', + 'ecdsa-sha2-nistp256 #{ecdsa_test_key} vagrant3', + 'sk-ecdsa-sha2-nistp256@openssh.com #{ecdsa_sk_test_key} vagrant4' + ] accounts::user { 'hunner': groups => ['root'], @@ -55,20 +48,13 @@ ensure => directory, before => Accounts::User['hunner'], } - if $facts['puppetversion'][0] == '6' { - $key_test = [ - 'ssh-rsa #{test_key} vagrant', - 'command="/bin/echo Hello",from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2' - ] - } - else { - $key_test = [#{' '} - 'ssh-rsa #{test_key} vagrant', - 'command="/bin/echo Hello",from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2', - 'ecdsa-sha2-nistp256 #{ecdsa_test_key} vagrant3', - 'sk-ecdsa-sha2-nistp256@openssh.com #{ecdsa_sk_test_key} vagrant4' - ] - } + + $key_test = [#{' '} + 'ssh-rsa #{test_key} vagrant', + 'command="/bin/echo Hello",from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2', + 'ecdsa-sha2-nistp256 #{ecdsa_test_key} vagrant3', + 'sk-ecdsa-sha2-nistp256@openssh.com #{ecdsa_sk_test_key} vagrant4' + ] accounts::user { 'hunner': groups => ['root'], diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index a938096..85cf9a5 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -93,7 +93,7 @@ def set_hieradata(hieradata) def clear_temp_hieradata if @temp_hieradata_dirs && !@temp_hieradata_dirs.empty? @temp_hieradata_dirs.each do |data_dir| - if File.exists?(data_dir) + if File.exist?(data_dir) FileUtils.rm_r(data_dir) end end @@ -102,6 +102,9 @@ def clear_temp_hieradata RSpec.configure do |c| c.before(:all) do + # Set sticky bit for docker provisioner + run_shell('chmod +t /tmp/') if ENV['TARGET_HOST'].match(/^localhost:/) + @temp_hieradata_dirs = @temp_hieradata_dirs || [] @hiera_datadir = hiera_datadir end