Bug 1395080

Summary: Python error NoneType has no attribute output_filename
Product: [Fedora] Fedora EPEL Reporter: Michael Gregg <mgregg>
Component: rhoAssignee: Jesus M. Rodriguez <jesusr>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: epel7CC: awood, dgoodwin, jesusr, jread
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-06 15:53:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Michael Gregg 2016-11-15 05:36:16 UTC
Description of problem:
Attempting to scan a /24 network with rho.
Does not write csv files to disk. 
Reports error 
"AttributeError: 'NoneType' object has no attribute 'output_filename'"

Version-Release number of selected component (if applicable):
rho-0.0.27-1.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. rho auth add --name myroot --username <username> [--file <rsa file>]
2. rho profile add --name deep1 --range "172.21.228.2 - 172.21.228.253" --auth myroot
3. rho scan --profile deep1 --report pack-scan

Actual results:
 No csv file created.

Expected results:
 To have a csv file with some data in it. 

Additional info:

Traceback (most recent call last):
  File "/usr/bin/rho", line 20, in <module>
    CLI().main()
  File "/usr/lib/python2.7/site-packages/rho/cli.py", line 97, in main
    cmd.main()
  File "/usr/lib/python2.7/site-packages/rho/clicommands.py", line 327, in main
    self._do_command()
  File "/usr/lib/python2.7/site-packages/rho/clicommands.py", line 587, in _do_c                                                                                                                                                              ommand
    reportobj.output_filename)), "w")
AttributeError: 'NoneType' object has no attribute 'output_filename'

Comment 1 Jesus M. Rodriguez 2016-11-15 14:20:15 UTC
Looking at the code this would happen if there is no pack-scan report defined in the rho config.

Can you please provide the output of 'rho report show --name pack-scan'?

I expect the output to print the fields for the report.

Comment 2 Jesus M. Rodriguez 2016-11-15 14:36:50 UTC
I was able to recreate the problem using a non-existent report.

rho scan --profile deep1 --report foobar
Config Encryption Password:
Scanning...
192.168.122.1:22 with auth myroot
192.168.122.3:22 with auth myroot
192.168.122.2:22 with auth myroot
Traceback (most recent call last):
  File "/usr/bin/rho", line 20, in <module>
    CLI().main()
  File "/usr/lib/python2.7/site-packages/rho/cli.py", line 97, in main
    cmd.main()
  File "/usr/lib/python2.7/site-packages/rho/clicommands.py", line 327, in main
    self._do_command()
  File "/usr/lib/python2.7/site-packages/rho/clicommands.py", line 587, in _do_command
    reportobj.output_filename)), "w")
AttributeError: 'NoneType' object has no attribute 'output_filename'

Comment 3 Jesus M. Rodriguez 2016-11-15 15:00:55 UTC
Proposed solution:

1) if a report is not found, print error message stating the report name and exit gracefully.

2) if the missing report is one of the default reports, then rho should automagically add it to the rho config then run the report. This happens if initconfig is not run prior to running the rho commands.

Comment 4 Jesus M. Rodriguez 2016-11-15 16:12:04 UTC
Posted a PR to address the problem: https://github.com/candlepin/rho/pull/30

Comment 5 Jesus M. Rodriguez 2017-07-26 13:39:39 UTC
*** Bug 1266036 has been marked as a duplicate of this bug. ***

Comment 6 Jesus M. Rodriguez 2017-11-06 15:53:30 UTC
This was already released.