Cleanup Hadoop filesystem path calculations

Create common function Magpie_calculate_hadoop_filesystem_paths