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

binbashar / leverage / 15832423341

23 Jun 2025 06:42PM UTC coverage: 61.138% (+0.2%) from 60.982%
15832423341

Pull #305

github

angelofenoglio
Upgrade release drafter version
Pull Request #305: BL-255 | Add `tofu` command to cli

210 of 476 branches covered (44.12%)

Branch coverage included in aggregate %.

48 of 57 new or added lines in 8 files covered. (84.21%)

41 existing lines in 2 files now uncovered.

2606 of 4130 relevant lines covered (63.1%)

0.63 hits per line

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

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

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

7

8
@click.command()
1✔
9
@mount_option
1✔
10
@env_var_option
1✔
11
@auth_mfa
1✔
12
@auth_sso
1✔
13
def shell(mount, env_var, mfa, sso):
1✔
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: TFContainer is the only class supporting sso/mfa auth automagically
32
    #       Move this capacity into a mixin later
NEW
33
    container = TFContainer(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