stdevel / katprep

Python toolkit for automating system maintenance and generating patch reports along with Foreman/Katello and Red Hat Satellite 6.x
GNU General Public License v3.0
35 stars 6 forks source link

Organization name option not working in katprep_snapshot #94

Closed AnonJo closed 6 years ago

AnonJo commented 6 years ago

Describe the bug When using katprep_snapshot with the organization name (--organization NameOfOrganization) it is not working, only the ID works (--organization 1).

To Reproduce Steps to reproduce the behavior:

  1. Enter command # katprep_snapshot -s satelliteserver.local -C authfile --organization NameOfOrganization
  2. See error
    Authentication container password:
    Traceback (most recent call last):
    File "/usr/bin/katprep_snapshot", line 9, in <module>
    load_entry_point('katprep==0.5.0', 'console_scripts', 'katprep_snapshot')()
    File "/home/username/katprep/katprep/snapshot.py", line 317, in cli
    main(options, args)
    File "/home/username/katprep/katprep/snapshot.py", line 294, in main
    scan_systems(options)
    File "/home/username/katprep/katprep/snapshot.py", line 148, in scan_systems
    SAT_CLIENT.api_get("{}".format(filter_url))
    File "/home/username/katprep/katprep/clients/ForemanAPIClient.py", line 207, in api_get
    return self.__api_request("get", sub_url, "", hits, page)
    File "/home/username/katprep/katprep/clients/ForemanAPIClient.py", line 180, in __api_request
    result.status_code, result.text))
    katprep.clients.SessionException: 404: HTTP operation not successful {"message":"Organization with id NameOfOrganization not found"}

Expected behavior ID or Name both should work like described in the help-

OS version: [e.g. CentOS 7.4] Red Hat Enterprise Linux Server release 7.5 (Maipo)

Red Hat Satellite or Foreman/Katello version [e.g. 1.17.1/3.6.0] Red Hat Satellite 6.3.2

stdevel commented 6 years ago

Confirmed on RHS 6.3.2 and RHEL 7.5. Investigating in branch bug-organization_name-issue94.

stdevel commented 6 years ago

Created a fix in commit fe7b56531cf6267a05495d48859d209158373e79 on branch bug-organization_name-issue94.

Does this fix work for you, @AnonJo?

AnonJo commented 6 years ago

@stdevel , yeah the fix works.

Thanks!

stdevel commented 6 years ago

Happy to hear, thanks! 👍

Fixed in commit fe7b56531cf6267a05495d48859d209158373e79.