Skip to content

[supervisord.environment] double escaping of % #1441

Open
@plopidou

Description

@plopidou

Hi,

Not sure if this is a bug or I am not setting things up correctly.

Imagine the following (snipped) /etc/supervisord.conf file:

[supervisord]
<snip>
environment                      = STATIC_VAR="foo",
                                   DYNAMIC_VAR="bar_%%s_%%s"

DYNAMIC_VAR contains two "%s" placeholders, supposed to be replaced at runtime in a way similar to this:

from django.conf import settings
print(settings.DYNAMIC_VAR % (
    'foo',
    'bar'
))

... thus resulting in bar_foo_bar.

Now when I declare DYNAMIC_VAR in /etc/supervisord.conf, supervisord cannot start, and complains:

Error: Format string <snip> for 'supervisord.environment' is badly formatted: not enough arguments for format string

Please note:
. that environment variables with only one escaped %s work fine.
. that moving the "double %s" variable to individual included files (for individual programs) seems to work fine. For example:

[program:worker1]
environment                      = STATIC_VAR="foo",
                                   DYNAMIC_VAR="bar_%%s_%%s",
                                   WORKER_1_VAR_1"toto",
                                   WORKER_1_VAR_2="toto_too"

I am (I think!) following the docs, but could there be an issue with the presence of multiple escaped % within the same environment variable, only when declared in the top-leve configuration files?

Many thanks!

edit: supervisor 3.4.0 on Centos7.9.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions