Skip to content

Relicense Functionality is calling Unversioned Python #19

@Laminad

Description

@Laminad

The re-licensing feature is calling python without a 2 or 3 version at the end, so it believes Ubuntu does not have python installed. This is causing the process to fail continuously. This is bad practice when calling python on Linux since very often modules use different versions of python, so both can/are installed simultaneously in most distros.

The issue appears to be located in this function in the bash script:


# Function to generate a new iourc license
generate_iourc_license() {
    BIN_PATH="/opt/unetlab/addons/iol/bin/"

    PYTHON_FILE=$BIN_PATH"CiscoIOUKeygen.py"
    PERL_FILE=$BIN_PATH"keepalive.pl"

    # Check if python2 is installed
    if ! command -v python &>/dev/null; then
        echo -e "${RED}[-] Python is not installed${NO_COLOR}"
        logger error "Python is not installed"
        # Ask the user if they want to install python
        read -p "[?] Do you want to install python? (y/n): " -r
        if [[ $REPLY =~ ^[Yy]$ ]]; then
            install_package python
        else
            echo -e "${RED}[-] Python2 is required to generate the iourc license${NO_COLOR}"
            exit 1
        fi
    fi

The function should be corrected to something like the following:

# Function to generate a new iourc license
generate_iourc_license() {
    BIN_PATH="/opt/unetlab/addons/iol/bin/"

    PYTHON_FILE=$BIN_PATH"CiscoIOUKeygen.py"
    PERL_FILE=$BIN_PATH"keepalive.pl"

    # Check if python2 is installed
    if ! command -v python2 &>/dev/null; then
        echo -e "${RED}[-] Python is not installed${NO_COLOR}"
        logger error "Python is not installed"
        # Ask the user if they want to install python
        read -p "[?] Do you want to install python? (y/n): " -r
        if [[ $REPLY =~ ^[Yy]$ ]]; then
            install_package python2
        else
            echo -e "${RED}[-] Python2 is required to generate the iourc license${NO_COLOR}"
            exit 1
        fi
    fi

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions