taftsanders / satellite-leapp-check

A script to run on the Satellite or the upgrading client to validate clients have the required repositories for the LEAPP upgrade process
GNU General Public License v3.0
4 stars 3 forks source link

enforce the version via flag #51

Open waldirio opened 7 months ago

waldirio commented 7 months ago

enforce the version via flag

# ./satellite_leapp_check.py -u admin -p redhat -c hao-rhel7-client.anzlab.bne.redhat.com

Thanks for using satellite_leapp_check.
Please report all bugs or issues found to https://github.com/taftsanders/satellite-leapp-check/issues
This script is used in determining the availability of the correct repositories for a client for leapp upgrade
This script currently only supports RHEL 7 to 8 upgrade for x86_64 Intel architecture

satellite-installer is installed.
satellite-installer package detected on executing server
Calling the Satellite API for information on the specified client
Searching for host hao-rhel7-client.anzlab.bne.redhat.com

Leapp version should be either '8.6', '8.8', '8.9', or '8.10'
Traceback (most recent call last):
  File "./satellite_leapp_check.py", line 726, in <module>
    main()
  File "./satellite_leapp_check.py", line 717, in main
    parse_client()
  File "./satellite_leapp_check.py", line 657, in parse_client
    leapp_repos = determine_leapp_repos(arch)
  File "./satellite_leapp_check.py", line 161, in determine_leapp_repos
    LEAPP_VERSION = get_leapp_version()
  File "./satellite_leapp_check.py", line 145, in get_leapp_version
    while not LEAPP_VERSION:
UnboundLocalError: local variable 'LEAPP_VERSION' referenced before assignment

Hey @taftsanders could you enforce the parameter via argparse?

From

parser.add_argument("-c","--client", action='store', type=str, help="The registered hostname of the RHEL client\n\n\n\n")

To

parser.add_argument("-c", required=True, "--client", action='store', type=str, help="The registered hostname of the RHEL client\n\n\n\n")

With that, there is no need to handle this exception.

Thank you! Waldirio

taftsanders commented 7 months ago

No. I will work on the exception. This application supports both interactive and non-interactive methods.