From 02ae1d23b5e359f6898260bdb754f1ebddcbdee1 Mon Sep 17 00:00:00 2001 From: Daniel Parks Date: Thu, 15 Feb 2024 15:34:46 -0800 Subject: [PATCH] more tracing --- .github/workflows/pr-checks.yaml | 4 +++- lib/puppet/provider/rustup_exec.rb | 3 +++ lib/puppet/provider/rustup_internal/default.rb | 1 + spec/acceptance/user_spec.rb | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 83b44e5..7a7f561 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -58,7 +58,9 @@ jobs: strategy: matrix: os: ['ubuntu-latest'] - agent: ['puppet7', 'puppet8'] + agent: + #- puppet7 + - puppet8 runs-on: ${{ matrix.os }} steps: diff --git a/lib/puppet/provider/rustup_exec.rb b/lib/puppet/provider/rustup_exec.rb index 2500b76..4033346 100644 --- a/lib/puppet/provider/rustup_exec.rb +++ b/lib/puppet/provider/rustup_exec.rb @@ -82,6 +82,9 @@ def ensure_not_absent; end # Determine if `rustup` has been installed on the system for this user def rustup_installed? + if ENV['RUSTUP_TRACE'] + warn("rustup_installed? #{File.file? rustup_path} (#{rustup_path})") + end File.file? rustup_path end diff --git a/lib/puppet/provider/rustup_internal/default.rb b/lib/puppet/provider/rustup_internal/default.rb index 3852b98..bf83ef6 100644 --- a/lib/puppet/provider/rustup_internal/default.rb +++ b/lib/puppet/provider/rustup_internal/default.rb @@ -32,6 +32,7 @@ def exists? # The resource thinks we need to install `rustup`. def create url = URI.parse(resource[:installer_source]) + warn "create rustup: download #{url}" # Puppet::Util::Execution.execute can’t accept an IO stream or a string as # stdin, so we save the script as a file and pipe it into stdin. (We don’t diff --git a/spec/acceptance/user_spec.rb b/spec/acceptance/user_spec.rb index 42e08ca..da5c331 100644 --- a/spec/acceptance/user_spec.rb +++ b/spec/acceptance/user_spec.rb @@ -369,6 +369,9 @@ it 'can remove itself after the user was deleted' do rm_user('rustup_test') + puts "default cargo home" + puts Dir.entries("/home/rustup_test").sort rescue puts "no /home/rustup_test" + puts "run 1" puts apply_manifest(<<~'END', catch_failures: true, prefix_command: 'RUSTUP_TRACE=1 ').stderr user { 'rustup_test': ensure => present, @@ -394,6 +397,7 @@ expect(file('/home/rustup_test/.bashrc').content) .to eq %(# .bashrc\n. "$HOME/.cargo/env"\n) + puts "run 2" puts apply_manifest(<<~'END', catch_failures: true, prefix_command: 'RUSTUP_TRACE=1 ').stderr user { 'rustup_test': ensure => absent, @@ -424,6 +428,9 @@ it 'can remove itself after the user was deleted (with custom cargo_home)' do rm_user('rustup_test') + puts "custom cargo_home" + puts Dir.entries("/home/rustup_test").sort rescue puts "no /home/rustup_test" + puts "run 1" puts apply_manifest(<<~'END', catch_failures: true, prefix_command: 'RUSTUP_TRACE=1 ').stderr user { 'rustup_test': ensure => present, @@ -459,6 +466,7 @@ expect(file('/home/rustup_test/.bashrc').content) .to eq %(# .bashrc\n. "/home/rustup_test/a/b/.cargo/env"\n) + puts "run 2" puts apply_manifest(<<~'END', catch_failures: true, prefix_command: 'RUSTUP_TRACE=1 ').stderr user { 'rustup_test': ensure => absent,