From 61d344cd36a20e11bda939b398ee3ffe105c2a23 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 14 Mar 2024 12:35:05 +0900 Subject: [PATCH] Use creates property of exec ... instead of unless + test command, to leverage the built-in feature and simplify the logic in our own modules. Change-Id: Ifc9c268a6e7cdcd2411157a7fb9bd20041d982ac --- manifests/init.pp | 2 +- spec/classes/tempest_init_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 945d4e29..ee151604 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -617,7 +617,7 @@ class tempest( "${tempest_clone_path}/.venv/bin/${tempest::params::pip_command} install -U -r requirements.txt"], ' && '), cwd => $tempest_clone_path, - unless => "test -d ${tempest_clone_path}/.venv", + creates => "${tempest_clone_path}/.venv", path => ['/bin','/usr/bin','/usr/local/bin'], require => [ Exec['install-tox'], diff --git a/spec/classes/tempest_init_spec.rb b/spec/classes/tempest_init_spec.rb index bf334a9e..edec7355 100644 --- a/spec/classes/tempest_init_spec.rb +++ b/spec/classes/tempest_init_spec.rb @@ -390,7 +390,7 @@ describe 'tempest' do is_expected.to contain_exec('setup-venv').with( :command => "virtualenv -p python3 /var/lib/tempest/.venv && /var/lib/tempest/.venv/bin/#{platform_params[:pip_command]} install -U -r requirements.txt", :cwd => '/var/lib/tempest', - :unless => 'test -d /var/lib/tempest/.venv', + :creates => '/var/lib/tempest/.venv', :path => ['/bin', '/usr/bin', '/usr/local/bin'] ) end