package %w(McAfeeVSEForLinux MFEcma MFErt) do
action :remove # Remove a package
end
Then this.
%w(McAfeeVSEForLinux MFEcma MFErt).each do |pkg|
package pkg do
action :remove
end
end
chef-client debug output says removed.
* yum_package[McAfeeVSEForLinux] action remove[2020-02-03T16:27:02-05:00] INFO: Processing yum_package[McAfeeVSEForLinux] action remove (idt_cylance::remove_mcafee line 15)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: McAfeeVSEForLinux-0:1.9.0.28822-28822.noarch
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-03T16:27:05-05:00] INFO: yum_package[McAfeeVSEForLinux] removed
- remove package McAfeeVSEForLinux
* yum_package[MFEcma] action remove[2020-02-03T16:27:05-05:00] INFO: Processing yum_package[MFEcma] action remove (idt_cylance::remove_mcafee line 15)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFEcma-0:4.8.0-1500.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-03T16:27:06-05:00] INFO: yum_package[MFEcma] removed
- remove package MFEcma
* yum_package[MFErt] action remove[2020-02-03T16:27:06-05:00] INFO: Processing yum_package[MFErt] action remove (idt_cylance::remove_mcafee line 15)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFErt-0:2.0-0.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-03T16:27:07-05:00] INFO: yum_package[MFErt] removed
- remove package MFErt
It sort of looks like some pedantic package name matching on the Chef side that the yum command takes a looser approach to. In your first message, you see that the packages Chef is trying to remove have certain names:
McAfeeVSEForLinux-0:1.9.0.28822-28822.noarch
MFEcma-0:4.8.0-1500.i686
MFErt-0:2.0-0.i686
While the yum query shows the "arch" in a different location in the package name:
McAfeeVSEForLinux.noarch
MFEcma.i686
MFErt.i686
I'd try giving the package names to the package resource in that format, with the arch directly after the application name, to see if the package resource would find them.
The package name in the yum database is a quirky bit of metadata. So while your software identifies itself as "app-version.arch", the package name is stored differently in the database based on what was in the specfile (rpm buildfile) and the index key works from that. The command line tools for yum are probably doing some fuzzier matching on the package names, since it's going to ask the user to verify the removal in the process. It's been a few years since I've built rpms, but it used to be a common annoyance.
I gave this a try with arch. Same result. rpm's not removed.
yum_package 'McAfeeVSEForLinux' do
action :remove
arch 'noarch'
end
%w(MFEcma MFErt).each do |pkg|
yum_package pkg do
action :remove
arch 'i686'
end
end
* yum_package[McAfeeVSEForLinux] action remove[2020-02-04T12:03:19-05:00] INFO: Processing yum_package[McAfeeVSEForLinux] action remove (idt_cylance::remove_mcafee line 14)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: McAfeeVSEForLinux-0:1.9.2.29197-29197.noarch
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-04T12:03:24-05:00] INFO: yum_package[McAfeeVSEForLinux] removed
- remove package McAfeeVSEForLinux
* yum_package[MFEcma] action remove[2020-02-04T12:03:24-05:00] INFO: Processing yum_package[MFEcma] action remove (idt_cylance::remove_mcafee line 19)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFEcma-0:4.8.0-1938.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-04T12:03:25-05:00] INFO: yum_package[MFEcma] removed
- remove package MFEcma
* yum_package[MFErt] action remove[2020-02-04T12:03:25-05:00] INFO: Processing yum_package[MFErt] action remove (idt_cylance::remove_mcafee line 19)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFErt-0:2.0-1.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-04T12:03:26-05:00] INFO: yum_package[MFErt] removed
- remove package MFErt
yeah, i don't think arch is where the issue is, it's just in the package name itself. adding arch is appending to the end of the package-version, which is usually correct, while the package is tracked in the db as {package.arch}-version but {package.arch} is the actual package name key you'll want to use in the package resource. so it's giving you the same package not found message from before.
OK. This is the debug output using {package.arch} format.
yum_package 'McAfeeVSEForLinux.noarch' do
action :remove
end
%w(MFEcma.i686 MFErt.i686).each do |pkg|
yum_package pkg do
action :remove
end
end
* yum_package[McAfeeVSEForLinux.noarch] action remove[2020-02-04T12:54:36-05:00] INFO: Processing yum_package[McAfeeVSEForLinux.noarch] action remove (idt_cylance::remove_mcafee line 14)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: McAfeeVSEForLinux-0:1.9.2.29197-29197.noarch
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-04T12:54:38-05:00] INFO: yum_package[McAfeeVSEForLinux.noarch] removed
- remove package McAfeeVSEForLinux.noarch
* yum_package[MFEcma.i686] action remove[2020-02-04T12:54:38-05:00] INFO: Processing yum_package[MFEcma.i686] action remove (idt_cylance::remove_mcafee line 18)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFEcma-0:4.8.0-1938.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-04T12:54:39-05:00] INFO: yum_package[MFEcma.i686] removed
- remove package MFEcma.i686
* yum_package[MFErt.i686] action remove[2020-02-04T12:54:39-05:00] INFO: Processing yum_package[MFErt.i686] action remove (idt_cylance::remove_mcafee line 18)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFErt-0:2.0-1.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-04T12:54:41-05:00] INFO: yum_package[MFErt.i686] removed
- remove package MFErt.i686
yum_package 'McAfeeVSEForLinux-1.9.2.29197-29197.noarch' do
action :remove
end
%w(MFEcma-4.8.0-1938.i686 MFErt-2.0-1.i686).each do |pkg|
yum_package pkg do
action :remove
end
end
* yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] action remove[2020-02-05T09:47:03-05:00] INFO: Processing yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] action remove (idt_cylance::remove_mcafee line 14)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: McAfeeVSEForLinux-0:1.9.2.29197-29197.noarch
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-05T09:47:05-05:00] INFO: yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] removed
- remove package McAfeeVSEForLinux-1.9.2.29197-29197.noarch
* yum_package[MFEcma-4.8.0-1938.i686] action remove[2020-02-05T09:47:05-05:00] INFO: Processing yum_package[MFEcma-4.8.0-1938.i686] action remove (idt_cylance::remove_mcafee line 18)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFEcma-0:4.8.0-1938.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-05T09:47:06-05:00] INFO: yum_package[MFEcma-4.8.0-1938.i686] removed
- remove package MFEcma-4.8.0-1938.i686
* yum_package[MFErt-2.0-1.i686] action remove[2020-02-05T09:47:06-05:00] INFO: Processing yum_package[MFErt-2.0-1.i686] action remove (idt_cylance::remove_mcafee line 18)
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFErt-0:2.0-1.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-05T09:47:07-05:00] INFO: yum_package[MFErt-2.0-1.i686] removed
- remove package MFErt-2.0-1.i686
# yum list McAfeeVSEForLinux-1.9.2.29197-29197.noarch MFEcma-4.8.0-1938.i686 MFErt-2.0-1.i686
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Installed Packages
MFEcma.i686 4.8.0-1938 @idtcustomnoarch_disabled
MFErt.i686 2.0-1 @idtcustomnoarch_disabled
McAfeeVSEForLinux.noarch 1.9.2.29197-29197 installed
# rpm -q McAfeeVSEForLinux-1.9.2.29197-29197.noarch MFEcma-4.8.0-1938.i686 MFErt-2.0-1.i686
McAfeeVSEForLinux-1.9.2.29197-29197.noarch
MFEcma-4.8.0-1938.i686
MFErt-2.0-1.i686
# rpm -qi McAfeeVSEForLinux-1.9.2.29197-29197.noarch MFEcma-4.8.0-1938.i686 MFErt-2.0-1.i686
Name : McAfeeVSEForLinux Relocations: /opt/NAI/package/McAfeeVSEForLinux
Version : 1.9.2.29197 Vendor: (none)
Release : 29197 Build Date: Mon 28 Mar 2016 07:18:42 AM EDT
Install Date: Wed 05 Feb 2020 09:13:25 AM EST Build Host: MICBS1-UB1204-i386
Group : McAfee Source RPM: McAfeeVSEForLinux-1.9.2.29197-29197.src.rpm
Size : 111164 License: Proprietary
Signature : (none)
Packager : root
Summary : McAfee On-Access and On-Demand Scanning for Linux
Description :
McAfee On-Access & On-Demand Scanning for Linux
Name : MFEcma Relocations: (not relocatable)
Version : 4.8.0 Vendor: McAfee Inc.
Release : 1938 Build Date: Tue 10 Feb 2015 08:35:17 PM EST
Install Date: Wed 05 Feb 2020 09:13:15 AM EST Build Host: buildsrv-suse82_2.beabuild.lab
Group : Network/Agent Source RPM: MFEcma-4.8.0-1938.src.rpm
Size : 29005151 License: commercial. See the COPYRIGHT file for details.
Signature : (none)
Packager : McAfee Inc.
Summary : McAfee Agent
Description :
McAfee Agent for Linux
Name : MFErt Relocations: (not relocatable)
Version : 2.0 Vendor: McAfee Inc.
Release : 1 Build Date: Tue 10 Feb 2015 08:35:36 PM EST
Install Date: Wed 05 Feb 2020 09:13:09 AM EST Build Host: buildsrv-suse82_2.beabuild.lab
Group : System Source RPM: MFErt-2.0-1.src.rpm
Size : 6142328 License: commercial. See the COPYRIGHT file for details.
Signature : (none)
Packager : McAfee Inc.
Summary : Run time libraries
Description :
Run time libraries needed by McAfee products on Linux
Trace output doesn't seem to show any clues.
* yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] action remove[2020-02-05T10:55:18-05:00] INFO: Processing yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] action remove (idt_cylance::remove_mcafee line 14)
[2020-02-05T10:55:18-05:00] TRACE: Providers for generic yum_package resource enabled on node include: [Chef::Provider::Package::Yum]
[2020-02-05T10:55:18-05:00] TRACE: Provider for action remove on resource yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] is Chef::Provider::Package::Yum
[2020-02-05T10:55:19-05:00] TRACE: sending '{"action":"whatinstalled","provides":"McAfeeVSEForLinux-1.9.2.29197-29197.noarch"}' to python helper
[2020-02-05T10:55:19-05:00] TRACE: got 'McAfeeVSEForLinux 0:1.9.2.29197-29197 noarch' from python helper
[2020-02-05T10:55:19-05:00] TRACE: parsed McAfeeVSEForLinux-0:1.9.2.29197-29197.noarch from python helper
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: McAfeeVSEForLinux-0:1.9.2.29197-29197.noarch
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-05T10:55:20-05:00] INFO: yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] removed
- remove package McAfeeVSEForLinux-1.9.2.29197-29197.noarch
* yum_package[MFEcma-4.8.0-1938.i686] action remove[2020-02-05T10:55:20-05:00] INFO: Processing yum_package[MFEcma-4.8.0-1938.i686] action remove (idt_cylance::remove_mcafee line 18)
[2020-02-05T10:55:20-05:00] TRACE: Providers for generic yum_package resource enabled on node include: [Chef::Provider::Package::Yum]
[2020-02-05T10:55:20-05:00] TRACE: Provider for action remove on resource yum_package[MFEcma-4.8.0-1938.i686] is Chef::Provider::Package::Yum
[2020-02-05T10:55:20-05:00] TRACE: sending '{"action":"whatinstalled","provides":"MFEcma-4.8.0-1938.i686"}' to python helper
[2020-02-05T10:55:21-05:00] TRACE: got 'MFEcma 0:4.8.0-1938 i686' from python helper
[2020-02-05T10:55:21-05:00] TRACE: parsed MFEcma-0:4.8.0-1938.i686 from python helper
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFEcma-0:4.8.0-1938.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-05T10:55:21-05:00] INFO: yum_package[MFEcma-4.8.0-1938.i686] removed
- remove package MFEcma-4.8.0-1938.i686
* yum_package[MFErt-2.0-1.i686] action remove[2020-02-05T10:55:21-05:00] INFO: Processing yum_package[MFErt-2.0-1.i686] action remove (idt_cylance::remove_mcafee line 18)
[2020-02-05T10:55:21-05:00] TRACE: Providers for generic yum_package resource enabled on node include: [Chef::Provider::Package::Yum]
[2020-02-05T10:55:21-05:00] TRACE: Provider for action remove on resource yum_package[MFErt-2.0-1.i686] is Chef::Provider::Package::Yum
[2020-02-05T10:55:21-05:00] TRACE: sending '{"action":"whatinstalled","provides":"MFErt-2.0-1.i686"}' to python helper
[2020-02-05T10:55:22-05:00] TRACE: got 'MFErt 0:2.0-1 i686' from python helper
[2020-02-05T10:55:22-05:00] TRACE: parsed MFErt-0:2.0-1.i686 from python helper
Loaded plugins: fastestmirror, security
Setting up Remove Process
No Match for argument: MFErt-0:2.0-1.i686
Loading mirror speeds from cached hostfile
No Packages marked for removal
[2020-02-05T10:55:23-05:00] INFO: yum_package[MFErt-2.0-1.i686] removed
- remove package MFErt-2.0-1.i686
* yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] action remove[2020-02-05T16:41:34-05:00] INFO: Processing yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] action remove (idt_cylance::remove_mcafee line 14)
[2020-02-05T16:41:34-05:00] TRACE: Providers for generic yum_package resource enabled on node include: [Chef::Provider::Package::Yum]
[2020-02-05T16:41:34-05:00] TRACE: Provider for action remove on resource yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] is Chef::Provider::Package::Yum
[2020-02-05T16:41:34-05:00] TRACE: sending '{"action":"whatinstalled","provides":"McAfeeVSEForLinux-1.9.2.29197-29197.noarch"}' to python helper
[2020-02-05T16:41:35-05:00] TRACE: got 'McAfeeVSEForLinux 0:1.9.2.29197-29197 noarch' from python helper
[2020-02-05T16:41:35-05:00] TRACE: parsed McAfeeVSEForLinux-0:1.9.2.29197-29197.noarch from python helper
Loaded plugins: fastestmirror, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package McAfeeVSEForLinux.noarch 0:1.9.2.29197-29197 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
McAfeeVSEForLinux noarch 1.9.2.29197-29197 installed 109 k
Transaction Summary
================================================================================
Remove 1 Package(s)
Installed size: 109 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : McAfeeVSEForLinux-1.9.2.29197-29197.noarch 1/1
moncg: the McAfeeVSEForLinux Monitor is not running
nailsdctl: the McAfeeVSEForLinux daemon is not running
McAfee Agent is not running , can't notify.
Verifying : McAfeeVSEForLinux-1.9.2.29197-29197.noarch 1/1
Removed:
McAfeeVSEForLinux.noarch 0:1.9.2.29197-29197
Complete!
[2020-02-05T16:41:52-05:00] INFO: yum_package[McAfeeVSEForLinux-1.9.2.29197-29197.noarch] removed
- remove package McAfeeVSEForLinux-1.9.2.29197-29197.noarch
* yum_package[MFEcma-4.8.0-1938.i686] action remove[2020-02-05T16:41:52-05:00] INFO: Processing yum_package[MFEcma-4.8.0-1938.i686] action remove (idt_cylance::remove_mcafee line 18)
[2020-02-05T16:41:52-05:00] TRACE: Providers for generic yum_package resource enabled on node include: [Chef::Provider::Package::Yum]
[2020-02-05T16:41:52-05:00] TRACE: Provider for action remove on resource yum_package[MFEcma-4.8.0-1938.i686] is Chef::Provider::Package::Yum
[2020-02-05T16:41:52-05:00] TRACE: sending '{"action":"whatinstalled","provides":"MFEcma-4.8.0-1938.i686"}' to python helper
[2020-02-05T16:41:53-05:00] TRACE: got 'MFEcma 0:4.8.0-1938 i686' from python helper
[2020-02-05T16:41:53-05:00] TRACE: parsed MFEcma-0:4.8.0-1938.i686 from python helper
Loaded plugins: fastestmirror, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package MFEcma.i686 0:4.8.0-1938 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
MFEcma i686 4.8.0-1938 @idtcustomnoarch_disabled 28 M
Transaction Summary
================================================================================
Remove 1 Package(s)
Installed size: 28 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : MFEcma-4.8.0-1938.i686 1/1
Stopping and unregistering CMA start up script...
Killing McAfee Mesh Service...
Reverting linker cache ...
Stopping dependent services ...
Verifying : MFEcma-4.8.0-1938.i686 1/1
Removed:
MFEcma.i686 0:4.8.0-1938
Complete!
[2020-02-05T16:41:57-05:00] INFO: yum_package[MFEcma-4.8.0-1938.i686] removed
- remove package MFEcma-4.8.0-1938.i686
* yum_package[MFErt-2.0-1.i686] action remove[2020-02-05T16:41:57-05:00] INFO: Processing yum_package[MFErt-2.0-1.i686] action remove (idt_cylance::remove_mcafee line 18)
[2020-02-05T16:41:57-05:00] TRACE: Providers for generic yum_package resource enabled on node include: [Chef::Provider::Package::Yum]
[2020-02-05T16:41:57-05:00] TRACE: Provider for action remove on resource yum_package[MFErt-2.0-1.i686] is Chef::Provider::Package::Yum
[2020-02-05T16:41:57-05:00] TRACE: sending '{"action":"whatinstalled","provides":"MFErt-2.0-1.i686"}' to python helper
[2020-02-05T16:41:57-05:00] TRACE: got 'MFErt 0:2.0-1 i686' from python helper
[2020-02-05T16:41:57-05:00] TRACE: parsed MFErt-0:2.0-1.i686 from python helper
Loaded plugins: fastestmirror, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package MFErt.i686 0:2.0-1 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
MFErt i686 2.0-1 @idtcustomnoarch_disabled 5.9 M
Transaction Summary
================================================================================
Remove 1 Package(s)
Installed size: 5.9 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : MFErt-2.0-1.i686 1/1
Runtime uninstalled successfully
Verifying : MFErt-2.0-1.i686 1/1
Removed:
MFErt.i686 0:2.0-1
Complete!
[2020-02-05T16:42:00-05:00] INFO: yum_package[MFErt-2.0-1.i686] removed
- remove package MFErt-2.0-1.i686
# yum list McAfeeVSEForLinux-1.9.2.29197-29197.noarch MFEcma-4.8.0-1938.i686 MFErt-2.0-1.i686
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Error: No matching Packages to list