Ask Your Question
0

Removing a Package if files are absent

asked 2016-09-20 14:57:36 -0600

puser gravatar image

Hello,

I have a package that I have in as an rpm. It installs the package initially and then checks to make sure it is installed. However if someone deletes important files within in this package then this is useless because the package is still installed but important files are no longer there. Therefore I would like to check if certain files are missing then to uninstall the package and reinstall it. Is there a way to do this?

thanks,

edit retag flag offensive close merge delete

Comments

maybe you could come up with an "exec" resource that called "rpm -V your-rpm-package-name" and if that revealed that there was something wrong with the RPM's file it could execute "yum reinstall your-rpm-package-name".

Red Cricket gravatar imageRed Cricket ( 2016-09-21 02:30:05 -0600 )edit

This is exactly what I needed. Thanks!

puser gravatar imagepuser ( 2016-09-21 07:28:00 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-09-21 01:26:28 -0600

lupin gravatar image

updated 2016-09-21 01:27:40 -0600

You put the file under Puppet management, that way if it got deleted it will be re-created with same contents and permission and hopefully your apps will function as it was before. Puppet File resource will not overwrite the file if it already exists as long as the contents and other attribute are similar.

edit flag offensive delete link more

Comments

If the file is deleted and re-created on the next run it is going to be empty. The RPM Package contains the contents of the file so I cannot ensure that the contents are the same can I?

puser gravatar imagepuser ( 2016-09-21 07:09:28 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2016-09-20 14:57:36 -0600

Seen: 67 times

Last updated: Sep 21 '16