Here you are overriding the result var, is that what you want?

Maybe the call to puppet agent -t is not necessary here because you are not using the result from it anywhere.