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

Error: Format string which cannot be expanded #958

Closed
mesarvagya opened this issue Jul 5, 2017 · 1 comment
Closed

Error: Format string which cannot be expanded #958

mesarvagya opened this issue Jul 5, 2017 · 1 comment

Comments

@mesarvagya
Copy link

I am trying to get the value of variables exported in environment inside the supervisor. My configuration looks like this:

[program:notificationhandler]
directory=/home/sp0090
command=sh run_notification.sh
environment=TWITTERACCESSTOKEN=%(ENV_TWITTERACCESSTOKEN)s
killasgroup=true
stopasgroup=true
autostart=true
autorestart=true
stopsignal=KILL
stdout_logfile=/var/log/celery/notification.log
stderr_logfile=/var/log/celery/notification.log

For this configuration, I get the error:

Error: Format string 'TWITTERACCESSTOKEN=%(ENV_TWITTERACCESSTOKEN)s' for 'environment' contains names ('ENV_TWITTERACCESSTOKEN') which cannot be expanded. Available names: ENV_HISTSIZE, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_LOGNAME, ENV_LS_COLORS, ENV_MAIL, ENV_PATH, ENV_SHELL, ENV_SUDO_COMMAND, ENV_SUDO_GID, ENV_SUDO_UID, ENV_SUDO_USER, ENV_TERM, ENV_USER, ENV_USERNAME, group_name, here, host_node_name, process_num, program_name in section 'program:notificationhandler' (file: '/etc/supervisord.conf')
For help, use /bin/supervisord -h

I have tried other combination as well. Listed below are those:

TWITTER_ACCESS_TOKEN=%(ENV_TWITTER_ACCESS_TOKEN)s
TWITTER_ACCESS_TOKEN=%(ENV_TWITTERACCESSTOKEN)s
TWITTERACCESSTOKEN=%(ENV_TWITTER_ACCESS_TOKEN)s
TWITTERACCESSTOKEN=%(ENV_TWITTERACCESSTOKEN)s

All 4 of these gives the same error. I am using supervisor 3.3.1. What am I doing wrong here?

@mnaberez
Copy link
Member

mnaberez commented Jul 5, 2017

Please ask questions about using Supervisor on the supervisor-users mailing list. We use this issue tracker mainly for bugs in Supervisor itself.

The Subprocess Environment section in the documentation explains how the subprocess environment is created.

From the error message:

Error: Format string 'TWITTERACCESSTOKEN=%(ENV_TWITTERACCESSTOKEN)s' for 'environment' contains names ('ENV_TWITTERACCESSTOKEN') which cannot be expanded. Available names: ENV_HISTSIZE, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_LOGNAME, ENV_LS_COLORS, ENV_MAIL, ENV_PATH, ENV_SHELL, ENV_SUDO_COMMAND, ENV_SUDO_GID, ENV_SUDO_UID, ENV_SUDO_USER, ENV_TERM, ENV_USER, ENV_USERNAME, group_name, here, host_node_name, process_num, program_name in section 'program:notificationhandler' (file: '/etc/supervisord.conf')

You're trying to use the expansion %(ENV_TWITTERACCESSTOKEN)s in the config file. This means that a TWITTERACCESSTOKEN variable must exist in supervisord's environment.
TWITTERACCESSTOKEN is not set in supervisord's environment, so it can't be expanded.

@mnaberez mnaberez closed this as completed Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants