• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

binbashar / leverage / 10565638072

pending completion
10565638072

Pull #278

github

web-flow
Merge 8485bfcd5 into d366287d3
Pull Request #278: Feature | adding python 3.12 in pyproject.toml

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.67
/leverage/modules/shell.py
1
import click
2✔
2

3
from leverage._utils import CustomEntryPoint
2✔
4
from leverage.container import get_docker_client, TerraformContainer
2✔
5
from leverage.modules.utils import env_var_option, mount_option, auth_sso, auth_mfa
2✔
6

7

8
@click.command()
2✔
9
@mount_option
2✔
10
@env_var_option
2✔
11
@auth_mfa
2✔
12
@auth_sso
2✔
13
def shell(mount, env_var, mfa, sso):
2✔
14
    """
15
    Run a shell in a generic container. It supports mounting local paths and injecting arbitrary environment variables.
16
    It also supports AWS credentials injection via mfa/sso.
17

18
    Syntax:
19
    leverage shell --mount <local-path> <container-path> --env-var <name> <value>
20

21
    Example:
22
    leverage shell --mount /home/user/bin/ /usr/bin/ --env-var env dev
23

24
    Both mount and env-var parameters can be provided multiple times.
25

26
    Example:
27
    leverage shell --mount /home/user/bin/ /usr/bin/ --mount /etc/config.ini /etc/config.ini --env-var init 5 --env-var env dev
28
    """
29
    if env_var:
×
30
        env_var = dict(env_var)
×
31
    # TODO: TerraformContainer is the only class supporting sso/mfa auth automagically
32
    #       Move this capacity into a mixin later
33
    container = TerraformContainer(get_docker_client(), mounts=mount, env_vars=env_var)
×
34
    container.ensure_image()
×
35

36
    # auth
37
    container.disable_authentication()
×
38
    if sso:
×
39
        container.enable_sso()
×
40
    if mfa:
×
41
        container.enable_mfa()
×
42

43
    with CustomEntryPoint(container, entrypoint=""):
×
44
        container._start(container.SHELL)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc