Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config values prepended with HYPERGLASS_APP_PATH #253

Closed
thatmattlove opened this issue Jun 1, 2024 · 24 comments
Closed

Config values prepended with HYPERGLASS_APP_PATH #253

thatmattlove opened this issue Jun 1, 2024 · 24 comments
Assignees
Labels
possible-bug Something isn't working

Comments

@thatmattlove
Copy link
Owner

See #249

@thatmattlove thatmattlove added the possible-bug Something isn't working label Jun 1, 2024
@thatmattlove thatmattlove self-assigned this Jun 1, 2024
@thatmattlove
Copy link
Owner Author

@M0NsTeRRR @allanfrizzo

I've opened this issue so as not to comment back and forth on a closed PR.

@allanfrizzo - can you confirm that you've both pulled the latest copy of the repo, rebuilt the container (docker compose build), and are indeed running v2.0.1 (should be visible in the logs)? If so, please share a sanitized copy of your config.{yaml|toml|json|py} file.

@M0NsTeRRR
Copy link
Contributor

M0NsTeRRR commented Jun 1, 2024

I've rebuilt the container with v2.0.1, pushed it to my fork's packages with the rootless fix I did in #250, and it works as expected.

@allanfrizzo
Copy link

I removed the docker image and rebuilt it, now it's up as expected,

thanks

@M0NsTeRRR
Copy link
Contributor

After submitting PR #256, the current fixes worked for me since I don't have any "." in my configuration. However, the issue still persists in cases like org_name: AS1000 . test. I've reduced the factor by using startswith in #256 as I need to put an URL in the config that can have a dot inside. But it must be rewritten in case someone wants to use a "." as the first character.

@allanfrizzo
Copy link

I get the error when inserting a link, it keeps adding the path in front.

config.yalm

org_name: Eaí
plugins: []
primary_asn: 61599
request_timeout: 90
site_description: "{org_name} Network Tools"
site_title: Eaí Network-Tools
cache:
timeout: 120
show_text: true
logging:
directory: /var/log
format: text
max_size: 50 MB
web:
location_display_mode: dropdown
logo:
dark: /etc/hyperglass/static/images/eai-light.svg
light: /etc/hyperglass/static/images/eai-dark.svg
favicon: /etc/hyperglass/static/images/eai-favicon.png
credit:
enable: false
menus:

error log:
hyperglass-1 | web.links.0.url
hyperglass-1 | Input should be a valid URL, relative URL without a base [type=url_parsing,
hyperglass-1 | input_value='/etc/hyperglass/https:/www.eai.net.br', input_type=str]
hyperglass-1 | For further information visit https://errors.pydantic.dev/2.7/v/url_parsing

I noticed that when I used a menu item, it added the path.

image

@M0NsTeRRR
Copy link
Contributor

M0NsTeRRR commented Jun 1, 2024

Yes as I've mentioned above if you have a "." the issue still persists

@allanfrizzo
Copy link

with @M0NSTERR's fix: website config #249, I fixed the problems mentioned above.

image

@thatmattlove
Copy link
Owner Author

@allanfrizzo

With the following configuration, I cannot reproduce this with 2.0.1:

web:
  menus:
    - title: Contact
      content: Do a thing
      order: 1

screenshot-2024-06-01-at-14 13 14

Are you sure you're on 2.0.1?

@thatmattlove
Copy link
Owner Author

I also added a . and the result is the same:

web:
  menus:
    - title: Contact
      content: Do a thing.
      order: 1

screenshot-2024-06-01-at-14 16 49

@allanfrizzo
Copy link

yes

image

Did you test it with my content?

@thatmattlove
Copy link
Owner Author

With your config:

web:
  menus:
    - title: Contact
      content: 'Please contact noc@eai.net.br to get support.'
      order: 2

screenshot-2024-06-01-at-14 19 34

@M0NsTeRRR
Copy link
Contributor

M0NsTeRRR commented Jun 1, 2024

With your config:

web:
  menus:
    - title: Contact
      content: 'Please contact noc@eai.net.br to get support.'
      order: 2

screenshot-2024-06-01-at-14 19 34

Are you testing with docker ? (because the issue is only triggered here)

if Settings.container:

@allanfrizzo
Copy link

with the @M0NSTERR now it's correct #249,

image

menus:
  - title: Contact
    content: "Please contact [noc@eai.net.br](mailto:noc@eai.net.br) to get support."
    side: left
    order: 2

@allanfrizzo
Copy link

before this adjustment, the urls were also giving errors.

  links:
  - title: Website
    url: https://www.eai.net.br
    side: right
    order: 1
hyperglass-1 | web.links.0.url
hyperglass-1 | Input should be a valid URL, relative URL without a base [type=url_parsing,
hyperglass-1 | input_value='/etc/hyperglass/https:/www.eai.net.br', input_type=str]
hyperglass-1 | For further information visit https://errors.pydantic.dev/2.7/v/url_parsing

@thatmattlove
Copy link
Owner Author

@M0NsTeRRR yes, using Docker.

@allanfrizzo
#249 essentially disables the value rewrite for anything other than plugins, so it isn't a valid solution.

Have you tried rebuilding the container? docker compose build && docker compose up

@allanfrizzo
Copy link

@thatmattlove

I did the whole process again,

image

[root@hyperglass hyperglass]# docker compose build && docker compose up
WARN[0000] The "HYPERGLASS_APP_PATH" variable is not set. Defaulting to a blank string. 
[+] Building 135.8s (14/14) FINISHED                                                                                             docker:default
 => [hyperglass internal] load build definition from Dockerfile                                                                            0.0s
 => => transferring dockerfile: 703B                                                                                                       0.0s
 => [hyperglass internal] load metadata for docker.io/library/python:3.12.3-alpine                                                         1.1s
 => [hyperglass internal] load .dockerignore                                                                                               0.0s
 => => transferring context: 553B                                                                                                          0.0s
 => [hyperglass base 1/3] FROM docker.io/library/python:3.12.3-alpine@sha256:5365725a6cd59b72a927628fdda9965103e3dc671676c89ef3ed8b8b0e22  0.0s
 => [hyperglass internal] load build context                                                                                               0.2s
 => => transferring context: 10.63MB                                                                                                       0.2s
 => CACHED [hyperglass base 2/3] WORKDIR /opt/hyperglass                                                                                   0.0s
 => [hyperglass base 3/3] COPY . .                                                                                                         0.3s
 => [hyperglass ui 1/4] WORKDIR /opt/hyperglass/hyperglass/ui                                                                              0.0s
 => [hyperglass ui 2/4] RUN apk add build-base pkgconfig cairo-dev nodejs npm                                                              9.0s
 => [hyperglass ui 3/4] RUN npm install -g pnpm                                                                                            3.2s 
 => [hyperglass ui 4/4] RUN pnpm install -P                                                                                               20.8s 
 => [hyperglass hyperglass 1/2] WORKDIR /opt/hyperglass                                                                                    0.1s 
 => [hyperglass hyperglass 2/2] RUN pip3 install -e .                                                                                     71.3s 
 => [hyperglass] exporting to image                                                                                                       29.7s 
 => => exporting layers                                                                                                                   29.7s 
 => => writing image sha256:c7582dec313d17cd94c06efd988f09e30adb1eb411ccc5438a9518a6011fdff9                                               0.0s 
 => => naming to docker.io/library/hyperglass-hyperglass                                                                                   0.0s 
WARN[0000] The "HYPERGLASS_APP_PATH" variable is not set. Defaulting to a blank string.                                                         
[+] Running 2/2                                                                                                                                 
 ✔ Container hyperglass-redis-1       Created                                                                                              0.0s 
 ✔ Container hyperglass-hyperglass-1  Recreated                                                                                            1.8s 
Attaching to hyperglass-1, redis-1
redis-1       | 1:C 01 Jun 2024 18:41:21.791 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-1       | 1:C 01 Jun 2024 18:41:21.791 * Redis version=7.2.5, bits=64, commit=00000000, modified=0, pid=1, just started
redis-1       | 1:C 01 Jun 2024 18:41:21.791 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis-1       | 1:M 01 Jun 2024 18:41:21.792 * monotonic clock: POSIX clock_gettime
redis-1       | 1:M 01 Jun 2024 18:41:21.793 * Running mode=standalone, port=6379.
redis-1       | 1:M 01 Jun 2024 18:41:21.793 * Server initialized
redis-1       | 1:M 01 Jun 2024 18:41:21.794 * Loading RDB produced by version 7.2.5
redis-1       | 1:M 01 Jun 2024 18:41:21.794 * RDB age 196 seconds
redis-1       | 1:M 01 Jun 2024 18:41:21.794 * RDB memory usage when created 1.05 Mb
redis-1       | 1:M 01 Jun 2024 18:41:21.794 * Done loading RDB, keys loaded: 5, keys expired: 0.
redis-1       | 1:M 01 Jun 2024 18:41:21.794 * DB loaded from disk: 0.000 seconds
redis-1       | 1:M 01 Jun 2024 18:41:21.794 * Ready to accept connections tcp
hyperglass-1  | [CRITICAL] 20240601 18:41:23 | 2 validation errors for Params
hyperglass-1  | web.links.0.url
hyperglass-1  |   Input should be a valid URL, relative URL without a base [type=url_parsing, input_value='/etc/hyperglass/https:/www.eai.net.br', input_type=str]
hyperglass-1  |     For further information visit https://errors.pydantic.dev/2.7/v/url_parsing
hyperglass-1  | web.links.1.url
hyperglass-1  |   Input should be a valid URL, relative URL without a base [type=url_parsing, input_value='/etc/hyperglass/https:/w...b.com/asn/{primary_asn}', input_type=str]
hyperglass-1  |     For further information visit https://errors.pydantic.dev/2.7/v/url_parsing {}
hyperglass-1  | ╭───────────────────── Traceback (most recent call last) ──────────────────────╮
hyperglass-1  | │ /opt/hyperglass/hyperglass/cli/main.py:61 in _start                          │
hyperglass-1  | │                                                                              │
hyperglass-1  | │    58 │   │   │   if build_complete:                                         │
hyperglass-1  | │    59 │   │   │   │   run(workers)                                           │
hyperglass-1  | │    60 │   │   else:                                                          │
hyperglass-1  | │ ❱  61 │   │   │   run(workers)                                               │
hyperglass-1  | │    62 │                                                                      │
hyperglass-1  | │    63 │   except (KeyboardInterrupt, SystemExit) as err:                     │
hyperglass-1  | │    64 │   │   error_message = str(err)                                       │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────── locals ─────────────────────╮                         │
hyperglass-1  | │ │    build = False                                 │                         │
hyperglass-1  | │ │ build_ui = <function build_ui at 0x7fe40a3dc680> │                         │
hyperglass-1  | │ │   kwargs = {'workers': None}                     │                         │
hyperglass-1  | │ │      run = <function run at 0x7fe40a3dc5e0>      │                         │
hyperglass-1  | │ │  workers = None                                  │                         │
hyperglass-1  | │ ╰──────────────────────────────────────────────────╯                         │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/main.py:180 in run                                │
hyperglass-1  | │                                                                              │
hyperglass-1  | │   177 │   │   │   state.clear()                                              │
hyperglass-1  | │   178 │   │   │   log.debug("Cleared hyperglass state")                      │
hyperglass-1  | │   179 │   │   unregister_all_plugins()                                       │
hyperglass-1  | │ ❱ 180 │   │   raise error                                                    │
hyperglass-1  | │   181 │   except (SystemExit, BaseException):                                │
hyperglass-1  | │   182 │   │   unregister_all_plugins()                                       │
hyperglass-1  | │   183 │   │   sys.exit(4)                                                    │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │ init_user_config = <function init_user_config at 0x7fe40a3dc7c0>         │ │
hyperglass-1  | │ │            state = HyperglassState(redis=Redis<ConnectionPool<Connectio… │ │
hyperglass-1  | │ │          workers = None                                                  │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/main.py:140 in run                                │
hyperglass-1  | │                                                                              │
hyperglass-1  | │   137 │   │   state = use_state()                                            │
hyperglass-1  | │   138 │   │   state.clear()                                                  │
hyperglass-1  | │   139 │   │                                                                  │
hyperglass-1  | │ ❱ 140 │   │   init_user_config()                                             │
hyperglass-1  | │   141 │   │                                                                  │
hyperglass-1  | │   142 │   │   enable_file_logging(                                           │
hyperglass-1  | │   143 │   │   │   directory=state.params.logging.directory,                  │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │ init_user_config = <function init_user_config at 0x7fe40a3dc7c0>         │ │
hyperglass-1  | │ │            state = HyperglassState(redis=Redis<ConnectionPool<Connectio… │ │
hyperglass-1  | │ │          workers = None                                                  │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/configuration/__init__.py:31 in init_user_config  │
hyperglass-1  | │                                                                              │
hyperglass-1  | │   28 │   state = use_state()                                                 │
hyperglass-1  | │   29 │   init_files()                                                        │
hyperglass-1  | │   30 │                                                                       │
hyperglass-1  | │ ❱ 31 │   _params = params or init_params()                                   │
hyperglass-1  | │   32 │   builtins = init_builtin_directives()                                │
hyperglass-1  | │   33 │   _custom = directives or init_directives()                           │
hyperglass-1  | │   34 │   _directives = builtins + _custom                                    │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │    devices = None                                                        │ │
hyperglass-1  | │ │ directives = None                                                        │ │
hyperglass-1  | │ │     params = None                                                        │ │
hyperglass-1  | │ │      state = HyperglassState(redis=Redis<ConnectionPool<Connection<host… │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/configuration/validate.py:41 in init_params       │
hyperglass-1  | │                                                                              │
hyperglass-1  | │    38 │   """Validate & initialize configuration parameters."""              │
hyperglass-1  | │    39 │   user_config = load_config("config", required=False)                │
hyperglass-1  | │    40 │   # Map imported user configuration to expected schema.              │
hyperglass-1  | │ ❱  41 │   params = Params(**user_config)                                     │
hyperglass-1  | │    42 │                                                                      │
hyperglass-1  | │    43 │   # # Set up file logging once configuration parameters are initiali │
hyperglass-1  | │    44 │   # enable_file_logging(                                             │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │ user_config = {                                                          │ │
hyperglass-1  | │ │               │   'org_name': 'Eaí',                                     │ │
hyperglass-1  | │ │               │   'plugins': [],                                         │ │
hyperglass-1  | │ │               │   'primary_asn': 61599,                                  │ │
hyperglass-1  | │ │               │   'request_timeout': 90,                                 │ │
hyperglass-1  | │ │               │   'site_description': '{org_name} Network Tools',        │ │
hyperglass-1  | │ │               │   'site_title': 'Eaí Network-Tools',                     │ │
hyperglass-1  | │ │               │   'cache': {'timeout': 120, 'show_text': True},          │ │
hyperglass-1  | │ │               │   'logging': {                                           │ │
hyperglass-1  | │ │               │   │   'directory': '/var/log',                           │ │
hyperglass-1  | │ │               │   │   'format': 'text',                                  │ │
hyperglass-1  | │ │               │   │   'max_size': '50 MB'                                │ │
hyperglass-1  | │ │               │   },                                                     │ │
hyperglass-1  | │ │               │   'web': {                                               │ │
hyperglass-1  | │ │               │   │   'location_display_mode': 'dropdown',               │ │
hyperglass-1  | │ │               │   │   'logo': {                                          │ │
hyperglass-1  | │ │               │   │   │   'dark':                                        │ │
hyperglass-1  | │ │               '/etc/hyperglass/static/images/eai-light.svg',             │ │
hyperglass-1  | │ │               │   │   │   'light':                                       │ │
hyperglass-1  | │ │               '/etc/hyperglass/static/images/eai-dark.svg',              │ │
hyperglass-1  | │ │               │   │   │   'favicon':                                     │ │
hyperglass-1  | │ │               '/etc/hyperglass/static/images/eai-favicon.png'            │ │
hyperglass-1  | │ │               │   │   },                                                 │ │
hyperglass-1  | │ │               │   │   'credit': {'enable': False},                       │ │
hyperglass-1  | │ │               │   │   'links': [                                         │ │
hyperglass-1  | │ │               │   │   │   {                                              │ │
hyperglass-1  | │ │               │   │   │   │   'title': 'Website',                        │ │
hyperglass-1  | │ │               │   │   │   │   'url': 'https://www.eai.net.br',           │ │
hyperglass-1  | │ │               │   │   │   │   'side': 'right',                           │ │
hyperglass-1  | │ │               │   │   │   │   'order': 1                                 │ │
hyperglass-1  | │ │               │   │   │   },                                             │ │
hyperglass-1  | │ │               │   │   │   {                                              │ │
hyperglass-1  | │ │               │   │   │   │   'title': 'PeeringDB',                      │ │
hyperglass-1  | │ │               │   │   │   │   'url':                                     │ │
hyperglass-1  | │ │               'https://www.peeringdb.com/asn/{primary_asn}',             │ │
hyperglass-1  | │ │               │   │   │   │   'side': 'right',                           │ │
hyperglass-1  | │ │               │   │   │   │   'order': 2                                 │ │
hyperglass-1  | │ │               │   │   │   }                                              │ │
hyperglass-1  | │ │               │   │   ]                                                  │ │
hyperglass-1  | │ │               │   }                                                      │ │
hyperglass-1  | │ │               }                                                          │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/models/config/params.py:94 in __init__            │
hyperglass-1  | │                                                                              │
hyperglass-1  | │    91 │   web: Web = Web()                                                   │
hyperglass-1  | │    92 │                                                                      │
hyperglass-1  | │    93 │   def __init__(self, **kw: t.Any) -> None:                           │
hyperglass-1  | │ ❱  94 │   │   return super().__init__(**self.convert_paths(kw))              │
hyperglass-1  | │    95 │                                                                      │
hyperglass-1  | │    96 │   @field_validator("site_description")                               │
hyperglass-1  | │    97 │   def validate_site_description(cls: "Params", value: str, info: Val │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │   kw = {                                                                 │ │
hyperglass-1  | │ │        │   'org_name': 'Eaí',                                            │ │
hyperglass-1  | │ │        │   'plugins': [],                                                │ │
hyperglass-1  | │ │        │   'primary_asn': 61599,                                         │ │
hyperglass-1  | │ │        │   'request_timeout': 90,                                        │ │
hyperglass-1  | │ │        │   'site_description': '{org_name} Network Tools',               │ │
hyperglass-1  | │ │        │   'site_title': 'Eaí Network-Tools',                            │ │
hyperglass-1  | │ │        │   'cache': {'timeout': 120, 'show_text': True},                 │ │
hyperglass-1  | │ │        │   'logging': {                                                  │ │
hyperglass-1  | │ │        │   │   'directory': '/var/log',                                  │ │
hyperglass-1  | │ │        │   │   'format': 'text',                                         │ │
hyperglass-1  | │ │        │   │   'max_size': '50 MB'                                       │ │
hyperglass-1  | │ │        │   },                                                            │ │
hyperglass-1  | │ │        │   'web': {                                                      │ │
hyperglass-1  | │ │        │   │   'location_display_mode': 'dropdown',                      │ │
hyperglass-1  | │ │        │   │   'logo': {                                                 │ │
hyperglass-1  | │ │        │   │   │   'dark':                                               │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-light.svg',                    │ │
hyperglass-1  | │ │        │   │   │   'light':                                              │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-dark.svg',                     │ │
hyperglass-1  | │ │        │   │   │   'favicon':                                            │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-favicon.png'                   │ │
hyperglass-1  | │ │        │   │   },                                                        │ │
hyperglass-1  | │ │        │   │   'credit': {'enable': False},                              │ │
hyperglass-1  | │ │        │   │   'links': [                                                │ │
hyperglass-1  | │ │        │   │   │   {                                                     │ │
hyperglass-1  | │ │        │   │   │   │   'title': 'Website',                               │ │
hyperglass-1  | │ │        │   │   │   │   'url': 'https://www.eai.net.br',                  │ │
hyperglass-1  | │ │        │   │   │   │   'side': 'right',                                  │ │
hyperglass-1  | │ │        │   │   │   │   'order': 1                                        │ │
hyperglass-1  | │ │        │   │   │   },                                                    │ │
hyperglass-1  | │ │        │   │   │   {                                                     │ │
hyperglass-1  | │ │        │   │   │   │   'title': 'PeeringDB',                             │ │
hyperglass-1  | │ │        │   │   │   │   'url':                                            │ │
hyperglass-1  | │ │        'https://www.peeringdb.com/asn/{primary_asn}',                    │ │
hyperglass-1  | │ │        │   │   │   │   'side': 'right',                                  │ │
hyperglass-1  | │ │        │   │   │   │   'order': 2                                        │ │
hyperglass-1  | │ │        │   │   │   }                                                     │ │
hyperglass-1  | │ │        │   │   ]                                                         │ │
hyperglass-1  | │ │        │   }                                                             │ │
hyperglass-1  | │ │        }                                                                 │ │
hyperglass-1  | │ │ self = Params()                                                          │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /usr/local/lib/python3.12/site-packages/pydantic/main.py:176 in __init__     │
hyperglass-1  | │                                                                              │
hyperglass-1  | │    173 │   │   """                                                           │
hyperglass-1  | │    174 │   │   # `__tracebackhide__` tells pytest and some other tools to om │
hyperglass-1  | │    175 │   │   __tracebackhide__ = True                                      │
hyperglass-1  | │ ❱  176 │   │   self.__pydantic_validator__.validate_python(data, self_instan │
hyperglass-1  | │    177 │                                                                     │
hyperglass-1  | │    178 │   # The following line sets a flag that we use to determine when `_ │
hyperglass-1  | │    179 │   __init__.__pydantic_base_init__ = True  # pyright: ignore[reportF │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │ data = {                                                                 │ │
hyperglass-1  | │ │        │   'org_name': 'Eaí',                                            │ │
hyperglass-1  | │ │        │   'plugins': [],                                                │ │
hyperglass-1  | │ │        │   'primary_asn': 61599,                                         │ │
hyperglass-1  | │ │        │   'request_timeout': 90,                                        │ │
hyperglass-1  | │ │        │   'site_description': '{org_name} Network Tools',               │ │
hyperglass-1  | │ │        │   'site_title': 'Eaí Network-Tools',                            │ │
hyperglass-1  | │ │        │   'cache': {'timeout': 120, 'show_text': True},                 │ │
hyperglass-1  | │ │        │   'logging': {                                                  │ │
hyperglass-1  | │ │        │   │   'directory': '/var/log',                                  │ │
hyperglass-1  | │ │        │   │   'format': 'text',                                         │ │
hyperglass-1  | │ │        │   │   'max_size': '50 MB'                                       │ │
hyperglass-1  | │ │        │   },                                                            │ │
hyperglass-1  | │ │        │   'web': {                                                      │ │
hyperglass-1  | │ │        │   │   'location_display_mode': 'dropdown',                      │ │
hyperglass-1  | │ │        │   │   'logo': {                                                 │ │
hyperglass-1  | │ │        │   │   │   'dark':                                               │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-light.svg',                    │ │
hyperglass-1  | │ │        │   │   │   'light':                                              │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-dark.svg',                     │ │
hyperglass-1  | │ │        │   │   │   'favicon':                                            │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-favicon.png'                   │ │
hyperglass-1  | │ │        │   │   },                                                        │ │
hyperglass-1  | │ │        │   │   'credit': {'enable': False},                              │ │
hyperglass-1  | │ │        │   │   'links': [                                                │ │
hyperglass-1  | │ │        │   │   │   {                                                     │ │
hyperglass-1  | │ │        │   │   │   │   'title': 'Website',                               │ │
hyperglass-1  | │ │        │   │   │   │   'url': '/etc/hyperglass/https:/www.eai.net.br',   │ │
hyperglass-1  | │ │        │   │   │   │   'side': 'right',                                  │ │
hyperglass-1  | │ │        │   │   │   │   'order': 1                                        │ │
hyperglass-1  | │ │        │   │   │   },                                                    │ │
hyperglass-1  | │ │        │   │   │   {                                                     │ │
hyperglass-1  | │ │        │   │   │   │   'title': 'PeeringDB',                             │ │
hyperglass-1  | │ │        │   │   │   │   'url':                                            │ │
hyperglass-1  | │ │        '/etc/hyperglass/https:/www.peeringdb.com/asn/{primary_asn}',     │ │
hyperglass-1  | │ │        │   │   │   │   'side': 'right',                                  │ │
hyperglass-1  | │ │        │   │   │   │   'order': 2                                        │ │
hyperglass-1  | │ │        │   │   │   }                                                     │ │
hyperglass-1  | │ │        │   │   ]                                                         │ │
hyperglass-1  | │ │        │   }                                                             │ │
hyperglass-1  | │ │        }                                                                 │ │
hyperglass-1  | │ │ self = Params()                                                          │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | ╰──────────────────────────────────────────────────────────────────────────────╯
hyperglass-1  | ValidationError: 2 validation errors for Params
hyperglass-1  | web.links.0.url
hyperglass-1  |   Input should be a valid URL, relative URL without a base [type=url_parsing, 
hyperglass-1  | input_value='/etc/hyperglass/https:/www.eai.net.br', input_type=str]
hyperglass-1  |     For further information visit https://errors.pydantic.dev/2.7/v/url_parsing
hyperglass-1  | web.links.1.url
hyperglass-1  |   Input should be a valid URL, relative URL without a base [type=url_parsing, 
hyperglass-1  | input_value='/etc/hyperglass/https:/w...b.com/asn/{primary_asn}', 
hyperglass-1  | input_type=str]
hyperglass-1  |     For further information visit https://errors.pydantic.dev/2.7/v/url_parsing
hyperglass-1 exited with code 1

org_name: Eaí
plugins: []
primary_asn: 61599
request_timeout: 90
site_description: "{org_name} Network Tools"
site_title: Eaí Network-Tools
cache:
  timeout: 120
  show_text: true
logging:
  directory: /var/log
  format: text
  max_size: 50 MB
web:
  location_display_mode: dropdown
  logo:
    dark: /etc/hyperglass/static/images/eai-light.svg
    light: /etc/hyperglass/static/images/eai-dark.svg
    favicon: /etc/hyperglass/static/images/eai-favicon.png
  credit:
    enable: false
  links:
  - title: Website
    url: https://www.eai.net.br
    side: right
    order: 1
  - title: PeeringDB
    url: https://www.peeringdb.com/asn/{primary_asn}
    side: right
    order: 2
  - title: Qrator
    url: https://radar.qrator.net/as/61599/overview
    side: right
    order: 3
menus:
  - title: Contact
    content: "Please contact [noc@eai.net.br](mailto:noc@eai.net.br) to get support."
    side: left
    order: 2

@M0NsTeRRR
Copy link
Contributor

M0NsTeRRR commented Jun 1, 2024

@M0NsTeRRR yes, using Docker.

@allanfrizzo #249 essentially disables the value rewrite for anything other than plugins, so it isn't a valid solution.

Have you tried rebuilding the container? docker compose build && docker compose up

Yes #249 is not a working solution as it breaks other things.

I got the same issue as @allanfrizzo (just tested with a new build and with this config). I think your Docker didn't rebuild because you had it in cache. Try running docker compose build --no-cache && docker compose up instead.

hyperglass-1  | web.menus.1.url
hyperglass-1  |   Extra inputs are not permitted [type=extra_forbidden,
hyperglass-1  | input_value='/etc/hyperglass/https:/www.eai.net.br', input_type=str]
hyperglass-1  |     For further information visit
hyperglass-1  | https://errors.pydantic.dev/2.7/v/extra_forbidden

@thatmattlove
Copy link
Owner Author

If that works, I'll add --no-cache to the upgrade docs. Please let me know!

@allanfrizzo
Copy link

Still the same error.

[root@hyperglass hyperglass]# docker compose build --no-cache && docker compose up
WARN[0000] The "HYPERGLASS_APP_PATH" variable is not set. Defaulting to a blank string. 
[+] Building 136.5s (14/14) FINISHED                                                                                             docker:default
 => [hyperglass internal] load build definition from Dockerfile                                                                            0.0s
 => => transferring dockerfile: 703B                                                                                                       0.0s
 => [hyperglass internal] load metadata for docker.io/library/python:3.12.3-alpine                                                         0.9s
 => [hyperglass internal] load .dockerignore                                                                                               0.0s
 => => transferring context: 553B                                                                                                          0.0s
 => [hyperglass base 1/3] FROM docker.io/library/python:3.12.3-alpine@sha256:5365725a6cd59b72a927628fdda9965103e3dc671676c89ef3ed8b8b0e22  0.0s
 => [hyperglass internal] load build context                                                                                               0.1s
 => => transferring context: 60.17kB                                                                                                       0.0s
 => CACHED [hyperglass base 2/3] WORKDIR /opt/hyperglass                                                                                   0.0s
 => [hyperglass base 3/3] COPY . .                                                                                                         0.2s
 => [hyperglass ui 1/4] WORKDIR /opt/hyperglass/hyperglass/ui                                                                              0.0s
 => [hyperglass ui 2/4] RUN apk add build-base pkgconfig cairo-dev nodejs npm                                                              8.0s
 => [hyperglass ui 3/4] RUN npm install -g pnpm                                                                                            2.8s 
 => [hyperglass ui 4/4] RUN pnpm install -P                                                                                               16.6s 
 => [hyperglass hyperglass 1/2] WORKDIR /opt/hyperglass                                                                                    0.1s 
 => [hyperglass hyperglass 2/2] RUN pip3 install -e .                                                                                     70.6s 
 => [hyperglass] exporting to image                                                                                                       36.9s 
 => => exporting layers                                                                                                                   36.9s 
 => => writing image sha256:15ffb8c26de1987e4abf4ea13de878749c976cc6dd5d7f3b4a9cc36a2fc2f504                                               0.0s 
 => => naming to docker.io/library/hyperglass-hyperglass                                                                                   0.0s 
WARN[0000] The "HYPERGLASS_APP_PATH" variable is not set. Defaulting to a blank string.                                                         
[+] Running 2/2                                                                                                                                 
 ✔ Container hyperglass-redis-1       Created                                                                                              0.0s 
 ✔ Container hyperglass-hyperglass-1  Recreated                                                                                            0.1s 
Attaching to hyperglass-1, redis-1
redis-1       | 1:C 01 Jun 2024 18:50:31.420 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-1       | 1:C 01 Jun 2024 18:50:31.420 * Redis version=7.2.5, bits=64, commit=00000000, modified=0, pid=1, just started
redis-1       | 1:C 01 Jun 2024 18:50:31.420 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis-1       | 1:M 01 Jun 2024 18:50:31.421 * monotonic clock: POSIX clock_gettime
redis-1       | 1:M 01 Jun 2024 18:50:31.422 * Running mode=standalone, port=6379.
redis-1       | 1:M 01 Jun 2024 18:50:31.423 * Server initialized
redis-1       | 1:M 01 Jun 2024 18:50:31.424 * Loading RDB produced by version 7.2.5
redis-1       | 1:M 01 Jun 2024 18:50:31.424 * RDB age 142 seconds
redis-1       | 1:M 01 Jun 2024 18:50:31.424 * RDB memory usage when created 0.90 Mb
redis-1       | 1:M 01 Jun 2024 18:50:31.425 * Done loading RDB, keys loaded: 2, keys expired: 0.
redis-1       | 1:M 01 Jun 2024 18:50:31.425 * DB loaded from disk: 0.001 seconds
redis-1       | 1:M 01 Jun 2024 18:50:31.425 * Ready to accept connections tcp
hyperglass-1  | [CRITICAL] 20240601 18:50:33 | 2 validation errors for Params
hyperglass-1  | web.links.0.url
hyperglass-1  |   Input should be a valid URL, relative URL without a base [type=url_parsing, input_value='/etc/hyperglass/https:/www.eai.net.br', input_type=str]
hyperglass-1  |     For further information visit https://errors.pydantic.dev/2.7/v/url_parsing
hyperglass-1  | web.links.1.url
hyperglass-1  |   Input should be a valid URL, relative URL without a base [type=url_parsing, input_value='/etc/hyperglass/https:/w...b.com/asn/{primary_asn}', input_type=str]
hyperglass-1  |     For further information visit https://errors.pydantic.dev/2.7/v/url_parsing {}
hyperglass-1  | ╭───────────────────── Traceback (most recent call last) ──────────────────────╮
hyperglass-1  | │ /opt/hyperglass/hyperglass/cli/main.py:61 in _start                          │
hyperglass-1  | │                                                                              │
hyperglass-1  | │    58 │   │   │   if build_complete:                                         │
hyperglass-1  | │    59 │   │   │   │   run(workers)                                           │
hyperglass-1  | │    60 │   │   else:                                                          │
hyperglass-1  | │ ❱  61 │   │   │   run(workers)                                               │
hyperglass-1  | │    62 │                                                                      │
hyperglass-1  | │    63 │   except (KeyboardInterrupt, SystemExit) as err:                     │
hyperglass-1  | │    64 │   │   error_message = str(err)                                       │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────── locals ─────────────────────╮                         │
hyperglass-1  | │ │    build = False                                 │                         │
hyperglass-1  | │ │ build_ui = <function build_ui at 0x7f1dadf50680> │                         │
hyperglass-1  | │ │   kwargs = {'workers': None}                     │                         │
hyperglass-1  | │ │      run = <function run at 0x7f1dadf505e0>      │                         │
hyperglass-1  | │ │  workers = None                                  │                         │
hyperglass-1  | │ ╰──────────────────────────────────────────────────╯                         │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/main.py:180 in run                                │
hyperglass-1  | │                                                                              │
hyperglass-1  | │   177 │   │   │   state.clear()                                              │
hyperglass-1  | │   178 │   │   │   log.debug("Cleared hyperglass state")                      │
hyperglass-1  | │   179 │   │   unregister_all_plugins()                                       │
hyperglass-1  | │ ❱ 180 │   │   raise error                                                    │
hyperglass-1  | │   181 │   except (SystemExit, BaseException):                                │
hyperglass-1  | │   182 │   │   unregister_all_plugins()                                       │
hyperglass-1  | │   183 │   │   sys.exit(4)                                                    │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │ init_user_config = <function init_user_config at 0x7f1dadf507c0>         │ │
hyperglass-1  | │ │            state = HyperglassState(redis=Redis<ConnectionPool<Connectio… │ │
hyperglass-1  | │ │          workers = None                                                  │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/main.py:140 in run                                │
hyperglass-1  | │                                                                              │
hyperglass-1  | │   137 │   │   state = use_state()                                            │
hyperglass-1  | │   138 │   │   state.clear()                                                  │
hyperglass-1  | │   139 │   │                                                                  │
hyperglass-1  | │ ❱ 140 │   │   init_user_config()                                             │
hyperglass-1  | │   141 │   │                                                                  │
hyperglass-1  | │   142 │   │   enable_file_logging(                                           │
hyperglass-1  | │   143 │   │   │   directory=state.params.logging.directory,                  │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │ init_user_config = <function init_user_config at 0x7f1dadf507c0>         │ │
hyperglass-1  | │ │            state = HyperglassState(redis=Redis<ConnectionPool<Connectio… │ │
hyperglass-1  | │ │          workers = None                                                  │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/configuration/__init__.py:31 in init_user_config  │
hyperglass-1  | │                                                                              │
hyperglass-1  | │   28 │   state = use_state()                                                 │
hyperglass-1  | │   29 │   init_files()                                                        │
hyperglass-1  | │   30 │                                                                       │
hyperglass-1  | │ ❱ 31 │   _params = params or init_params()                                   │
hyperglass-1  | │   32 │   builtins = init_builtin_directives()                                │
hyperglass-1  | │   33 │   _custom = directives or init_directives()                           │
hyperglass-1  | │   34 │   _directives = builtins + _custom                                    │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │    devices = None                                                        │ │
hyperglass-1  | │ │ directives = None                                                        │ │
hyperglass-1  | │ │     params = None                                                        │ │
hyperglass-1  | │ │      state = HyperglassState(redis=Redis<ConnectionPool<Connection<host… │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/configuration/validate.py:41 in init_params       │
hyperglass-1  | │                                                                              │
hyperglass-1  | │    38 │   """Validate & initialize configuration parameters."""              │
hyperglass-1  | │    39 │   user_config = load_config("config", required=False)                │
hyperglass-1  | │    40 │   # Map imported user configuration to expected schema.              │
hyperglass-1  | │ ❱  41 │   params = Params(**user_config)                                     │
hyperglass-1  | │    42 │                                                                      │
hyperglass-1  | │    43 │   # # Set up file logging once configuration parameters are initiali │
hyperglass-1  | │    44 │   # enable_file_logging(                                             │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │ user_config = {                                                          │ │
hyperglass-1  | │ │               │   'org_name': 'Eaí',                                     │ │
hyperglass-1  | │ │               │   'plugins': [],                                         │ │
hyperglass-1  | │ │               │   'primary_asn': 61599,                                  │ │
hyperglass-1  | │ │               │   'request_timeout': 90,                                 │ │
hyperglass-1  | │ │               │   'site_description': '{org_name} Network Tools',        │ │
hyperglass-1  | │ │               │   'site_title': 'Eaí Network-Tools',                     │ │
hyperglass-1  | │ │               │   'cache': {'timeout': 120, 'show_text': True},          │ │
hyperglass-1  | │ │               │   'logging': {                                           │ │
hyperglass-1  | │ │               │   │   'directory': '/var/log',                           │ │
hyperglass-1  | │ │               │   │   'format': 'text',                                  │ │
hyperglass-1  | │ │               │   │   'max_size': '50 MB'                                │ │
hyperglass-1  | │ │               │   },                                                     │ │
hyperglass-1  | │ │               │   'web': {                                               │ │
hyperglass-1  | │ │               │   │   'location_display_mode': 'dropdown',               │ │
hyperglass-1  | │ │               │   │   'logo': {                                          │ │
hyperglass-1  | │ │               │   │   │   'dark':                                        │ │
hyperglass-1  | │ │               '/etc/hyperglass/static/images/eai-light.svg',             │ │
hyperglass-1  | │ │               │   │   │   'light':                                       │ │
hyperglass-1  | │ │               '/etc/hyperglass/static/images/eai-dark.svg',              │ │
hyperglass-1  | │ │               │   │   │   'favicon':                                     │ │
hyperglass-1  | │ │               '/etc/hyperglass/static/images/eai-favicon.png'            │ │
hyperglass-1  | │ │               │   │   },                                                 │ │
hyperglass-1  | │ │               │   │   'credit': {'enable': False},                       │ │
hyperglass-1  | │ │               │   │   'links': [                                         │ │
hyperglass-1  | │ │               │   │   │   {                                              │ │
hyperglass-1  | │ │               │   │   │   │   'title': 'Website',                        │ │
hyperglass-1  | │ │               │   │   │   │   'url': 'https://www.eai.net.br',           │ │
hyperglass-1  | │ │               │   │   │   │   'side': 'right',                           │ │
hyperglass-1  | │ │               │   │   │   │   'order': 1                                 │ │
hyperglass-1  | │ │               │   │   │   },                                             │ │
hyperglass-1  | │ │               │   │   │   {                                              │ │
hyperglass-1  | │ │               │   │   │   │   'title': 'PeeringDB',                      │ │
hyperglass-1  | │ │               │   │   │   │   'url':                                     │ │
hyperglass-1  | │ │               'https://www.peeringdb.com/asn/{primary_asn}',             │ │
hyperglass-1  | │ │               │   │   │   │   'side': 'right',                           │ │
hyperglass-1  | │ │               │   │   │   │   'order': 2                                 │ │
hyperglass-1  | │ │               │   │   │   }                                              │ │
hyperglass-1  | │ │               │   │   ]                                                  │ │
hyperglass-1  | │ │               │   }                                                      │ │
hyperglass-1  | │ │               }                                                          │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /opt/hyperglass/hyperglass/models/config/params.py:94 in __init__            │
hyperglass-1  | │                                                                              │
hyperglass-1  | │    91 │   web: Web = Web()                                                   │
hyperglass-1  | │    92 │                                                                      │
hyperglass-1  | │    93 │   def __init__(self, **kw: t.Any) -> None:                           │
hyperglass-1  | │ ❱  94 │   │   return super().__init__(**self.convert_paths(kw))              │
hyperglass-1  | │    95 │                                                                      │
hyperglass-1  | │    96 │   @field_validator("site_description")                               │
hyperglass-1  | │    97 │   def validate_site_description(cls: "Params", value: str, info: Val │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │   kw = {                                                                 │ │
hyperglass-1  | │ │        │   'org_name': 'Eaí',                                            │ │
hyperglass-1  | │ │        │   'plugins': [],                                                │ │
hyperglass-1  | │ │        │   'primary_asn': 61599,                                         │ │
hyperglass-1  | │ │        │   'request_timeout': 90,                                        │ │
hyperglass-1  | │ │        │   'site_description': '{org_name} Network Tools',               │ │
hyperglass-1  | │ │        │   'site_title': 'Eaí Network-Tools',                            │ │
hyperglass-1  | │ │        │   'cache': {'timeout': 120, 'show_text': True},                 │ │
hyperglass-1  | │ │        │   'logging': {                                                  │ │
hyperglass-1  | │ │        │   │   'directory': '/var/log',                                  │ │
hyperglass-1  | │ │        │   │   'format': 'text',                                         │ │
hyperglass-1  | │ │        │   │   'max_size': '50 MB'                                       │ │
hyperglass-1  | │ │        │   },                                                            │ │
hyperglass-1  | │ │        │   'web': {                                                      │ │
hyperglass-1  | │ │        │   │   'location_display_mode': 'dropdown',                      │ │
hyperglass-1  | │ │        │   │   'logo': {                                                 │ │
hyperglass-1  | │ │        │   │   │   'dark':                                               │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-light.svg',                    │ │
hyperglass-1  | │ │        │   │   │   'light':                                              │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-dark.svg',                     │ │
hyperglass-1  | │ │        │   │   │   'favicon':                                            │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-favicon.png'                   │ │
hyperglass-1  | │ │        │   │   },                                                        │ │
hyperglass-1  | │ │        │   │   'credit': {'enable': False},                              │ │
hyperglass-1  | │ │        │   │   'links': [                                                │ │
hyperglass-1  | │ │        │   │   │   {                                                     │ │
hyperglass-1  | │ │        │   │   │   │   'title': 'Website',                               │ │
hyperglass-1  | │ │        │   │   │   │   'url': 'https://www.eai.net.br',                  │ │
hyperglass-1  | │ │        │   │   │   │   'side': 'right',                                  │ │
hyperglass-1  | │ │        │   │   │   │   'order': 1                                        │ │
hyperglass-1  | │ │        │   │   │   },                                                    │ │
hyperglass-1  | │ │        │   │   │   {                                                     │ │
hyperglass-1  | │ │        │   │   │   │   'title': 'PeeringDB',                             │ │
hyperglass-1  | │ │        │   │   │   │   'url':                                            │ │
hyperglass-1  | │ │        'https://www.peeringdb.com/asn/{primary_asn}',                    │ │
hyperglass-1  | │ │        │   │   │   │   'side': 'right',                                  │ │
hyperglass-1  | │ │        │   │   │   │   'order': 2                                        │ │
hyperglass-1  | │ │        │   │   │   }                                                     │ │
hyperglass-1  | │ │        │   │   ]                                                         │ │
hyperglass-1  | │ │        │   }                                                             │ │
hyperglass-1  | │ │        }                                                                 │ │
hyperglass-1  | │ │ self = Params()                                                          │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ /usr/local/lib/python3.12/site-packages/pydantic/main.py:176 in __init__     │
hyperglass-1  | │                                                                              │
hyperglass-1  | │    173 │   │   """                                                           │
hyperglass-1  | │    174 │   │   # `__tracebackhide__` tells pytest and some other tools to om │
hyperglass-1  | │    175 │   │   __tracebackhide__ = True                                      │
hyperglass-1  | │ ❱  176 │   │   self.__pydantic_validator__.validate_python(data, self_instan │
hyperglass-1  | │    177 │                                                                     │
hyperglass-1  | │    178 │   # The following line sets a flag that we use to determine when `_ │
hyperglass-1  | │    179 │   __init__.__pydantic_base_init__ = True  # pyright: ignore[reportF │
hyperglass-1  | │                                                                              │
hyperglass-1  | │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
hyperglass-1  | │ │ data = {                                                                 │ │
hyperglass-1  | │ │        │   'org_name': 'Eaí',                                            │ │
hyperglass-1  | │ │        │   'plugins': [],                                                │ │
hyperglass-1  | │ │        │   'primary_asn': 61599,                                         │ │
hyperglass-1  | │ │        │   'request_timeout': 90,                                        │ │
hyperglass-1  | │ │        │   'site_description': '{org_name} Network Tools',               │ │
hyperglass-1  | │ │        │   'site_title': 'Eaí Network-Tools',                            │ │
hyperglass-1  | │ │        │   'cache': {'timeout': 120, 'show_text': True},                 │ │
hyperglass-1  | │ │        │   'logging': {                                                  │ │
hyperglass-1  | │ │        │   │   'directory': '/var/log',                                  │ │
hyperglass-1  | │ │        │   │   'format': 'text',                                         │ │
hyperglass-1  | │ │        │   │   'max_size': '50 MB'                                       │ │
hyperglass-1  | │ │        │   },                                                            │ │
hyperglass-1  | │ │        │   'web': {                                                      │ │
hyperglass-1  | │ │        │   │   'location_display_mode': 'dropdown',                      │ │
hyperglass-1  | │ │        │   │   'logo': {                                                 │ │
hyperglass-1  | │ │        │   │   │   'dark':                                               │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-light.svg',                    │ │
hyperglass-1  | │ │        │   │   │   'light':                                              │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-dark.svg',                     │ │
hyperglass-1  | │ │        │   │   │   'favicon':                                            │ │
hyperglass-1  | │ │        '/etc/hyperglass/static/images/eai-favicon.png'                   │ │
hyperglass-1  | │ │        │   │   },                                                        │ │
hyperglass-1  | │ │        │   │   'credit': {'enable': False},                              │ │
hyperglass-1  | │ │        │   │   'links': [                                                │ │
hyperglass-1  | │ │        │   │   │   {                                                     │ │
hyperglass-1  | │ │        │   │   │   │   'title': 'Website',                               │ │
hyperglass-1  | │ │        │   │   │   │   'url': '/etc/hyperglass/https:/www.eai.net.br',   │ │
hyperglass-1  | │ │        │   │   │   │   'side': 'right',                                  │ │
hyperglass-1  | │ │        │   │   │   │   'order': 1                                        │ │
hyperglass-1  | │ │        │   │   │   },                                                    │ │
hyperglass-1  | │ │        │   │   │   {                                                     │ │
hyperglass-1  | │ │        │   │   │   │   'title': 'PeeringDB',                             │ │
hyperglass-1  | │ │        │   │   │   │   'url':                                            │ │
hyperglass-1  | │ │        '/etc/hyperglass/https:/www.peeringdb.com/asn/{primary_asn}',     │ │
hyperglass-1  | │ │        │   │   │   │   'side': 'right',                                  │ │
hyperglass-1  | │ │        │   │   │   │   'order': 2                                        │ │
hyperglass-1  | │ │        │   │   │   }                                                     │ │
hyperglass-1  | │ │        │   │   ]                                                         │ │
hyperglass-1  | │ │        │   }                                                             │ │
hyperglass-1  | │ │        }                                                                 │ │
hyperglass-1  | │ │ self = Params()                                                          │ │
hyperglass-1  | │ ╰──────────────────────────────────────────────────────────────────────────╯ │
hyperglass-1  | ╰──────────────────────────────────────────────────────────────────────────────╯
hyperglass-1  | ValidationError: 2 validation errors for Params
hyperglass-1  | web.links.0.url
hyperglass-1  |   Input should be a valid URL, relative URL without a base [type=url_parsing, 
hyperglass-1  | input_value='/etc/hyperglass/https:/www.eai.net.br', input_type=str]
hyperglass-1  |     For further information visit https://errors.pydantic.dev/2.7/v/url_parsing
hyperglass-1  | web.links.1.url
hyperglass-1  |   Input should be a valid URL, relative URL without a base [type=url_parsing, 
hyperglass-1  | input_value='/etc/hyperglass/https:/w...b.com/asn/{primary_asn}', 
hyperglass-1  | input_type=str]
hyperglass-1  |     For further information visit https://errors.pydantic.dev/2.7/v/url_parsing
hyperglass-1 exited with code 1

@M0NsTeRRR
Copy link
Contributor

M0NsTeRRR commented Jun 1, 2024

If that works, I'll add --no-cache to the upgrade docs. Please let me know!

I mean the issue is on your side @thatmattlove, try to test with the command i've provided you should have the same issue as we have with @allanfrizzo.
The current implementation check if a "." is in the value variable and that is the issue.

if isinstance(value, str) and str(Settings.original_app_path) in value:

if isinstance(".", str) and "." in "https:/www.eai.net.br"

@thatmattlove
Copy link
Owner Author

I understand what you mean now. I have HYPERGLASS_APP_PATH set to a specific directory, that's why I'm not seeing it. You have it set to .

With that knowledge, I was able to reproduce the issue and have solved it with:

if isinstance(value, str) and str(Settings.original_app_path.absolute()) in value:
    if Settings.container:
        path = Path(value)
        return str(
            Settings.default_app_path.joinpath(
                *(
                    p
                    for p in path.parts
                    if p not in Settings.original_app_path.absolute().parts
                )
            )
        )

I'll get that into 2.0.2 and pushed up shortly.

@allanfrizzo
Copy link

I'm using the default configuration

HYPERGLASS_APP_PATH=/etc/hyperglass

@M0NsTeRRR
Copy link
Contributor

Yes exactly but we are not setting the variable as we don't need it.

value.startswith(str(Settings.original_app_path.absolute()))

is better than

str(Settings.original_app_path.absolute()) in value

@allanfrizzo
Copy link

with the adjustments worked as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants