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

SyntaxError: invalid syntax. Perhaps you forgot a comma? #106

Open
burnbrigther opened this issue Jun 24, 2024 · 6 comments
Open

SyntaxError: invalid syntax. Perhaps you forgot a comma? #106

burnbrigther opened this issue Jun 24, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@burnbrigther
Copy link

Summary

In latest version, new error introduced.

2024-06-24T18:31:52.264662694Z SyntaxError: invalid syntax. Perhaps you forgot a comma?
2024-06-24T18:31:53.303132972Z 2024-06-24.11:31:53 [STARTING] ** [traefik-cloudflare-companion] [51] Starting Traefik Cloudflare Companion
2024-06-24T18:31:53.318834335Z   File "/usr/sbin/cloudflare-companion", line 183
2024-06-24T18:31:53.318854618Z     u'proxied': domain_info['proxied']
2024-06-24T18:31:53.318859114Z                 ^^^^^^^^^^^^^^^^^^^^^^

Steps to reproduce

  1. Install latest update on docker (docker container pull)
  2. Start with new image
  3. Check logs

What is the expected correct behavior?

No error, functionality restored. Updates are still not working.

Relevant logs and/or screenshots

See above

Environment

docker on a privileged VM
Latest version of cf-companion

  • Image version / tag: latest
  • Host OS: Linux myhost 5.15.0-112-generic #122-Ubuntu SMP Thu May 23 07:48:21 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Any logs | docker-compose.yml
services:
# Cloudflare-Companion - Automatic CNAME DNS Creation
  cf-companion:
    container_name: cf-companion
    image: tiredofit/traefik-cloudflare-companion:latest
    restart: always
    profiles: ["core", "security", "all"]
    networks:
      - socket_proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - TIMEZONE=$TZ
      - TRAEFIK_VERSION=2
      - CF_TOKEN=$CLOUDFLARE_SUPER_API_KEY # Same as traefik
      - TARGET_DOMAIN=$DOMAINNAME_1
      - DOMAIN1=$DOMAINNAME_1
      - DOMAIN1_ZONE_ID=$CLOUDFLARE_ZONEID # Copy from Cloudflare Overview page
      - DOMAIN1_PROXIED=TRUE
    labels:
      # Add hosts specified in rules here to force cf-companion to create the CNAMEs
      # Since cf-companion creates CNAMEs based on host rules, this a workaround for non-docker/external apps
#      - "traefik.http.routers.cf-companion-rtr.rule=Host(`my-host.$DOMAINNAME_1`) || Host(`my-host.$DOMAINNAME_2`)"
      - "traefik.http.routers.cf-companion-rtr.rule=Host(`my-host.$DOMAINNAME_1`)"
      - "diun.enable=true"

ERROR:

SyntaxError: invalid syntax. Perhaps you forgot a comma?
2024-06-24.11:37:21 [STARTING] ** [traefik-cloudflare-companion] [68] Starting Traefik Cloudflare Companion
  File "/usr/sbin/cloudflare-companion", line 183
    u'proxied': domain_info['proxied']
                ^^^^^^^^^^^^^^^^^^^^^^

I tried both single domain and dual-domain configuration, as shown in the commented configuration code with same resulting error.

Possible fixes

@burnbrigther burnbrigther added the bug Something isn't working label Jun 24, 2024
@tiredofit
Copy link
Owner

Thanks for the report - Definitely a comma. 7.3.1 resolves and is building as I write this.

@burnbrigther
Copy link
Author

Thank you for fixing this.

@rdgerken
Copy link

rdgerken commented Jul 2, 2024

I can confirm that 7.3.1 fixes this issue - however, the docker latest tag is still mapped to 7.3.0. Perhaps this was intentional? If so, please disregard. Thanks for fixing!

@zakhounet
Copy link

Hello,

I have a "simple" docker swarm 1 master & 1 worker. I am using the last Traefik Cloudflare companion (7.3.1) and I am also having a warning syntax error :

Image: tiredofit/traefik-cloudflare-companion | Version 7.3.1 Type 'image_changelog' for details

2024-07-15.19:34:34 [STARTING] ** [traefik-cloudflare-companion] [1] Starting Traefik Cloudflare Companion
traefik_cloudflare-companion.1.9o47vn7at0oo@swarm-master
/usr/sbin/cloudflare-companion:289: SyntaxWarning: invalid escape sequence '.'
if re.match('traefik.?.rule', prop):
/usr/sbin/cloudflare-companion:322: SyntaxWarning: invalid escape sequence '.'
if re.match('traefik.
?.rule', prop):
2024-07-15.19:34:34 [STARTING] ** [monitoring] [1] Starting Zabbix Agent (modern) 7.0.0
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/urllib3/util/connection.py", line 72, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/socket.py", line 963, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name does not resolve

Thanks for your help

@brettinternet
Copy link

Hi, I'm seeing the same thing:

/usr/sbin/cloudflare-companion:289: SyntaxWarning: invalid escape sequence '\.'
  if re.match('traefik.*?\.rule', prop):
/usr/sbin/cloudflare-companion:322: SyntaxWarning: invalid escape sequence '\.'
  if re.match('traefik.*?\.rule', prop):
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 416, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 244, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/lib/python3.12/http/client.py", line 1336, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1382, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1331, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.12/http/client.py", line 1091, in _send_output
    self.send(msg)
  File "/usr/lib/python3.12/http/client.py", line 1035, in send
    self.connect()
  File "/usr/lib/python3.12/site-packages/docker/transport/unixconn.py", line 27, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

Is this a change in Traefik V3?

@jgibson02
Copy link

jgibson02 commented Oct 2, 2024

Seeing the same as above, also trying to use this with Traefik v3. I see there's an open PR that might resolve it?

2024-10-02.02:17:14 [NOTICE] ** [timezone] Timezone: Setting to 'America/Los_Angeles' from 'Etc/GMT'
2024-10-01.19:17:14 [NOTICE] ** [monitoring] Container configured for monitoring with 'zabbix modern'
2024-10-01.19:17:15 [STARTING] ** [traefik-cloudflare-companion] [1] Starting Traefik Cloudflare Companion
/usr/sbin/cloudflare-companion:289: SyntaxWarning: invalid escape sequence '\.'
  if re.match('traefik.*?\.rule', prop):
/usr/sbin/cloudflare-companion:322: SyntaxWarning: invalid escape sequence '\.'
  if re.match('traefik.*?\.rule', prop):
2024-10-01.19:17:15 [STARTING] ** [monitoring] [1] Starting Zabbix Agent (modern) 7.0.0

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

No branches or pull requests

6 participants