Skip to content

Commit

Permalink
Fix escaping of connection name inside facts exec
Browse files Browse the repository at this point in the history
Closes #6
  • Loading branch information
cruelsmith committed Sep 14, 2022
1 parent 96cf294 commit 5db3734
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/facter/networkmanager_dns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
nmcli = Facter.value(:networkmanager_nmcli_path)
connections.each do |connection|
dns[connection] = {}
dns[connection][:nameserver] = Facter::Core::Execution.execute("#{nmcli} -g ipv4.dns connection show id #{connection}").split(',')
dns[connection][:search] = Facter::Core::Execution.execute("#{nmcli} -g ipv4.dns-search connection show id #{connection}").split(',')
dns[connection][:options] = Facter::Core::Execution.execute("#{nmcli} -e no -g ipv4.dns-options connection show id #{connection}").split(',')
dns[connection][:nameserver] = Facter::Core::Execution.execute("#{nmcli} -g ipv4.dns connection show id '#{connection}'").split(',')
dns[connection][:search] = Facter::Core::Execution.execute("#{nmcli} -g ipv4.dns-search connection show id '#{connection}'").split(',')
dns[connection][:options] = Facter::Core::Execution.execute("#{nmcli} -e no -g ipv4.dns-options connection show id '#{connection}'").split(',')
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/facter/networkmanager_primaryconnection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
if nmcli
device = Facter.value('networking')['primary']
if device
cmd = "#{nmcli} -g general.connection d show #{device}"
cmd = "#{nmcli} -g general.connection d show '#{device}'"
Facter::Core::Execution.execute(cmd)
end
end
Expand Down

0 comments on commit 5db3734

Please sign in to comment.