Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpm_package, yum_package, package failing under Chef Habitat but works with Chef Infra Client #10143

Closed
Swampcritter opened this issue May 13, 2020 · 1 comment

Comments

@Swampcritter
Copy link

Description

Currently our AWS automation environment uses Chef Habitat to install a series of 'base tools' to each of the Linux and Window instances we stand up. Just recently, we noticed that one of our 'tools' which requires the deployment of an RPM file is failing.

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

-AND-

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

HOWEVER, if I were to run the chef-client -r recipe[wabtec_nessus] cookbook above from the command line, the installation works flawlessly with either version of the recipe above.

For debugging purposes, I ran the rpm queryformat at the command line to see what it sees:

rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}\n' NessusAgent-7.4.3-es7.x86_64.rpm
NessusAgent (none) 7.4.3 es7 x86_64

It seems that the %{EPOCH} is deeming the (none) as a null value, but since it cannot query against it, the rpm command fails.

Chef Version

It happens under both Chef Infa Client, version 15.9.17 and version 16.0.257

Platform Version

CentOS Linux, Version 7.x

Replication Case

Under Chef Habitat, when our wabtec_nessus cookbook is triggered, we get this message:

Caused by Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}
' /hab/svc/wabtec_base_tools/data/cache/cache/NessusAgent-7.4.3-es7.x86_64.rpm ----
STDOUT:
STDERR: rpm: unrecognized option: -

Client Output

chef-client -r recipe[wabtec_nessus] -- cookbook completes under command line.

Stacktrace

Generated at 2020-05-07 14:20:19 +0000
Mixlib::ShellOut::ShellCommandFailed: yum_package[NessusAgent-7.4.3-es7.x86_64] (wabtec_nessus::linux line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}
' /hab/svc/wabtec_base_tools/data/cache/cache/NessusAgent-7.4.3-es7.x86_64.rpm ----
STDOUT:
STDERR: rpm: unrecognized option: -
BusyBox v1.29.2 (2019-01-15 01:45:56 UTC) multi-call binary.

Usage: rpm -i PACKAGE.rpm; rpm -qp[ildc] PACKAGE.rpm

Manipulate RPM packages

Commands:
-i Install package
-qp Query package
-qpi Show information
-qpl List contents
-qpd List documents
-qpc List config files
---- End output of rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}
' /hab/svc/wabtec_base_tools/data/cache/cache/NessusAgent-7.4.3-es7.x86_64.rpm ----
Ran rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}
' /hab/svc/wabtec_base_tools/data/cache/cache/NessusAgent-7.4.3-es7.x86_64.rpm returned 1
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/bundle/ruby/2.7.0/gems/mixlib-shellout-3.0.9/lib/mixlib/shellout.rb:300:in invalid!' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/bundle/ruby/2.7.0/gems/mixlib-shellout-3.0.9/lib/mixlib/shellout.rb:287:in error!'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/mixin/shell_out.rb:127:in shell_out_compacted!' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/mixin/shell_out.rb:60:in shell_out!'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:206:in resolve_source_to_version_obj' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:221:in available_version'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:233:in installed_version' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:85:in block in get_current_versions'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in each' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in each_with_index'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in each' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in map'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in get_current_versions' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:62:in load_current_resource'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider.rb:203:in run_action' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource.rb:591:in run_action'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:74:in run_action' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:108:in block in run_all_actions'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:108:in each' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:108:in run_all_actions'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:132:in block in converge' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/resource_list.rb:96:in block in execute_each_resource'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/stepable_iterator.rb:115:in call_iterator_block' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/stepable_iterator.rb:86:in step'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/stepable_iterator.rb:104:in iterate' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/resource_list.rb:94:in execute_each_resource' /hab/pkgs/core/ruby27/2.7.0/20200404045319/lib/ruby/2.7.0/forwardable.rb:235:in execute_each_resource'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:130:in converge' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:714:in block in converge'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:709:in catch' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:709:in converge'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:733:in converge_and_save' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:288:in run'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application.rb:292:in run_with_graceful_exit_option' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application.rb:268:in block in run_chef_client'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/local_mode.rb:42:in with_server_connectivity' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application.rb:251:in run_chef_client'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application/base.rb:335:in run_application' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application.rb:68:in run'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/chef-bin/bin/chef-client:25:in <top (required)>' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/bin/chef-client:14:in load'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/bin/chef-client:14:in `

'

Caused by Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}
' /hab/svc/wabtec_base_tools/data/cache/cache/NessusAgent-7.4.3-es7.x86_64.rpm ----
STDOUT:
STDERR: rpm: unrecognized option: -
BusyBox v1.29.2 (2019-01-15 01:45:56 UTC) multi-call binary.

Usage: rpm -i PACKAGE.rpm; rpm -qp[ildc] PACKAGE.rpm

Manipulate RPM packages

Commands:
-i Install package
-qp Query package
-qpi Show information
-qpl List contents
-qpd List documents
-qpc List config files
---- End output of rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}
' /hab/svc/wabtec_base_tools/data/cache/cache/NessusAgent-7.4.3-es7.x86_64.rpm ----
Ran rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}
' /hab/svc/wabtec_base_tools/data/cache/cache/NessusAgent-7.4.3-es7.x86_64.rpm returned 1
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/bundle/ruby/2.7.0/gems/mixlib-shellout-3.0.9/lib/mixlib/shellout.rb:300:in invalid!' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/bundle/ruby/2.7.0/gems/mixlib-shellout-3.0.9/lib/mixlib/shellout.rb:287:in error!'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/mixin/shell_out.rb:127:in shell_out_compacted!' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/mixin/shell_out.rb:60:in shell_out!'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:206:in resolve_source_to_version_obj' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:221:in available_version'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:233:in installed_version' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:85:in block in get_current_versions'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in each' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in each_with_index'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in each' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in map'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:84:in get_current_versions' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider/package/yum.rb:62:in load_current_resource'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/provider.rb:203:in run_action' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource.rb:591:in run_action'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:74:in run_action' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:108:in block in run_all_actions'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:108:in each' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:108:in run_all_actions'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:132:in block in converge' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/resource_list.rb:96:in block in execute_each_resource'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/stepable_iterator.rb:115:in call_iterator_block' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/stepable_iterator.rb:86:in step'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/stepable_iterator.rb:104:in iterate' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/resource_collection/resource_list.rb:94:in execute_each_resource' /hab/pkgs/core/ruby27/2.7.0/20200404045319/lib/ruby/2.7.0/forwardable.rb:235:in execute_each_resource'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/runner.rb:130:in converge' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:714:in block in converge'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:709:in catch' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:709:in converge'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:733:in converge_and_save' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/client.rb:288:in run'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application.rb:292:in run_with_graceful_exit_option' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application.rb:268:in block in run_chef_client'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/local_mode.rb:42:in with_server_connectivity' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application.rb:251:in run_chef_client'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application/base.rb:335:in run_application' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/lib/chef/application.rb:68:in run'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/chef/chef-bin/bin/chef-client:25:in <top (required)>' /hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/bin/chef-client:14:in load'
/hab/pkgs/chef/chef-infra-client/16.0.257/20200428080931/bin/chef-client:14:in `

'

@tas50 tas50 transferred this issue from chef/chef-server Jul 10, 2020
@lamont-granquist
Copy link
Contributor

dup of #9866

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants