Question about yum provider of package resource ?

59 views
Skip to first unread message

Richard

unread,
Dec 5, 2014, 2:50:10 AM12/5/14
to puppet...@googlegroups.com
Hi!
          I intsalled mysql through puppet using 'mysql-server' as package name , but when i want to remove mysql from my centos6.3 system, i get some problems.
          first i change the package attribute ensure => 'absent', then i run command 'puppet agent -t' on puppet agent, and puppet run successful. 
          but when i run command 'rpm -qa| grep mysql' , i find that  mysql still in my system.
mysql-connector-java-5.1.17-6.el6.noarch
mysql-community-release-el6-5.noarch
mysql-community-client-5.6.22-2.el6.x86_64
mysql-community-common-5.6.22-2.el6.x86_64
mysql-community-libs-5.6.22-2.el6.x86_64
          
          so i run 'puppet agent -t --debug' command to find out what happened. i get some debug messages:
Debug: Prefetching yum resources for package
Debug: Executing '/bin/rpm --version'
Debug: Executing '/bin/rpm -qa --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n''
Debug: Executing '/bin/rpm -q mysql --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'
Debug: /Stage[main]/Main/Node[oncecloud.agent2]/Package[mysql-server]: Nothing to manage: no ensure and the resource doesn't exist
          
          i want to know how to set yum provider or package attribute to make package using yum command to remove mysql not rpm command.

Richard

unread,
Dec 5, 2014, 3:17:22 AM12/5/14
to puppet...@googlegroups.com
when i set the ensure to purged not absent, i find that i remove mysql-sever package from my system and puppet agent run command ' yum -y erase mysql-server ' at debug messages

在 2014年12月5日星期五UTC+8下午3时50分10秒,Richard写道:

Thomas Hager

unread,
Dec 5, 2014, 3:19:03 AM12/5/14
to puppet...@googlegroups.com
On 2014-12-05 08:50, Richard wrote:
>> Hi!
Hi,

[...]
> but when i run command 'rpm -qa| grep mysql' , i find that mysql
> still in my system.
>
>> mysql-connector-java-5.1.17-6.el6.noarch
>> mysql-community-release-el6-5.noarch
>> mysql-community-client-5.6.22-2.el6.x86_64
>> mysql-community-common-5.6.22-2.el6.x86_64
>> mysql-community-libs-5.6.22-2.el6.x86_64
The package resource you manage is "mysql-server". On Redhat based
systems, the package type
uses yum to install packages, which takes care of resolving dependencies
and automatically
installs all packages the mysql-server package requires, like the libs
or common packages.

With ensure => absent, Puppet reomves the "mysql-server" package, which
also happened
in your case, as the mysql-server package is no longer installed. The
packages you see are
libraries and other tools installed as a dependency for mysql-server or
other packages.

[...]
> i want to know how to set yum provider or package attribute to make
> package using yum command to remove mysql not rpm command.
You don't, because it wouldn't make any difference. Yum basically is
nothing more than a
front-end for rpm, which handles remote repositories and dependency
resolving. Under the hood,
yum uses rpm for installing and removing packages.

Hth,
Tom.

Richard

unread,
Dec 5, 2014, 4:07:33 AM12/5/14
to puppet...@googlegroups.com
thanks very much. 

在 2014年12月5日星期五UTC+8下午3时50分10秒,Richard写道:

jcbollinger

unread,
Dec 5, 2014, 9:04:57 AM12/5/14
to puppet...@googlegroups.com


The 'yum' provider's use of 'rpm' to ensure a package 'absent' is intentional and correct.  It avoids causing yum to remove unmanaged packages that depend on the one you try to ensure 'absent', which can be catastrophic, and which furthermore runs against Puppet's design philosophy of avoiding side effects on unmanaged resources and resource properties,

In any case, although the yum provider would use the 'yum' command to ensure package 'mysql-server' to be 'purged', that would still not remove the listed packages you find remaining on your system, because mysql-server depends on them, not the other way around.


John

 

Richard

unread,
Dec 7, 2014, 8:15:17 PM12/7/14
to puppet...@googlegroups.com
HI John, I'm so sorry,I just saw you reply. I just find these problems today, thanks for your prompts.

在 2014年12月5日星期五UTC+8下午10时04分57秒,jcbollinger写道:
Reply all
Reply to author
Forward
0 new messages