liedekef / spacewalk_scripts

Several spacewalk scripts
52 stars 25 forks source link

Use of uninitalized value $os_release #34

Closed meliux closed 8 years ago

meliux commented 8 years ago

Hi, Last week some time my nightly run of the ya-errata.import.pl has started throwing two errors. I'm not entirely sure if these are causing any problems as it seems new errata is successfully being loaded into spacewalk, but it seems odd that this error has suddenly started appearing... other than a reboot, there haven't been any changes to this server setup that I'm aware of.

Use of uninitialized value $os_release in pattern match (m//) at /sbin/ya-errata-import.pl line 431.
Use of uninitialized value $os_release in numeric ne (!=) at /sbin/ya-errata-import.pl line 442.

System info: spacewalk 2.4 ya-errata-import.pl 20160401 centos-clone-errata.sh Dec 2015 centos 6.8 2.6.32-642.3.1.el6.x86_64 tomcat 6.0.24-95 java 1.6.0_40

Output from calling the import script manually without --quiet:

[root@spacewalk errata]# /sbin/ya-errata-import.pl --erratadir=$ERRATADIR --server $SPACEWALK --channel centos7_updates_64 --os-version 7 --publish 
INFO: Architecture is not specified, will try to determine it based on the channel properties of 'centos7_updates_64'
INFO: Setting the OS variant to CentOS, if this is wrong please add the --redhat option
INFO: Server 127.0.0.1 is running API version 17
INFO: Your API version is supported
INFO: Authentication on 127.0.0.1 successful
INFO: User has administrator access to this server
INFO: Checking if channel centos7_updates_64 exists on 127.0.0.1
INFO: Determining architecture for channel centos7_updates_64
INFO: Detected architecture 'x86_64' for channel 'centos7_updates_64'
INFO: Listing all packages in centos7_updates_64
INFO: Listing all errata in centos7_updates_64 on 127.0.0.1
Use of uninitialized value $os_release in pattern match (m//) at /sbin/ya-errata-import.pl line 431.
Use of uninitialized value $os_release in numeric ne (!=) at /sbin/ya-errata-import.pl line 442.
INFO: Processing CESA-2016:1602 (Important CentOS 7 mariadb Security Update)
INFO: Errata for CESA-2016:1602 already exists
INFO: Processing CESA-2016:1606 (Moderate CentOS 7 qemu-kvm Security Update)
INFO: Errata for CESA-2016:1606 already exists
INFO: Processing CESA-2016:1613 (Moderate CentOS 7 php Security Update)
INFO: Errata for CESA-2016:1613 already exists
INFO: Processing CESA-2016:1626 (Moderate CentOS 7 python Security Update)
INFO: Errata for CESA-2016:1626 already exists
INFO: Processing CESA-2016:1633 (Important CentOS 7 kernel Security Update)
INFO: Errata for CESA-2016:1633 already exists
INFO: Processing CESA-2016:1776 (Important CentOS 7 java-1.6.0-openjdk Security Update)
INFO: Errata for CESA-2016:1776 already exists
[root@spacewalk errata]# 

Any help would be appreciated!

liedekef commented 8 years ago

Well, it means the errata is not providing the OS version in the title, and the title parsing totally failed. Could you find out the relevant errata? I added an extra debug statement on the github version, so download and re-execute your import (with debug activated).

meliux commented 8 years ago

awesome, thanks for that... think I found the culprit. ...

DEBUG: Multiple archive: /tmp/centos-errata/160858.html
DEBUG: Parsing errata CEBA-2016:C002 pcs Update
Use of uninitialized value $os_release in pattern match (m//) at /sbin/ya-errata-import-debug.pl line 433.
Use of uninitialized value $os_release in numeric ne (!=) at /sbin/ya-errata-import-debug.pl line 444.
DEBUG: Parsing errata CEBA-2016:1658  CentOS 5 cman BugFix Update
DEBUG: Parsing errata CEBA-2016:1665  CentOS 6 pcs BugFix Update
DEBUG: Parsing errata CEBA-2016:1659  CentOS 6 udev BugFix Update
DEBUG: Parsing errata CEBA-2016:1663  CentOS 6 avahi BugFix Update
DEBUG: Parsing errata CEBA-2016:1667  CentOS 6 cronie BugFix Update
DEBUG: Parsing errata CEBA-2016:1670  CentOS 6 lvm2 BugFix Update
DEBUG: Parsing errata CEBA-2016:1668  CentOS 6 net-snmp BugFix Update
DEBUG: Parsing errata CEBA-2016:1662 CentOS 6 pacemaker BugFix Update
DEBUG: Parsing errata CEBA-2016:1661  CentOS 6 pki-core BugFix Update
DEBUG: Parsing errata CEBA-2016:1669  CentOS 6 samba BugFix Update
DEBUG: Parsing errata CEBA-2016:1666  CentOS 6 tcsh BugFix Update
DEBUG: Parsing errata CESA-2016:1664 Important CentOS 6 kernel Security Update

...

https://lists.centos.org/pipermail/centos/2016-August/160858.html

I have nfi why the OS was omitted from that particular email subject line. The email body (https://lists.centos.org/pipermail/centos-announce/2016-August/022041.html) relates to centos 7. Why would Johnny Hughes omit the OS? Does he do these by hand?

Obviously the problem will go away in a few days once the new month rolls over, but i'm wondering if there's a better fix considering the issue will still be encountered whenever anyone does a full errata import.

edit: updated url to centos-announce item

liedekef commented 8 years ago

Just commited a fix, try again :-)

meliux commented 8 years ago

Nice, I see what you're trying to do! If i was a real coder i could help fix this, but alas..:

Argument "" isn't numeric in numeric ne (!=) at /sbin/ya-errata-import.pl line 444.
tracphil commented 8 years ago

I am now getting "Argument "" isn't numeric in numeric ne (!=) at /usr/local/admin/bin/ya-errata-import.pl line 444." as well.

Thanks for this script btw!!! We have been using it for years.

liedekef commented 8 years ago

Yes, indeed ... I'm using strict perl and thus an empty string comparing with a number results in this. Let me try something different ...

liedekef commented 8 years ago

Ok, try again now.

meliux commented 8 years ago

excellent, that looks to have solved it. Love your work!