Prevent rpm queryformat at install step

Is there a way to prevent the 'queryformat' step when using rpm_package, yum_package or even the newer 'package' function (any of the three cause the issue to appear)? Each time an RPM package recipe attempts to run, we keep getting an invalid error:

End output of rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}

Recipe code that is not installing via Habitat but works fine via chef-client manual install:

package 'nessus' do
source "#{Chef::Config[:file_cache_path]}/NessusAgent-7.4.3-es7.x86_64.rpm"
package_name 'NessusAgent-7.4.3-es7.x86_64'
action :install
end

A couple different things. Try using the version property for the package function and don't use package_name. You could also try using the yum_package function instead. It might be more compatible with habitat.

I've tried using rpm_package, yum_package and package. All of them give the same results when running through Chef Habitat. I'll try the version setting and report on what happens.

What's wierd is if I do the manual command ("chef-client -r recipe[wabtec_nessus]") from the command line, it runs fine and deploys the RPM without any issues. Is Habitat doing something extra we are just not seeing?

Habitat is more current and sometimes older features become obsolete. Sometimes you have to hunt down compatible functions. Usually if you look at all the release notes for habitat version releases it will tell you want doesn't work and what does. Not always the case but just a guess at this point.

Any luck getting the nessus rpm install through Habitat?

Nope. Been working with Chef support and actually discovered there is an open bug on the issue. I just added my 2 cents worth to the issue since it's related.

dnf_package, are you using RHEL 8?

Nope, CentOS 7 and RHEL 7. Bug appears on those platforms as well.

Ok, I thought the dnf_package function was only used for Fedora and Rhel 8.

dnf_package is for v8, however the bug is affecting yum_package, rpm_package and the newer 'package' resource as well.

The problem is coming from Chef Habitat rpm -qp --queryformat. It's looking for %{EPOCH} and if its null, it breaks the rpm query, thus fails.

Since there are a number of working parts here and no straight answers from anyone I have reached out to on the Chef front, I put a few bug reports out there to see who's issue is really is: