Pyinfra stuck when running aws cli commands

44 views Asked by At

I am cleaning up AWS s3 bucket files using pyinfra. But when i execute aws cli command in pyinfra it stuck ,it shows no response even if i give maximum verbosity -vvv

def remove_s3():
    s3_buckets = ["local-test-eks","qa-data-ingestion","qa-delta-lake"]
    for bucket in s3_buckets:
        result = server.shell(
            name='Remove aws s3 bucket',
            commands=[f'aws s3 ls s3://{bucket}/ --recursive --profile default']
            # commands = ["aws --version"]
        )

        logger.info(f"Got result: {result.stdout}")

python.call(
    name="Execute callback function",
    function=remove_s3,
)

When i run the pyinfra inventory.py deploy.py at aws remove s3 bucket operation , it stuck forever. It shows no output or error. So i have no clue.

When i execute aws --version , it shows the version . I also tried running some other shell commands like ls -lart ,that displays the result.

I am not sure why it stuck. Can some one please help?

When i run the aws cli command directly from the target node it deletes the file . but not sure why when execute via pyinfra it stuck

0

There are 0 answers