Project

General

Profile

Bug #3413

'Package management for RHEL / CentOS / SuSE / RPM systems: Removing a package returns an error because of Rug which returns 1 if package already removed

Added by Nicolas PERRON over 5 years ago. Updated over 1 year ago.

Status:
Rejected
Priority:
N/A
Assignee:
-
Category:
Techniques
Target version:
Target version (plugin):
Severity:
User visibility:
Effort required:
Pull Request:
Priority:

Description

With the Technique RUG / YaST package manager configuration (ZMD), removing package which are not on the system returns an error. This is caused by Rug which will returns 1 if we try to remove a package which is not installed.


Related issues

Related to Rudder - Bug #3479: (ex-PT/Technique) Package management for RHEL / CentOS / SuSE / RPM systems: Rug prevent from having a good reporting when trying to install or remove a packageRejected

History

#1 Updated by Jonathan CLARKE over 5 years ago

This looks like it's the same issue as #3478

#2 Updated by Jonathan CLARKE over 5 years ago

Jonathan CLARKE wrote:

This looks like it's the same issue as #3478

Whoops, I mean #3479

#3 Updated by Nicolas PERRON over 5 years ago

  • Status changed from New to In progress
  • Assignee set to Nicolas PERRON

I'm pretty sure that #3479 is related to this ticket. I'm on it.

#4 Updated by Nicolas PERRON over 5 years ago

On SLES 10, we have to use Rug instead of Zypper but the error came from Rug:

sles-10-sp4-32:~ # rug install rudder-agent
ERROR: 'rudder-agent' is not available.
sles-10-sp4-32:~ # echo $?
1
sles-10-sp4-32:~ # 
sles-10-sp4-32:~ # rug se rudder

S | Catalog   | Bundle | Name         | Version                 | Arch
--+-----------+--------+--------------+-------------------------+-----
i | Rudder2.6 |        | rudder-agent | 2.6.2.release-1.SLES.10 | i586

sles-10-sp4-32:~ # zypper install rudder-agent
Restoring system sources...
Parsing metadata for SUSE Linux Enterprise Server 10 SP4...
Parsing RPM database...
skipping package 'rudder-agent' (already installed)
Summary:
Nothing to do.
sles-10-sp4-32:~ # echo $?
0
sles-10-sp4-32:~ # zypper se rudder
Restoring system sources...
Parsing metadata for SUSE Linux Enterprise Server 10 SP4...
Parsing metadata for NormaCFEngine...
S | Catalog | Type    | Name         | Version                            | Arch
--+---------+---------+--------------+------------------------------------+-----
i |         | package | rudder-agent | 1398866025:2.6.2.release-1.SLES.10 | i586

#5 Updated by Nicolas PERRON over 5 years ago

I can't understand... maybe my OS is broken but I had an error about the installation of a package even if it was available.

sles-10-sp3-64:~ # rug se tree

S | Catalog | Bundle | Name               | Version     | Arch  
--+---------+--------+--------------------+-------------+-------
  | x86_64  |        | perl-HTML-Tree     | 3.1901-12.4 | x86_64
  | x86_64  |        | python-elementtree | 1.2.6-18.2  | x86_64
  | x86_64  |        | tree               | 1.5.0-13.2  | x86_64

sles-10-sp3-64:~ # /var/rudder/cfengine-community/bin/cf-agent -KI
 !! Duplicate selection of value for variable "execRun" in scope g
 !! Rule from /var/rudder/cfengine-community/inputs/common/1.0/site.cf at/before line 70
 !! Duplicate selection of value for variable "execRun" in scope g
[...]
R: @@packageInstallation@@result_error@@b1cdc707-e606-45b9-accb-57631a32a2d1@@ad57e582-0c50-49bd-bbea-cb98d2e6ce0d@@6@@RHEL/CentOS/SuSE packages@@tree@@2013-06-12 18:19:38+02:00##33736fca-16c2-448d-81cf-fca046e6da12@#Error taking action for RPM package tree with policy: add
[...]

After an manual installation, A success was returned:

sles-10-sp3-64:~ # rug in tree
Resolving Dependencies...
[...]
Proceed with transaction? (y/N) y
[...]
Transaction Finished

sles-10-sp3-64:~ # rug in tree
ERROR: 'tree' is not available.

sles-10-sp3-64:~ # rug se tree

S | Catalog | Bundle | Name               | Version     | Arch  
--+---------+--------+--------------------+-------------+-------
  | x86_64  |        | perl-HTML-Tree     | 3.1901-12.4 | x86_64
  | x86_64  |        | python-elementtree | 1.2.6-18.2  | x86_64
i | x86_64  |        | tree               | 1.5.0-13.2  | x86_64

sles-10-sp3-64:~ # /var/rudder/cfengine-community/bin/cf-agent -KI
[...]
R: @@packageInstallation@@result_success@@b1cdc707-e606-45b9-accb-57631a32a2d1@@ad57e582-0c50-49bd-bbea-cb98d2e6ce0d@@6@@RHEL/CentOS/SuSE packages@@tree@@2013-06-12 18:22:04+02:00##33736fca-16c2-448d-81cf-fca046e6da12@#No action required for RPM package tree with policy: add
[...]

After the manual removal of the package, success is still reported!

sles-10-sp3-64:~ # rug remove tree
Resolving Dependencies...
[...]
Proceed with transaction? (y/N) y
[...]
Transaction Finished

sles-10-sp3-64:~ # rug se tree

S | Catalog | Bundle | Name               | Version     | Arch  
--+---------+--------+--------------------+-------------+-------
  | x86_64  |        | perl-HTML-Tree     | 3.1901-12.4 | x86_64
  | x86_64  |        | python-elementtree | 1.2.6-18.2  | x86_64
  | x86_64  |        | tree               | 1.5.0-13.2  | x86_64

sles-10-sp3-64:~ # /var/rudder/cfengine-community/bin/cf-agent -KI
[...]
R: @@packageInstallation@@result_success@@b1cdc707-e606-45b9-accb-57631a32a2d1@@ad57e582-0c50-49bd-bbea-cb98d2e6ce0d@@6@@RHEL/CentOS/SuSE packages@@tree@@2013-06-12 18:28:16+02:00##33736fca-16c2-448d-81cf-fca046e6da12@#No action required for RPM package tree with policy: add
[...]

#6 Updated by Nicolas PERRON over 5 years ago

It doesn't seem to be related to the return code of Rug:

sles-10-sp3-64:~ # rug se net-snmp 

S | Catalog | Bundle | Name           | Version          | Arch  
--+---------+--------+----------------+------------------+-------
i | x86_64  |        | net-snmp       | 5.3.0.1-25.32.32 | x86_64
  | x86_64  |        | net-snmp-32bit | 5.3.0.1-25.32.32 | x86_64
  | x86_64  |        | net-snmp-devel | 5.3.0.1-25.32.32 | x86_64
  | x86_64  |        | perl-Net-SNMP  | 5.2.0-12.2       | x86_64

sles-10-sp3-64:~ # rug in net-snmp
ERROR: 'net-snmp' is not available.

sles-10-sp3-64:~ # echo $?
1

Nevertheless in the CFEngine code (rpmPackageInstallation/4.0/rpmPackageInstallation.st), CFEngine should be based on the return code of rug and the 1 is considered as error:

SuSE_10::
        package_changes => "individual";

        package_list_command => "/bin/rpm -qa --queryformat \"i | repos | %{name} | %{version}-%{release} | %{arch}\n\"";
[...]
        package_patch_installed_regex => ".*Installed.*|.*Not Applicable.*";
        package_patch_name_regex    => "[^|]+\|\s+([^\s]+).*";
[...]
        package_add_command => "/usr/bin/rug install -y";
[...]
}

body classes class_trigger_rpm_retcodes(if,else,kept, persist)
{
        promise_kept => { "$(kept)" };
        promise_repaired => { "$(if)" };
        repair_failed => { "$(else)" };
        repair_denied    => { "$(else)" };
        repair_timeout   => { "$(else)" };

        # yum and rpm return 0 for almost anything so no difference between kept and repaired here
        kept_returncodes => { "0" };
        failed_returncodes => { "1" };

  persist_time       => "${persist}";
}

I prefered that someone else check about this bug since I've some difficult to understand

#7 Updated by Nicolas PERRON over 5 years ago

Another information to know, it seems that the classes to report are wrong:

For repaired

[...]
        ifvarclass => canonify("rpm_package_installed_${index_rpmpkg}");
[...]

For success
[...]
        ifvarclass => canonify("rpm_package_install_kept_${index_rpmpkg}");
[...]

This is not sufficient since CFEngine could have a different state at each pass and an example is here for the package scanlogd:

sles-10-sp3-64:~ # /var/rudder/cfengine-community/bin/cf-agent -KIb check_rpm_package_installation
[...]
R: @@packageInstallation@@result_error@@ee5ae6a0-f5d3-461c-89fd-95f0a7eb4399@@a5b9b629-a69e-46b6-9aaa-99d9d3683efb@@1@@RHEL/CentOS/SuSE packages@@scanlogd@@2013-06-13 11:06:16+02:00##33736fca-16c2-448d-81cf-fca046e6da12@#Error taking action for RPM package scanlogd with policy: add
[...]
R: @@packageInstallation@@result_success@@ee5ae6a0-f5d3-461c-89fd-95f0a7eb4399@@a5b9b629-a69e-46b6-9aaa-99d9d3683efb@@1@@RHEL/CentOS/SuSE packages@@scanlogd@@2013-06-13 11:06:16+02:00##33736fca-16c2-448d-81cf-fca046e6da12@#No action required for RPM package scanlogd with policy: add
[...]

#8 Updated by Nicolas PERRON over 5 years ago

  • Assignee deleted (Nicolas PERRON)

#9 Updated by Benoît PECCATTE over 3 years ago

  • Project changed from Techniques to Rudder
  • Category set to Techniques

#10 Updated by François ARMAND over 3 years ago

  • Status changed from In progress to 8

#11 Updated by François ARMAND over 3 years ago

  • Status changed from 8 to New

#12 Updated by Benoît PECCATTE over 2 years ago

  • Target version set to 2.11.21

#13 Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 2.11.21 to 2.11.22

#14 Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 2.11.22 to 2.11.23

#15 Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 2.11.23 to 2.11.24

#16 Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 2.11.24 to 308

#17 Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 308 to 3.1.14

#18 Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 3.1.14 to 3.1.15

#19 Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 3.1.15 to 3.1.16

#20 Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 3.1.16 to 3.1.17

#21 Updated by Vincent MEMBRÉ almost 2 years ago

  • Target version changed from 3.1.17 to 3.1.18

#22 Updated by Vincent MEMBRÉ over 1 year ago

  • Target version changed from 3.1.18 to 3.1.19

#23 Updated by Benoît PECCATTE over 1 year ago

  • Subject changed from (ex-PT/Technique) RUG / YaST package manager configuration (ZMD): Removing a package returns an error because of Rug which returns1 if package already removed to 'Package management for RHEL / CentOS / SuSE / RPM systems: Removing a package returns an error because of Rug which returns 1 if package already removed

#24 Updated by François ARMAND over 1 year ago

  • Status changed from New to Rejected

Rug is not supported anymore \o/ User the new "Package" technique from Rudder 4.0

Also available in: Atom PDF