mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
dev-container: Add command to print container IP address
Add './container ip' command to print current IP address of the container. Useful when running container related scripts on host machine. Signed-off-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
fc7696d181
commit
fd296ad063
12
container
12
container
@ -262,6 +262,13 @@ def parse_arguments():
|
|||||||
subparser.add_argument('--image-size', default='12G',
|
subparser.add_argument('--image-size', default='12G',
|
||||||
help='Disk image size to resize to after download')
|
help='Disk image size to resize to after download')
|
||||||
|
|
||||||
|
# Print IP address
|
||||||
|
subparser = subparsers.add_parser(
|
||||||
|
'ip', help='Print the IP address of the container.')
|
||||||
|
subparser.add_argument(
|
||||||
|
'--distribution', choices=distributions, default='testing',
|
||||||
|
help='Distribution of the container to print IP address')
|
||||||
|
|
||||||
# ssh
|
# ssh
|
||||||
subparser = subparsers.add_parser('ssh', help='SSH into the container')
|
subparser = subparsers.add_parser('ssh', help='SSH into the container')
|
||||||
subparser.add_argument('--distribution', choices=distributions,
|
subparser.add_argument('--distribution', choices=distributions,
|
||||||
@ -926,6 +933,11 @@ def subcommand_up(arguments):
|
|||||||
_print_banner(arguments.distribution)
|
_print_banner(arguments.distribution)
|
||||||
|
|
||||||
|
|
||||||
|
def subcommand_ip(arguments):
|
||||||
|
"""Print the IP address of the container."""
|
||||||
|
print(_get_ip_address(arguments.distribution) or '')
|
||||||
|
|
||||||
|
|
||||||
def subcommand_ssh(arguments):
|
def subcommand_ssh(arguments):
|
||||||
"""Open an SSH shell into the container."""
|
"""Open an SSH shell into the container."""
|
||||||
ip_address = _wait_for(lambda: _get_ip_address(arguments.distribution))
|
ip_address = _wait_for(lambda: _get_ip_address(arguments.distribution))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user