From 2db549d114648ba22a3824c9ba8b02bda0b16071 Mon Sep 17 00:00:00 2001 From: Kentaro Horio Date: Sun, 14 Nov 2021 21:06:30 +0900 Subject: [PATCH 1/3] remove duplicated args --- manifests/pip.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 3935df72..352ea6a5 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -173,7 +173,7 @@ } $pip_install = "${pip_env} --log ${log}/pip.log install" - $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" + $pip_common_args = "${pypi_index} ${proxy_flag} ${install_editable} ${source}" # Explicit version out of VCS when PIP supported URL is provided if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ { @@ -195,7 +195,7 @@ 'present': { # Whatever version is available. - $command = "${pip_install} ${pip_common_args}" + $command = "${pip_install} ${install_args} ${pip_common_args}" $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } @@ -214,7 +214,7 @@ $grep_regex_pkgname_with_dashes = "^${pkgname_with_dashes}==" $installed_version = join( ["${pip_env} freeze --all", " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", " | tr -d '[:space:]'",]) - $command = "${pip_install} --upgrade ${pip_common_args}" + $command = "${pip_install} --upgrade ${install_args} ${pip_common_args}" $unless_command = "[ \$(${latest_version}) = \$(${installed_version}) ]" } From 6aece7ee19ff8d710708b99fcdb494a728edec61 Mon Sep 17 00:00:00 2001 From: Kentaro Horio Date: Sun, 14 Nov 2021 22:09:37 +0900 Subject: [PATCH 2/3] fix expected command --- spec/defines/pip_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index a51e916a..2c815a08 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -68,7 +68,7 @@ context 'adds proxy to install command if proxy set' do let(:params) { { proxy: 'http://my.proxy:3128' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') } end end @@ -81,7 +81,7 @@ context 'adds index to install command if index set' do let(:params) { { index: 'http://www.example.com/simple/' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') } end end From fe1c01828a9be5c9d26f612f547a9536f65e4abb Mon Sep 17 00:00:00 2001 From: Kentaro Horio Date: Wed, 17 Nov 2021 00:53:32 +0900 Subject: [PATCH 3/3] add test for install_args --- spec/defines/pip_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 2c815a08..7ef1c57d 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -94,6 +94,14 @@ end end + describe 'install_args as' do + context 'adds install_args to install command if install_args set' do + let(:params) { { install_args: '--pre' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --pre rpyc') } + end + end + describe 'install latest' do context 'does not use pip search in unless' do let(:params) { { ensure: 'latest' } }