This could be replaced with a bit of XPath, e.g.
    aug.match("#{self.base_path}/directive[.='SetEnv' and arg[1]='#{resource[:name]}']")