mirror of
/repos/baseimage-docker.git
synced 2025-12-30 08:01:31 +01:00
my_init: do not use /etc/container_environment if directory doesn't exist
This commit is contained in:
parent
9e65ebfbdc
commit
e575443aba
@ -1,3 +1,7 @@
|
||||
## 0.9.17 (not yet released)
|
||||
|
||||
* `my_init` no longer reads from and writes to `/etc/container_environment` if that directory does not exist. Previously it would abort with an error. This change makes it easier to reuse `my_init` in other (non-Baseimage-docker-based) projects without having to modify it.
|
||||
|
||||
## 0.9.16 (release date: 2015-01-20)
|
||||
|
||||
* `docker exec` is now the default and recommended mechanism for running commands in the container. SSH is now disabled by default, but is still supported for those cases where "docker exec" is not appropriate. Closes GH-168.
|
||||
|
||||
@ -57,6 +57,8 @@ def is_exe(path):
|
||||
return False
|
||||
|
||||
def import_envvars(clear_existing_environment = True, override_existing_environment = True):
|
||||
if not os.path.exists("/etc/container_environment"):
|
||||
return
|
||||
new_env = {}
|
||||
for envfile in listdir("/etc/container_environment"):
|
||||
name = os.path.basename(envfile)
|
||||
@ -73,6 +75,8 @@ def import_envvars(clear_existing_environment = True, override_existing_environm
|
||||
os.environ[name] = value
|
||||
|
||||
def export_envvars(to_dir = True):
|
||||
if not os.path.exists("/etc/container_environment"):
|
||||
return
|
||||
shell_dump = ""
|
||||
for name, value in os.environ.items():
|
||||
if name in ['HOME', 'USER', 'GROUP', 'UID', 'GID', 'SHELL']:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user