Merge "Fix unsafe interpolations in exec"

This commit is contained in:
Zuul 2024-04-16 08:13:58 +00:00 committed by Gerrit Code Review
commit d35e531a0b
8 changed files with 8 additions and 8 deletions

View File

@ -292,7 +292,7 @@ class vswitch::dpdk (
# when any vs_config resource with restart => true is enabled.
exec { 'restart openvswitch':
path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
command => "systemctl -q restart ${service_name}.service",
command => ['systemctl', '-q', 'restart', "${service_name}.service"],
refreshonly => true,
}

View File

@ -99,7 +99,7 @@ class vswitch::ovs(
# when any vs_config resource with restart => true is enabled.
exec { 'restart openvswitch':
path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
command => "systemctl -q restart ${service_name}.service",
command => ['systemctl', '-q', 'restart', "${service_name}.service"],
refreshonly => true,
}

View File

@ -5,7 +5,7 @@
class vswitch::pki::cacert {
exec { 'ovs-pki-init-ca-authority':
command => 'ovs-pki init --force',
command => ['ovs-pki', 'init', '--force'],
creates => '/var/lib/openvswitch/pki/switchca',
path => ['/usr/sbin', '/sbin', '/usr/bin', '/bin'],
}

View File

@ -13,7 +13,7 @@ define vswitch::pki::cert(
) {
exec { "ovs-req-and-sign-cert-${name}":
command => "ovs-pki req+sign ${name}",
command => ['ovs-pki', 'req+sign', $name],
cwd => $cert_dir,
creates => "${cert_dir}/${name}-cert.pem",
path => ['/usr/sbin', '/sbin', '/usr/bin', '/bin'],

View File

@ -73,7 +73,7 @@ describe 'vswitch::dpdk' do
it 'restarts the service when needed' do
is_expected.to contain_exec('restart openvswitch').with(
:path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
:command => "systemctl -q restart %s.service" % platform_params[:ovs_service_name],
:command => ['systemctl', '-q', 'restart', "#{platform_params[:ovs_service_name]}.service"],
:refreshonly => true
)
end

View File

@ -48,7 +48,7 @@ describe 'vswitch::ovs' do
it 'restarts the service when needed' do
is_expected.to contain_exec('restart openvswitch').with(
:path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
:command => "systemctl -q restart %s.service" % platform_params[:ovs_service_name],
:command => ['systemctl', '-q', 'restart', "#{platform_params[:ovs_service_name]}.service"],
:refreshonly => true
)
end

View File

@ -5,7 +5,7 @@ describe 'vswitch::pki::cacert' do
shared_examples_for 'vswitch::pki::cacert' do
it 'shoud initialize ca authority' do
is_expected.to contain_exec('ovs-pki-init-ca-authority').with(
:command => 'ovs-pki init --force',
:command => ['ovs-pki', 'init', '--force'],
:creates => '/var/lib/openvswitch/pki/switchca',
:path => ['/usr/sbin', '/sbin', '/usr/bin', '/bin'],
)

View File

@ -7,7 +7,7 @@ describe 'vswitch::pki::cert' do
shared_examples_for 'vswitch::pki::cert' do
it 'shoud generate a certificate' do
is_expected.to contain_exec('ovs-req-and-sign-cert-foo').with(
:command => 'ovs-pki req+sign foo',
:command => ['ovs-pki', 'req+sign', 'foo'],
:cwd => '/etc/openvswitch',
:creates => '/etc/openvswitch/foo-cert.pem',
:path => ['/usr/sbin', '/sbin', '/usr/bin', '/bin'],