Skip to content

Commit

Permalink
Support security opt
Browse files Browse the repository at this point in the history
* Fix RuntimeError: Set changed size during iteration
  • Loading branch information
abraverm committed Jun 27, 2019
1 parent e753eb3 commit 29e2bf4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions podman-compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def tr_cntnet(project_name, services, given_containers):
@trans
def tr_1pod(project_name, services, given_containers):
"""
project_name:
project_name:
services: {service_name: ["container_name1", "..."]}, currently only one is supported
given_containers: [{}, ...]
"""
Expand Down Expand Up @@ -416,6 +416,9 @@ def container_to_args(cnt, dirname, podman_path, shared_vols):

if pod:
args.append('--pod={}'.format(pod))
sec = norm_as_list(cnt.get("security_opt"))
for s in sec:
args.extend(['--security-opt', s])
if cnt.get('read_only'):
args.append('--read-only')
for i in cnt.get('labels', []):
Expand Down Expand Up @@ -481,7 +484,7 @@ def container_to_args(cnt, dirname, podman_path, shared_vols):

def rec_deps(services, container_by_name, cnt, init_service):
deps = cnt["_deps"]
for dep in deps:
for dep in deps.copy():
dep_cnts = services.get(dep)
if not dep_cnts:
continue
Expand Down Expand Up @@ -603,7 +606,7 @@ def run_compose(

if not project_name:
project_name = dir_basename

dotenv_path = os.path.join(dirname, ".env")
if os.path.exists(dotenv_path):
with open(dotenv_path, 'r') as f:
Expand All @@ -614,7 +617,7 @@ def run_compose(

with open(filename, 'r') as f:
compose = rec_subs(yaml.safe_load(f), [os.environ, dotenv_dict])

compose['_dirname']=dirname
# debug mode
#print(json.dumps(compose, indent = 2))
Expand Down

0 comments on commit 29e2bf4

Please sign in to comment.