hyperglass icon indicating copy to clipboard operation
hyperglass copied to clipboard

RuntimeError: NodeJS 14+ is required, indicating unsupported forward compatibility.

Open timrabl opened this issue 1 year ago • 0 comments

Bug Description

Hyperglass does only compare if the NodeJS major version matches version 14 but the error message indicates a forward compatibility by displaying a plus after the required NodeJS major version: RuntimeError: NodeJS 14+ is required.

Expected behavior

Hyperglass service would start (if there is forward compatibility up to NodeJS major version 16) or raise an error message not indicating forward compatibility. An example would be: Hyperglass requires NodeJS major version 14 to run.

Steps to Reproduce

Follow the install instructions on the docs and try to start hyperglass with: hyperglass start --build

Local Configurations

cat commands.yaml 
---

cat devices.yaml 
---
routers:
  - name: New York City, NY
    address: 10.0.0.1
    network:
      name: production
      display_name: AS65000
    credential:
      username: username
      password: password
    port: 22
    nos: cisco_ios
    vrfs:
      - name: global
        default: true
        ipv4:
          source_address: 192.0.2.1
        ipv6:
          source_address: 2001:db8::1

cat hyperglass.yaml
---

debug: false
developer_mode: false
primary_asn: 0
org_name: Example Org.
site_title: Hyperglass
site_description: Hyperglass
site_keywords:
  - hyperglass
request_timeout: 90
listen_address: localhost
listen_port: 80
cors_origins:
  - lg.example.org
netmiko_delay_factor: 0.1
google_analytics: ""

cache:
  database: 0
  host: redis
  port: 6379
  show_text: true
  timeout: 120

Logs

~ $ hyperglass start --build
[INFO] 20220804 13:52:00 | hyperglass.configuration.main:39 | <module> → Configuration directory: /opt/hyperglass/hyperglass
Traceback (most recent call last):
  File "/opt/hyperglass/venv/bin/hyperglass", line 8, in <module>
    sys.exit(CLI())
  File "/opt/hyperglass/venv/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/hyperglass/venv/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/opt/hyperglass/venv/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/hyperglass/venv/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hyperglass/venv/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/opt/hyperglass/venv/lib/python3.9/site-packages/hyperglass/cli/commands.py", line 99, in start
    from hyperglass.main import start
  File "/opt/hyperglass/venv/lib/python3.9/site-packages/hyperglass/main.py", line 29, in <module>
    raise RuntimeError(f"NodeJS {MIN_NODE_VERSION}+ is required.")
RuntimeError: NodeJS 14+ is required.

~ $ node --version
v16.16.0

Possible Solution

Change the python not equal comparison operator to less or equal than or flip the if statement and use a greater or equal than operator. https://github.com/thatmattlove/hyperglass/blob/c52a6f609843177671d38bcad59b8bd658f46b64/hyperglass/main.py#L28

Alternatively change the raised error message to something like NodeJS {MIN_NODE_VERSION} is required. by removing the +. https://github.com/thatmattlove/hyperglass/blob/c52a6f609843177671d38bcad59b8bd658f46b64/hyperglass/main.py#L29

Environment

Server

~ $ cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.1
PRETTY_NAME="Alpine Linux v3.16"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

~ $ hyperglass system-info
❕ Please copy & paste this table in your bug report:

| Metric | Value |
| :----- | :---- |
| **hyperglass Version** | 1.0.4 |
| **hyperglass Path** | `/opt/hyperglass/hyperglass` |
| **Python Version** | `3.9.13` |
| **Node Version** | `16.16.0` |
| **Platform Info** | `Linux-5.4.0-110-generic-x86_64-with` |
| **CPU Info** | QEMU Virtual CPU version 2.5+ |
| **Logical Cores** | `4` |
| **Physical Cores** | `4` |
| **Processor Speed** | `2.099994GHz` |
| **Total Memory** | 8.34 GB |
| **Memory Utilization** | 10.1% |
| **Total Disk Space** | 26.29 GB |
| **Disk Utilization** | 61.1% |

Client

  • OS & Version: unnecessary
  • Browser: unnecessary

Smartphone Details (if applicable)

  • Device: unnecessary
  • OS: unnecessary
  • Browser: unnecessary

timrabl avatar Aug 04 '22 14:08 timrabl