Skip to content

Commit

Permalink
Use default value when fetching prefix+ '_URL'
Browse files Browse the repository at this point in the history
When a driver does not register an environment variable sufixed
with _URL, pifpaf will break having None when it expets a string.

Signed-off-by: Moisés Guimarães de Medeiros <[email protected]>
  • Loading branch information
moisesguimaraes committed Dec 2, 2020
1 parent 517aaab commit 8940379
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pifpaf/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def expand_urls_var(url):

putenv("PID", str(os.getpid()))
putenv("DAEMON", daemon)
url = os.getenv(driver.env_prefix + "_URL")
url = os.getenv(driver.env_prefix + "_URL", "")
putenv("%s_URL" % daemon.upper(), url)
os.putenv(global_urls_variable,
expand_urls_var(url))
Expand Down Expand Up @@ -251,7 +251,7 @@ def _cleanup(signum, frame):
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
signal.pause()
else:
url = driver.env['%s_URL' % driver.env_prefix]
url = driver.env.get('%s_URL' % driver.env_prefix, "")
driver.env.update({
"PIFPAF_PID": pid,
env_prefix + "_PID": pid,
Expand Down

0 comments on commit 8940379

Please sign in to comment.