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

Clean up the dev-env errors #2374

Open
8 tasks done
fedepaol opened this issue Apr 17, 2024 · 2 comments
Open
8 tasks done

Clean up the dev-env errors #2374

fedepaol opened this issue Apr 17, 2024 · 2 comments

Comments

@fedepaol
Copy link
Member

MetalLB Version

not applicable

Deployment method

Charts

Main CNI

not applicable

Kubernetes Version

No response

Cluster Distribution

No response

Describe the bug

Running dev-env gives the following warnings:

inv --list
/home/kka/workspace/github.com/metallb/metallb/tasks.py:458: SyntaxWarning: invalid escape sequence '\{'
  "--set frr-k8s.prometheus.serviceMonitor.metricRelabelings[0].sourceLabels=\{__name__\} "
/home/kka/workspace/github.com/metallb/metallb/tasks.py:461: SyntaxWarning: invalid escape sequence '\$'
  "--set frr-k8s.prometheus.serviceMonitor.metricRelabelings[0].replacement=\"metallb_bgp_\$1\" "
/home/kka/workspace/github.com/metallb/metallb/tasks.py:462: SyntaxWarning: invalid escape sequence '\{'
  "--set frr-k8s.prometheus.serviceMonitor.metricRelabelings[1].sourceLabels=\{__name__\} "
/home/kka/workspace/github.com/metallb/metallb/tasks.py:465: SyntaxWarning: invalid escape sequence '\$'
  "--set frr-k8s.prometheus.serviceMonitor.metricRelabelings[1].replacement=\"metallb_bfd_\$1\" "

and we should fix them

To Reproduce

See above

Expected Behavior

No warnings

Additional Context

_

I've read and agree with the following

  • I've checked all open and closed issues and my request is not there.
  • I've checked all open and closed pull requests and my request is not there.

I've read and agree with the following

  • I've checked all open and closed issues and my issue is not there.
  • This bug is reproducible when deploying MetalLB from the main branch
  • I have read the troubleshooting guide and I am still not able to make it work
  • I checked the logs and MetalLB is not discarding the configuration as not valid
  • I enabled the debug logs, collected the information required from the cluster using the collect script and will attach them to the issue
  • I will provide the definition of my service and the related endpoint slices and attach them to this issue
@tozastation
Copy link
Contributor

tozastation commented Apr 17, 2024

I have found the relevant code and will check and modify it...!

[Memo]

  • 1
    • Python: 3.10.13
    • invoke: 2.2.0
    • Exec inv --list Result: non error
  • 2
    • Python 3.12.2
    • invoke: 2.2.0
    • Exec inv --list Result: Show same error

❯ asdf local python 3.12.3
❯ inv --list
/Users/tozastation/ghq/github.com/tozastation/metallb/tasks.py:458: SyntaxWarning: invalid escape sequence '{'
"--set frr-k8s.prometheus.serviceMonitor.metricRelabelings[0].sourceLabels={name} "
/Users/tozastation/ghq/github.com/tozastation/metallb/tasks.py:461: SyntaxWarning: invalid escape sequence '$'
"--set frr-k8s.prometheus.serviceMonitor.metricRelabelings[0].replacement="metallb_bgp_$1" "
/Users/tozastation/ghq/github.com/tozastation/metallb/tasks.py:462: SyntaxWarning: invalid escape sequence '{'
"--set frr-k8s.prometheus.serviceMonitor.metricRelabelings[1].sourceLabels={name} "
/Users/tozastation/ghq/github.com/tozastation/metallb/tasks.py:465: SyntaxWarning: invalid escape sequence '$'
"--set frr-k8s.prometheus.serviceMonitor.metricRelabelings[1].replacement="metallb_bfd_$1" "

Specification changes in python 3.12.0

https://docs.python.org/3/whatsnew/3.12.html#other-language-changes

A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence, use raw strings for regular expression: re.compile(r"\d+.\d+")). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. (Contributed by Victor Stinner in gh-98401.)

PEP tell me : PEP 8: W605 invalid escape sequence '\$

[TEST] Commands to run the modified code

inv dev-env -h -w -b frr-k8s

@fedepaol
Copy link
Member Author

awesome, thanks @tozastation !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants