ACS-Community / ACS

Official ACS community fork
MIT License
28 stars 26 forks source link

Bug due to wrong splitting/unpacking in acsConfigReport #12

Closed marco-buttu closed 10 years ago

marco-buttu commented 10 years ago

This issue is related to #11. When there is no acsPackageInfo-X.Y.rpmref, then the script acsConfigReport reads the default file acsPackageInfo-RH-WS.rpmref and splits every line as follows:

pack_name, pack_ver, pack_rel = string.split(myline)

The lines of acsPackageInfo-RH-WS.rpmref cannot be splitted in three parts using a whitespace as separator:

$ head -n 3 acsPackageInfo-RH-WS.rpmref
acs-scripts-1-1
alsa-lib-1.0.6-5.RHEL4
alsa-utils-1.0.6-3

so the execution of acsConfigReport fails:

$ acsConfigReport
...
Traceback (most recent call last):
  File "acsConfigReport", ...
    (pack_name, pack_ver, pack_rel)=string.split(myline)
ValueError: need more than 1 value to unpac

I solved by skypping unexpected lines:

try:
    pack_name, pack_ver, pack_rel = string.split(myline)
except ValueError, ex: 
    logging.warning('Cannot split %s: %s' %(myline, ex))
    continue

There were also a lot of indentation inconsistences (1 whitespace, 3, 4 and TABs), so I put a bit of order (PEP-8 rules for indentation).