1149894 - Adds a get_parent_directory that gets it right with a trailing slash

This change is the platform portion of the bugfix for 1149894. Another PR in pulp_puppet uses this new function.

https://bugzilla.redhat.com/show_bug.cgi?id=1149894