Hello Friends, good morning
A few days ago I was looking for a way to add errata information in Spacewalk, because is very useful this feature. When using RHN Satellite, this kind of information come automatically, but using SW we have some steps to do. Today I’ll show you how configure to add errata information in our Spacewalk (named as SW too).
We are using to this lab the version 2.2 running over CentOS 6.6.
Ok, we have in nowadays 2 ready scripts bundle to add Errata in your own SW, in this post, we will use the Ya-Errata (https://github.com/liedekef/spacewalk_scripts), there are some nice scripts in Franky Repository, but we will check two specifics scripts “centos-clone-errata-full.sh” and “centos-clone-errata.sh“, but before, let’me talk about announces.
All the time, when a new announce happened in CentOS official Mail list, this is stored in archive files, where can be accessed here (http://lists.centos.org/pipermail/centos/index.html), if you click in Date, looking for announce, and you will find a info like “[CentOS] CentOS-announce Digest, Vol 118, Issue 1 centos-announce-request at centos.org“, inside this message, it is possible check information about packages related to Errata (enhancement, bugfix or security advisory).
1. CEEA-2014:1918 CentOS 6 oprofile Enhancement Update
2. CESA-2014:1911 Moderate CentOS 6 ruby Security Update
3. CESA-2014:1912 Moderate CentOS 7 ruby Security Update
4. CEEA-2014:1917 CentOS 7 ibus-hangul FASTTRACK Enhancement
Update (Johnny Hughes)
So, what we have to do is, collect these emails information and after, process to collect what we need about information to load our Errata data base information. Easy uhnn :-).
Ok, let’s start, our SW hostname is spacewalk and we don’t have errata yet, so we need prepare the environment to download the ya-errata and customize it.
To check erratas in the system, you can use spacewalk-report, as bellow:
[root@spacewalk ~]# spacewalk-report errata-list-all
Before continue, we have a pre-req to use this script, to fix let’s run the command bellow:
[root@spacewalk ~]# yum install perl-Text-Unidecode -y
[root@spacewalk ~]# yum install perl-XML-Simple -y
Execute the commands bellow:
[root@spacewalk ~]# mkdir -p /usr/apps
[root@spacewalk ~]# cd /usr/apps
[root@spacewalk apps]# wget https://github.com/liedekef/spacewalk_scripts/archive/master.zip
[root@spacewalk apps]# unzip master.zip
Will be created a folder named spacewalk_scripts-master
[root@spacewalk apps]# cd spacewalk_scripts-master/
let’s check what we have here ….
[root@spacewalk spacewalk_scripts-master]# ll
-rwxr-xr-x. 1 root root 3937 Nov 7 11:51 centos-clone-errata-full.sh
-rwxr-xr-x. 1 root root 3567 Nov 7 11:51 centos-clone-errata.sh
-rw-r–r–. 1 root root 2291 Nov 7 11:51 epel-clone-errata.sh
-rw-r–r–. 1 root root 1494 Nov 7 11:51 oel-clone-errata.sh
-rw-r–r–. 1 root root 3071 Nov 7 11:51 README.md
-rwxr-xr-x. 1 root root 1398 Nov 7 11:51 redhat-clone-errata.sh
-rw-r–r–. 1 root root 243 Nov 7 11:51 usage.txt
-rw-r–r–. 1 root root 130 Nov 7 11:51 ya-errata-import.cfg
-rwxr-xr-x. 1 root root 47103 Nov 7 11:51 ya-errata-import.pl
Now, as I told before, we have 2 main files that we will configure and use, centos-clone-errata-full.sh and centos-clone-errata.sh, the difference between them is centos-clone-errata-full.sh will check the announce since 2004 until now, so will populate your errata database with all information available in CentOS Mail List that match with files in your repository. In centos-clone-errata.sh you will define the quantity of digests (normally 1 errata per day), so the default value is 5 and the maximum is 28 (one month in general). If you add 60 days for example, the code will reduce to 28 days.
Let’s stop talk and let’s go to the action :-))
Before edit the file centos-clone-errata-full.sh, you have to know what channel you will check the packages to add errata information. To do this you can use the command bellow:
[root@spacewalk spacewalk_scripts-master]# rhn-satellite-exporter –list-channels
B = Base Channel
C = Child Channel
Note, we have in our environment the base channel centos6.5_x86-64 and we will use them to check erratas. This channel receive update daily.
Ok, let’s open the file centos-clone-errata-full.sh, inside them, looking for line as bellow:
Change according your environment, this info is referent to SW admin.
Now you will looking for a line like bellow:
./ya-errata-import.pl –erratadir=$ERRATADIR –server $SPACEWALK –channel prod-centos6.5_x86-64 –os-version 6 –publish | tee -a $LogFile
At this moment, we need change some points, as:
–channel <here you will define the channel name>, in our sample, centos6.5_x86-64
–os-version <version>, so if you are configuring to CentOS 6, still 6, if CentOS 5, use 5.
–publish <This will commit your changes in database>, if you remove this flag, the script will check although will not commit in db.
At the end of the day, our file will be similar a …
./ya-errata-import.pl –erratadir=$ERRATADIR –server $SPACEWALK –channel centos6.5_x86-64 –os-version 6 –publish | tee -a $LogFile
Pay attention, you can check the status all the time in the log file (/var/log/errata.log)
After changes, let’s start the script.
[root@spacewalk spacewalk_scripts-master]# ./centos-clone-errata-full.sh
As I told before, execute the command bellow in another terminal to check the errata install progress
[root@spacewalk ~]# tailf /var/log/errata.log
After conclude the execution, you can check again the erratas in your system, as bellow:
[root@spacewalk ~]# spacewalk-report errata-list-all
CEBA-2012:0043:C6-64,Bug Fix Advisory,,CentOS 6 ncompress Update
CEBA-2012:0068:C6-64,Bug Fix Advisory,,CentOS 6 at Update
CEBA-2012:0346:C6-64,Bug Fix Advisory,,CentOS 6 nss_db Update
CEBA-2012:0365:C6-64,Bug Fix Advisory,,CentOS 6 gmp Update
CEBA-2012:0381:C6-64,Bug Fix Advisory,,CentOS 6 libgweather FASTTRACK Update
CEBA-2012:0382:C6-64,Bug Fix Advisory,,CentOS 6 tsclient FASTTRACK Update
CEBA-2012:0384:C6-64,Bug Fix Advisory,,CentOS 6 liberation-fonts FASTTRACK Update
CEBA-2012:0402:C6-64,Bug Fix Advisory,,CentOS 6 atlas FASTTRACK Update
CEBA-2012:0403:C6-64,Bug Fix Advisory,,CentOS 6 mkbootdisk FASTTRACK Update
CESA-2013:1459:C6-64,Security Advisory,,Moderate CentOS 6 gnupg2 Update
CESA-2013:1475:C6-64,Security Advisory,,Moderate CentOS 6 postgresql Update
CESA-2013:1476:C6-64,Security Advisory,,Critical CentOS 6 firefox Update
CESA-2013:1480:C6-64,Security Advisory,,Important CentOS 6 thunderbird Update
After this, will appear in your SW all erratas that match with packages in the local repository, since 2004. What we need now is define a regular update, to do this, we will use the script centos-clone-errata.sh, the idea is the same, but this script will collect information up to 28 days (maximum)., Will be fast and the hardware usage will be very low.
Well, that’s it, after downloaded all erratas to your base channel, you can manager erratas to cloned or freezed channels.
Let me know if you have some doubt about implementation or strange warning! :-), don’t be shimmed, tell me!
Ps.: You need add your centos-clone-errata.sh in a crontab, so the often will be by you!
Hope this post help you in your environment.