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
This commit is contained in:
Takashi Kajinami 2024-03-14 12:35:05 +09:00
parent da173126db
commit 61d344cd36
2 changed files with 2 additions and 2 deletions

View File

@ -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'],

View File

@ -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