quipucords / rho

A tool for scanning a network, logging into systems using SSH, and retrieving information about available Unix and Linux servers.
https://quipucords.github.io/rho/
GNU General Public License v2.0
5 stars 7 forks source link

Rho broken for Python <= 2.6 (which is what rhel 6 ships with) #571

Closed kdelee closed 6 years ago

kdelee commented 6 years ago

Specify type:

Bug severity (if applicable):

Description:

Dict comprehensions don't exist in Python 2.6, which is what RHEL 6 ships with. We are requiring support for RHEL 6, so this is release blocking.


Bug Report

Version of rho:

[ 0.0.31-1]

Expected behavior:

I can install and run rho on python 2.6

Actual behavior:

Rho does not run at all with python 2.6

[root@c0697cefe814 /]# python --version
Python 2.6.6
[root@c0697cefe814 /]# rho --version
Traceback (most recent call last):
  File "/usr/bin/rho", line 23, in <module>
    from rho.cli import CLI
  File "/usr/lib/python2.6/site-packages/rho/cli.py", line 37, in <module>
    from rho.scancommand import ScanCommand  # noqa
  File "/usr/lib/python2.6/site-packages/rho/scancommand.py", line 32, in <module>
    from rho import inventory_scan
  File "/usr/lib/python2.6/site-packages/rho/inventory_scan.py", line 116
    for group in yml_dict.keys()}
      ^

Steps to reproduce:

Install latest copr RPM of rho on a rhel 6 machine.

Environment information:

Provide detailed information on the scanning and target systems (if applicable); see example below.

Type Operating System OS Version Python Version Virtualization
Scanning System RHEL 6.9 2.6 docker image

Suggested fix:

Replace dict comprehension with equivalent code.

kdelee commented 6 years ago

https://stackoverflow.com/questions/21069668/alternative-to-dict-comprehension-prior-to-python-2-7

kdelee commented 6 years ago

Looks like there is at least one more dictionary comprehension. Looks like we should think of a regex to find them all

[root@3753a3bd9414 /]# rho auth add --name root --username root --password
Traceback (most recent call last):
  File "/usr/bin/rho", line 23, in <module>
    from rho.cli import CLI
  File "/usr/lib/python2.6/site-packages/rho/cli.py", line 37, in <module>
    from rho.scancommand import ScanCommand  # noqa
  File "/usr/lib/python2.6/site-packages/rho/scancommand.py", line 32, in <module>
    from rho import inventory_scan
  File "/usr/lib/python2.6/site-packages/rho/inventory_scan.py", line 21, in <module>
    from rho import ansible_utils, postprocessing, utilities
  File "/usr/lib/python2.6/site-packages/rho/postprocessing.py", line 828
    for eap_home in eap_homes}}
kdelee commented 6 years ago

Here are some suspects: (in rho/rho)

 elijah $  grep -rne "for .* in .*\}"
postprocessing.py:828:             for eap_home in eap_homes}}
postprocessing.py:866:        for result in bin_fuse['results']}
postprocessing.py:870:        for directory, result in utilities.iteritems(bin_fuse_mr)}
postprocessing.py:885:             for karaf_home in karaf_homes}}  # noqa