Noooo! This is totally the wrong place to do this.

Can't you install the gem as a puppet resource, before log-agent gets installed?