Fix the undefined method 'chomp' for nil:NilClass error seen with ovs 2.10

puppet-ovn uses puppet-vswitch to configure the OVN params. When OVS binaries are
compiled with dpdk support and when vs_config provider runs the command
'ovs-vsctl list Open_vSwitch .', the below warning messages are seen and
are part of the command output.

----
PMD: net_mlx5: cannot load glue library: libibverbs.so.1: cannot open shared
object file: No such file or directory
PMD: net_mlx5: cannot initialize PMD due to missing run-time dependency on
rdma-core libraries (libibverbs, libmlx5)
----

We see the error 'undefined method 'chomp' for nil:NilClass' when the result is
extracted. This patch fixes this issue by checking if the 'value' var is nil or
not before 'parse_column_value' is called.

Tripleo deployment with OVN is failing because of this issue.

Change-Id: I415a6229a0fbc1b55451e3738539735afdc6f8f4
Closes-bug: #1789236
This commit is contained in:
Numan Siddique 2018-08-28 14:02:13 +05:30
parent 350322b149
commit b6dab2e9bb

View File

@ -39,6 +39,9 @@ Puppet::Type.type(:vs_config).provide(:ovs) do
configs = [] configs = []
open_vs.each do |line| open_vs.each do |line|
key, value = line.split(' : ').map(&:strip) key, value = line.split(' : ').map(&:strip)
if value.nil?
next
end
parsed_value = parse_column_value(value) parsed_value = parse_column_value(value)
if parsed_value[:type] == "hash" if parsed_value[:type] == "hash"
parsed_value[:value].each do |k, v| parsed_value[:value].each do |k, v|