mirror of
https://github.com/containers/podman-compose.git
synced 2025-04-25 18:09:02 +02:00
implement --publish in docker-compose run
Signed-off-by: Denis Ledoux <dle@odoo.com>
This commit is contained in:
parent
2681566580
commit
72a94d5185
@ -2587,6 +2587,10 @@ def compose_run_update_container_from_args(compose, cnt, args):
|
|||||||
del cnt[k]
|
del cnt[k]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
if args.publish:
|
||||||
|
ports = cnt.get("ports", [])
|
||||||
|
ports.extend(norm_ports(args.publish))
|
||||||
|
cnt["ports"] = ports
|
||||||
if args.volume:
|
if args.volume:
|
||||||
# TODO: handle volumes
|
# TODO: handle volumes
|
||||||
volumes = clone(cnt.get("volumes", None) or [])
|
volumes = clone(cnt.get("volumes", None) or [])
|
||||||
|
@ -35,6 +35,21 @@ class TestComposeRunUpdateContainerFromArgs(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
self.assertEqual(cnt, expected_cnt)
|
self.assertEqual(cnt, expected_cnt)
|
||||||
|
|
||||||
|
def test_publish_ports(self):
|
||||||
|
cnt = get_minimal_container()
|
||||||
|
compose = get_minimal_compose()
|
||||||
|
args = get_minimal_args()
|
||||||
|
args.publish = ["1111", "2222:2222"]
|
||||||
|
|
||||||
|
compose_run_update_container_from_args(compose, cnt, args)
|
||||||
|
|
||||||
|
expected_cnt = {
|
||||||
|
"name": "default_name",
|
||||||
|
"ports": ["1111", "2222:2222"],
|
||||||
|
"tty": True,
|
||||||
|
}
|
||||||
|
self.assertEqual(cnt, expected_cnt)
|
||||||
|
|
||||||
|
|
||||||
def get_minimal_container():
|
def get_minimal_container():
|
||||||
return {}
|
return {}
|
||||||
@ -53,6 +68,7 @@ def get_minimal_args():
|
|||||||
name="default_name",
|
name="default_name",
|
||||||
rm=None,
|
rm=None,
|
||||||
service=None,
|
service=None,
|
||||||
|
publish=None,
|
||||||
service_ports=None,
|
service_ports=None,
|
||||||
user=None,
|
user=None,
|
||||||
volume=None,
|
volume=None,
|
||||||
|
Loading…
Reference in New Issue
Block a user