lib/puppet-debugger/support/facts.rb in puppet-debugger-0.4.1 vs lib/puppet-debugger/support/facts.rb in puppet-debugger-0.4.2
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
module PuppetDebugger
module Support
module Facts
# in the future we will want to grab real facts from real systems via puppetdb
# or enc data
@@ -47,32 +48,31 @@
message = <<-EOS
Using filter: #{facterdb_filter}
Bad FacterDB filter, please change the filter so it returns a result set.
See https://github.com/camptocamp/facterdb/#with-a-string-filter
EOS
- raise PuppetDebugger::Exception::BadFilter.new(:message => message)
+ raise PuppetDebugger::Exception::BadFilter, message: message
end
# fix for when --show-legacy facts are not part of the facter 3 fact set
- node_facts[:fqdn] = node_facts[:networking].fetch('fqdn',nil) unless node_facts[:fqdn]
+ node_facts[:fqdn] = node_facts[:networking].fetch('fqdn', nil) unless node_facts[:fqdn]
node_facts
end
def default_facts
unless @facts
- values = Hash[ node_facts.map { |k, v| [k.to_s, v] } ]
+ values = Hash[node_facts.map { |k, v| [k.to_s, v] }]
name = values['fqdn']
@facts ||= Puppet::Node::Facts.new(name, values)
end
@facts
end
def server_facts
data = {}
- data["servername"] = Facter.value("fqdn") || Facter.value('networking')['fqdn']
- data['serverip'] = Facter.value("ipaddress")
- data["serverversion"] = Puppet.version.to_s
+ data['servername'] = Facter.value('fqdn') || Facter.value('networking')['fqdn']
+ data['serverip'] = Facter.value('ipaddress')
+ data['serverversion'] = Puppet.version.to_s
data
end
-
end
end
end