Great... thanks a lot

From: spacewalk-list-boun...@redhat.com 
[mailto:spacewalk-list-boun...@redhat.com] On Behalf Of Matt Moldvan
Sent: Dienstag, 18. Dezember 2018 17:56
To: spacewalk-list@redhat.com
Subject: Re: [Spacewalk-list] remove package in spacewalk repo

Have a look at 
https://github.com/sandwormusmc/spacewalk-api-scripts/tree/master/spacewalk-remove-old-packages

I made some updates there to check if a package is installed first before 
removing it, maybe it fits your use case and maybe the original version at 
https://github.com/angrox/spacewalk-api-scripts/tree/master/spacewalk-remove-old-packages
 is more suited to your needs.

I also wrapped that Python script in the following shell script (sorry about 
the formatting, Inbox mangled the copy/paste):


#!/bin/bash

SCRIPTNAME=$(basename ${0})

THISDATE=$(date +%F)

LOGPATH="/var/log/rhn/${SCRIPTNAME}"

if [ ! -d "${LOGPATH}" ]; then

        mkdir -p "${LOGPATH}"

fi

LOGFILE="${LOGPATH}/${SCRIPTNAME}.log"

LOCKFILE="/var/run/${SCRIPTNAME}.lck"

PIDFILE="/var/run/${SCRIPTNAME}.pid"

#exit 1

# Trap a Ctrl-C to clean up the lock file

trap ctrl_c INT TERM

function ctrl_c(){

        echo '*** WARNING, NUCLEAR WAR PROTOCOL ACTIVATED ***'

        echo '*** TRAPPED CTRL-C ***' >> "${LOGFILE}"

        rm "${LOCKFILE}" && rm "${PIDFILE}" && exit 1

}

trap sighup HUP

function sighup(){

        echo -e '\n*** TRAPPED SIGHUP ***'

        echo "Currently processing errata with ID ${ID}, issued on 
${ISSUE_DATE}..." | tee -a "${LOGFILE}"

}



if [ -f "${LOCKFILE}" ]; then

        echo "Lock file exists at ${LOCKFILE}!" | tee -a "${LOGFILE}"

        if [[ $(find "${LOCKFILE}" -mtime +1) ]]; then

                echo "Lock file at ${LOCKFILE} is older than 24 hours... 
removing and continuing." | tee -a "${LOGFILE}"

                rm "${LOCKFILE}"

        else

                echo "Lock file at ${LOCKFILE} is newer than 24 hours... 
exiting." | tee -a "${LOGFILE}"

                exit 1

        fi

else

        echo "PID $$ - ${SCRIPTNAME} started on $(date)" | tee -a "${LOGFILE}"

        touch "${LOCKFILE}"
fi

echo $$ > "${PIDFILE}"

PKGNUM=1000

/usr/bin/python /usr/local/bin/spacewalk-remove-old-packages.py -A -d -c 
/etc/rhn/spacewalk-api.cfg -m "${PKGNUM}" | tee -a 
/var/log/rhn/spacewalk-remove-old-packages.py.log

On Mon, Dec 17, 2018 at 7:57 AM Jérôme Meyer 
<jerome.me...@lcsystems.ch<mailto:jerome.me...@lcsystems.ch>> wrote:
Thanks a lot Dennis for your answer and help.

Regards, J.

From: 
spacewalk-list-boun...@redhat.com<mailto:spacewalk-list-boun...@redhat.com> 
[mailto:spacewalk-list-boun...@redhat.com<mailto:spacewalk-list-boun...@redhat.com>]
 On Behalf Of Dennis Pittman
Sent: Freitag, 14. Dezember 2018 10:52
To: spacewalk-list@redhat.com<mailto:spacewalk-list@redhat.com>; 
spacewalk-list@redhat.com<mailto:spacewalk-list@redhat.com>

Subject: Re: [Spacewalk-list] remove package in spacewalk repo

Quick answer is no, if you remove a package from the software channel / repo, 
it will not remove the package from 70 installed hosts. Unless you have other 
customized configuration channels.

Get Outlook for iOS<https://aka.ms/o0ukef>

________________________________
From: 
spacewalk-list-boun...@redhat.com<mailto:spacewalk-list-boun...@redhat.com> on 
behalf of Jérôme Meyer 
<jerome.me...@lcsystems.ch<mailto:jerome.me...@lcsystems.ch>>
Sent: Friday, December 14, 2018 4:47 AM
To: 'spacewalk-list@redhat.com<mailto:spacewalk-list@redhat.com>'
Subject: Re: [Spacewalk-list] remove package in spacewalk repo

This is what I need but this package is installed on many hosts, more than 70..
If I remove this package on spacewalk will do it uninstall on the machine? I 
don’t think so but I prefer to ask ;)

Thanks for your support
J.

From: 
spacewalk-list-boun...@redhat.com<mailto:spacewalk-list-boun...@redhat.com> 
[mailto:spacewalk-list-boun...@redhat.com] On Behalf Of Dennis Pittman
Sent: Donnerstag, 13. Dezember 2018 20:28
To: spacewalk-list@redhat.com<mailto:spacewalk-list@redhat.com>
Subject: Re: [Spacewalk-list] remove package in spacewalk repo

To add to the last response you may have to remove the package if it’s still 
listed in a softwarechannel

spacecmd package_detail libmspack-0.7 # list the details about the package
spacecmd package_remove libmspack-0.7  # remove the package.  This will work 
when the remove_orphan does not, If the package is not orphaned

Dennis J. Pittman
(e)      djpit...@outlook.com<mailto:djpit...@outlook.com>
(m)    919-426-8907<tel:(919)%20426-8907>
(a)     310 Acorn Hollow Pl., Durham, NC 27703

From: 
spacewalk-list-boun...@redhat.com<mailto:spacewalk-list-boun...@redhat.com> 
[mailto:spacewalk-list-boun...@redhat.com] On Behalf Of William Hongach
Sent: Thursday, December 13, 2018 2:20 PM
To: spacewalk-list@redhat.com<mailto:spacewalk-list@redhat.com>
Subject: Re: [Spacewalk-list] remove package in spacewalk repo

Hello,

To clarify, are you referring to packages that have been downloaded locally and 
pushed to Spacewalk?  If so, an unwanted package that is no longer part of a 
software channel can be listed and removed as follows:

spacecmd package_listorphans
spacecmd package_removeorphans

This will check for dependencies and remove it from both the Spacewalk database 
as well as the filesystem.  You can also check the filesystem against the 
database and vice versa as follows:

spacewalk-data-fsck -f
spacewalk-data-fsck -d

From: 
spacewalk-list-boun...@redhat.com<mailto:spacewalk-list-boun...@redhat.com> 
<spacewalk-list-boun...@redhat.com<mailto:spacewalk-list-boun...@redhat.com>> 
On Behalf Of Jérôme Meyer
Sent: Thursday, December 13, 2018 11:16 AM
To: 'spacewalk-list@redhat.com<mailto:spacewalk-list@redhat.com>' 
<spacewalk-list@redhat.com<mailto:spacewalk-list@redhat.com>>
Subject: [Spacewalk-list] remove package in spacewalk repo

Hi,

It is possible to remove unwanted package in spacewalk repository?
In my dev-epel channel there’s a package that is no longer available 
(libmspack-0.7).

Could I delete it? Can it result a dependency problem?...and how to do that?

Thank in advance
Regards,
J.
_______________________________________________
Spacewalk-list mailing list
Spacewalk-list@redhat.com<mailto:Spacewalk-list@redhat.com>
https://www.redhat.com/mailman/listinfo/spacewalk-list

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Spacewalk-list mailing list
Spacewalk-list@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to