Skip to content

Commit

Permalink
fixed local run notyy message not appearing with --build
Browse files Browse the repository at this point in the history
  • Loading branch information
mjksmith committed Dec 2, 2016
1 parent b5f4f51 commit 7641297
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 13 additions & 6 deletions paasta_tools/cli/cmds/local_run.py
Expand Up @@ -632,18 +632,25 @@ def configure_and_run_docker_container(
Function prints the output of run command in stdout.
"""

soa_dir = args.yelpsoa_config_root
if instance is None and args.healthcheck:
paasta_print(
"With --healthcheck, --instance must be provided!",
file=sys.stderr,
)
sys.exit(1)
if instance is None and not sys.stdin.isatty():
paasta_print(
"--instance and --cluster must be specified when using paasta local-run without a tty!",
file=sys.stderr,
)
sys.exit(1)

soa_dir = args.yelpsoa_config_root
volumes = list()

load_deployments = docker_hash is None or pull_image

interactive = args.interactive

try:
if instance is None and args.healthcheck:
paasta_print("With --healthcheck, --instance must be provided!", file=sys.stderr)
sys.exit(1)
if instance is None:
instance_type = 'adhoc'
instance = 'interactive'
Expand Down
2 changes: 2 additions & 0 deletions tests/cli/test_cmds_local_run.py
Expand Up @@ -479,11 +479,13 @@ def test_configure_and_run_pulls_image_when_asked(

def test_configure_and_run_docker_container_defaults_to_interactive_instance():
with contextlib.nested(
mock.patch('paasta_tools.cli.cmds.local_run.sys.stdin.isatty', autospec=True, return_value=True),
mock.patch('paasta_tools.cli.cmds.local_run.validate_service_instance', autospec=True),
mock.patch('paasta_tools.cli.cmds.local_run.socket.getfqdn', autospec=True),
mock.patch('paasta_tools.cli.cmds.local_run.run_docker_container', autospec=True),
mock.patch('paasta_tools.cli.cmds.local_run.get_default_interactive_config', autospec=True),
) as (
_,
mock_validate_service_instance,
mock_socket_get_fqdn,
mock_run_docker_container,
Expand Down

0 comments on commit 7641297

Please sign in to comment.