question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

server.script fails on pyinfra-1.0.3+ with error /tmp exists and is not a directory on macOS target host

See original GitHub issue

Describe the bug After upgrading to pyinfra 1.0.3 server.script operation when running on macOS target host (tested on Catalina 10.15.6). This works correctly on pyinfra 1.0.2. I have tested with version 1.0.4 and it fails there as well.

The operation I run is:

server.script(
    name = 'Init .zshrc'
    ,src = 'scripts/create_zsh_profile.sh'
    ,shell_executable = host.data.zsh
)

It is never executed as it seems copying the script to a temporary location is failing, as per the “/tmp exists and is not a directory” error.

I am guessing perhaps it might have to do with the tmp directory in macOS (in Catalina, at least) is a symlink: image

Output


--> Preparing operations...    
    Loading: virtual_machine.py
    [pyinfra\api\operation] Adding operation, {'Init .zshrc'}, called @ virtual_machine.py:10, opLines=(0, 10), opHash=3b2f90227d43a40a2288506c2a99bdc5e71f32b2
    [pyinfra\api\facts] Getting fact: file (ensure_hosts: (mac-host,))
    [pyinfra\api\connectors\ssh] Running command on mac-host: (pty=False) sh -c 'stat /tmp/pyinfra-920aba211406e528eae3a2dfba47ad37f97d005d 1> /dev/null 2> /dev/null && (stat -c '"'"'user=%U group=%G mode=%A atime=%X mtime=%Y ctime=%Z size=%s %N'"'"' /tmp/pyinfra-920aba211406e528eae3a2dfba47ad37f97d005d 2> /dev/null || stat -f '"'"'user=%Su group=%Sg mode=%Sp atime=%a 
mtime=%m ctime=%c size=%z %N%SY'"'"' /tmp/pyinfra-920aba211406e528eae3a2dfba47ad37f97d005d) || true'
[mac-host] >>> sh -c 'stat /tmp/pyinfra-920aba211406e528eae3a2dfba47ad37f97d005d 1> /dev/null 2> /dev/null && (stat -c '"'"'user=%U group=%G mode=%A atime=%X mtime=%Y ctime=%Z size=%s %N'"'"' /tmp/pyinfra-920aba211406e528eae3a2dfba47ad37f97d005d 2> /dev/null || stat -f '"'"'user=%Su group=%Sg mode=%Sp atime=%a mtime=%m ctime=%c size=%z %N%SY'"'"' /tmp/pyinfra-920aba211406e528eae3a2dfba47ad37f97d005d) || true'
    [pyinfra\api\connectors\ssh] Waiting for exit status...37f97d005d - {mac-host}
    [pyinfra\api\connectors\ssh] Command exit status: 0
    Loaded fact file: ('/tmp/pyinfra-920aba211406e528eae3a2dfba47ad37f97d005d',)
    [pyinfra\api\facts] Getting fact: directory (ensure_hosts: (mac-host,))
    [pyinfra\api\connectors\ssh] Running command on mac-host: (pty=False) sh -c 'stat /tmp 1> /dev/null 2> /dev/null && (stat -c '"'"'user=%U group=%G mode=%A atime=%X mtime=%Y ctime=%Z 
size=%s %N'"'"' /tmp 2> /dev/null || stat -f '"'"'user=%Su group=%Sg mode=%Sp atime=%a mtime=%m ctime=%c size=%z %N%SY'"'"' /tmp) || true'
[mac-host] >>> sh -c 'stat /tmp 1> /dev/null 2> /dev/null && (stat -c '"'"'user=%U group=%G mode=%A atime=%X mtime=%Y ctime=%Z size=%s %N'"'"' /tmp 2> /dev/null || stat -f '"'"'user=%Su 
group=%Sg mode=%Sp atime=%a mtime=%m ctime=%c size=%z %N%SY'"'"' /tmp) || true'
[mac-host] user=root group=admin mode=lrwxr-xr-x atime=1594663936 mtime=1594663936 ctime=1594663981 size=11 /tmp -> private/tmp
    [pyinfra\api\connectors\ssh] Waiting for exit status...
    [pyinfra\api\connectors\ssh] Command exit status: 0
    Loaded fact directory: ('/tmp',)
/tmp exists and is not a directory
--> ←[0m[←[1mmac-host←[0m] ←[31m←[1mpyinfra error←[0m (operation=Init .zshrc):

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
harold-bcommented, Sep 1, 2020

Tested with v1.1 all green 😃

1reaction
harold-bcommented, Aug 21, 2020

Fantastic, thanks!

I will look for the 1.1 release and test locally as well once out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to write to /tmp directory in macOS ... - Super User
Disk Utility says the disk is healthy with no issues detected when running first aid. Is there any way to redirect the tmp...
Read more >
psql: could not connect to server: No such file or directory ...
So, it seems that my macbook freezing and being hard-rebooted caused Postgres to think that it's processes were still running even after reboot....
Read more >
PostInstall script not running on MacOS - Apple Developer
I have created a package installer for MacOS with "productbuild" command line ... under application folder but postinstall script does not for some...
Read more >
Fix Terminal “Operation not permitted” Error in macOS ...
The “Operation not permitted” message is one of a variety of command line errors you may encounter in Mac OS Terminal. Another frequently...
Read more >
macOS 12.0 Monterey Apache Setup: MySQL, Xdebug & More...
test virtual hosts, you may receive a warning such as Warning: DocumentRoot [/Users/your_user/Sites/grav-admin] does not exist when restarting ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found