Skip to content

Commit

Permalink
Use rpm -q rsyslog rather rpm -qa rsyslog
Browse files Browse the repository at this point in the history
Comparing the time for rpm -qa vs rpm -q

```
$ time rpm -qa --qf "%{VERSION}" "rsyslog"
7.4.7
real    0m1.638s
user    0m1.498s
sys     0m0.132s
```

vs

```
$ time rpm -q --qf "%{VERSION}" "rsyslog"
7.4.7
real    0m0.033s
user    0m0.026s
sys     0m0.005s
```

So that saves 1 second per puppet run.
  • Loading branch information
traylenator committed Apr 7, 2017
1 parent 8fd0ece commit ed6609f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/facter/rsyslog_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Facter::Util::Resolution.exec("rsyslogd -v | head -n 1 | awk '{print $2}' | sed 's/,//g'")
else
# Fall back to rpm to determine version
command = 'rpm -qa --qf "%{VERSION}" "rsyslog"'
command = 'rpm -q --qf "%{VERSION}" "rsyslog"'
version = Facter::Util::Resolution.exec(command)
Regexp.last_match(1) if version =~ %r{^(.+)$}
end
Expand Down

1 comment on commit ed6609f

@otheus
Copy link

@otheus otheus commented on ed6609f Oct 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes issue #288

Please sign in to comment.