1
0
mirror of /repos/baseimage-docker.git synced 2025-12-30 08:01:31 +01:00

Fix a regression in my_init which causes it to delete environment variables passed from Docker.

This commit is contained in:
Hongli Lai (Phusion) 2014-02-25 22:08:37 +01:00
parent 27782aca39
commit 367cddb201
No known key found for this signature in database
GPG Key ID: 06A131094B6F4332
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,7 @@
## 0.9.8
* Fixed a regression in `my_init` which causes it to delete environment variables passed from Docker.
## 0.9.7 (release date: 2014-02-25)
* Improved and fixed bugs in `my_init` (Thomas LÉVEIL):

View File

@ -54,14 +54,15 @@ def is_exe(path):
except OSError:
return False
def import_envvars():
def import_envvars(clear_existing_environment = True):
new_env = {}
for envfile in listdir("/etc/container_environment"):
name = os.path.basename(envfile)
with open("/etc/container_environment/" + envfile, "r") as f:
value = f.read()
new_env[name] = value
os.environ.clear()
if clear_existing_environment:
os.environ.clear()
for name, value in new_env.items():
os.environ[name] = value
@ -213,7 +214,7 @@ def install_insecure_key():
run_command_killable("/usr/sbin/enable_insecure_key")
def main(args):
import_envvars()
import_envvars(False)
export_envvars()
if args.enable_insecure_key: