Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pyinfra_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _print_support(ctx, param, value):

@click.command(context_settings=CONTEXT_SETTINGS)
@click.argument("inventory", nargs=1, type=click.Path(exists=False))
@click.argument("operations", nargs=-1, required=True, type=click.Path(exists=False))
@click.argument("operations", nargs=-1, required=True)
@click.option(
"verbosity",
"-v",
Expand Down
19 changes: 19 additions & 0 deletions tests/test_cli/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json
import os
from os import path
import tempfile
from unittest import TestCase

from pyinfra.api import Host, Inventory
Expand Down Expand Up @@ -152,6 +154,23 @@ def test_exec_command_with_debug_facts(self):
)
assert result.exit_code == 0, result.stderr

def test_exec_command_does_not_validate_local_path_arguments(self):
with tempfile.NamedTemporaryFile() as file:
os.chmod(file.name, 0o000)
try:
result = run_cli(
path.join("tests", "test_cli", "deploy", "inventories", "inventory.py"),
"exec",
"--debug-operations",
"--",
"ls",
file.name,
)
finally:
os.chmod(file.name, 0o600)

assert result.exit_code == 0, result.stderr


class TestJsonOutput(PatchSSHTestCase):
inventory = path.join("tests", "test_cli", "deploy", "inventories", "inventory.py")
Expand Down
Loading