Create a desktop alias for an SMB mount on Mac OS X

So to create an alias to an SMB share on your Mac desktop:

First use Finder -> Go -> Connect to Server…

Enter a location such as: smb://server/share

Then use Finder -> Preferences… -> Show: Connected servers

The SMB mount should now be visible on the desktop. Right-click the share on the desktop and choose ‘Make Alias’. Then take connected servers out of your Finder preferences and rename the desktop alias probably as the name of the share.

Debugging JINJA in Salt Stack

So I was trying to figure out how to report the template source file within the template itself and I found myself wanting to know what was available in the JINJA globals for a Salt Stack JINJA template.

Turns out you use the show_full_context() function, like this:

Context is: {{ show_full_context() }}

You can parse the output to see what top-level items are available. In my case I found the ‘source’ setting for the JINJA template in use.

Hot tip: if you’re using Vim to inspect the show_full_context() output, try using ‘%’ or ‘]}’ to move between matching braces.

Bonus: while I was learning about reporting the JINJA context I discovered that you can call Salt functions from JINJA templates, like this:

# The following two function calls are equivalent.
{{ salt['']('whoami') }}
{{'whoami') }}

If Apache2 won’t serve your JavaScript file try…

I had an issue with Apache2 improperly serving a JavaScript file which I seem to have fixed by making sure the file was terminated with a new-line character… this was really hard to diagnose and resolve! The behaviour in Firefox was that the file just didn’t finish to download, whereas the Apache2 logs indicated a 200 result… I think it may have had something to do with automatic compression, which is a dark art that I do not understand (mumbles something about mod deflate…).