def save_sandbox_db(sandbox_db, configuration=None): """Read in the sandbox DB dictionary: Format is {username: (password, [list_of_resources])} """ if not configuration: configuration = get_configuration_object() sandbox_db_path = os.path.join(configuration.sandbox_home, sandbox_db_name) dump(sandbox_db, sandbox_db_path)
def get_resource_name(sandboxkey, logger): configuration = get_configuration_object() # Retrieve resource_name from sandboxkey symbolic link sandbox_link = configuration.sandbox_home + sandboxkey if os.path.exists(sandbox_link): unique_resource_name = \ os.path.basename(os.path.realpath(sandbox_link)) return (True, unique_resource_name) else: msg = 'Remote IP: %s, No sandbox with sandboxkey: %s'\ % (os.getenv('REMOTE_ADDR'), sandboxkey) logger.error(msg) return (False, msg)