Py-KMS-Organization/py-kms

[Docker] Multiple IPs in environment var causes failure to start server when using SQLite

speedst3r opened this issue · 7 comments

The change in #61 causes the server to fail to launch due to command syntax - the SQLite parameters get added after the connect statement.

Sat, 21 Jan 2023 12:40:46 INFO     Setting gid to '100'.
Sat, 21 Jan 2023 12:40:46 INFO     Setting uid to '100'.
Sat, 21 Jan 2023 12:40:46 INFO     Storing database file to /home/py-kms/db/pykms_database.db
unrecognized optional connect arguments: `-s`. Exiting...

I modified the start.py script to move the connect statement after the SQLite parameters and the server starts without issue.

  if enableSQLITE:
    loggersrv.info("Storing database file to %s" % dbPath)
    command.append('-s')
    command.append(dbPath)
    os.makedirs(os.path.dirname(dbPath), exist_ok=True)

  if len(listen_ip) > 1:
    command.append("connect")
    for i in range(1, len(listen_ip)):
      command.append("-n")
      command.append(listen_ip[i] + "," + listen_port)
      command.append("-d")

Can this be replicated, confirmed and start script modified for future container builds?

Ohmm, is this still relevant on the current next branch? Otherwise I would like to schedule this bug for the next release.

It would appear so. I just tried the newest python3-next image and get the same error.

I'm very sorry, but this issue does not make any sense with our current code base. The start.py is not calling the client nowadays anymore and just passes everything to the server.

It makes sense - the order of arguments in start.py causes an error if you enable SQLite support and are supplying multiple IP addresses to bind to. pykms_Server.py expects the connect argument and its options to be the last argument supplied; in the current start.py it isn't - -s for database support is. When I re-order the arguments in start.py so the block that builds the connect argument is last, the server starts successfully.

Let me check again...

Oh! This is a combination of two bugs!

  • your -s bug with multiple ips
  • the start.py always enabling the webui due to a typing error

@speedst3r Thanks for your bug-report and for being persistent! 😁