Added parameter validation for socket_mem parameter
Change-Id: I886b08c4c7bf419313bece5f9e8b4c93a7e61aa1 Closes-Bug: #1689936 Signed-off-by: Karthik S <ksundara@redhat.com>
This commit is contained in:
parent
4f621646df
commit
74bac67ae3
@ -60,7 +60,10 @@ class vswitch::dpdk (
|
||||
# DPDK_OPTIONS is no longer used in ovs 2.6, since it was a distribution
|
||||
# specific hack to the ovs-ctl scripts. Instead dpdk information is
|
||||
# pulled from the ovsdb.
|
||||
if $socket_mem {
|
||||
if $socket_mem and !empty($socket_mem) {
|
||||
unless $socket_mem =~ /^(\d+\,?)+$/ {
|
||||
fail( 'socket_mem is in incorrect format')
|
||||
}
|
||||
$socket_string = "--socket-mem ${socket_mem}"
|
||||
}
|
||||
else {
|
||||
|
@ -101,7 +101,6 @@ describe 'vswitch::dpdk' do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'when passing all params' do
|
||||
before :each do
|
||||
params.merge!(:host_core_list => '1,2')
|
||||
@ -134,6 +133,13 @@ describe 'vswitch::dpdk' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when passing invalid socket_mem' do
|
||||
before :each do
|
||||
params.merge!(:socket_mem => "'1024'")
|
||||
end
|
||||
it { is_expected.to raise_error(Puppet::Error, /socket_mem is in incorrect format/) }
|
||||
end
|
||||
|
||||
context 'when providing valid driver type facts' do
|
||||
let :facts do
|
||||
OSDefaults.get_facts({
|
||||
|
Loading…
x
Reference in New Issue
Block a user