Skip to content

server.TmpDir fact is buggy and breaks things #1458

@teshanshanuka

Description

@teshanshanuka

Describe the bug

host.get_fact(TmpDir) simply returns empty on most environments. server.script operation fails due to this.

To Reproduce

  • Operation code & usage

    # testtmpdir.py
    from pyinfra.context import host
    from pyinfra.facts.server import TmpDir
    
    print(host.get_fact(TmpDir))

    Run with pyinfra @local testtmpdir.py

  • Target system information

Tested on two computers

  1. Linux xxx 6.16.8-arch2-1 #1 SMP PREEMPT_DYNAMIC ... x86_64 GNU/Linux
  2. Linux xxx 6.8.0-79-generic #79~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC ... x86_64 x86_64 x86_64 GNU/Linux
  • Example using the @docker connector (helps isolate the problem)

    pyinfra @docker/ubuntu:22.04 testtmpdir.py

Expected behavior

I expect it to return /tmp from the fact, from what I understand from the docs

Meta

N/A

The bug is simply due to the TEMPDIR env variable not existing on most systems it seems.

https://github.com/pyinfra-dev/pyinfra/blob/3.x/src/pyinfra/facts/server.py#L60

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions