logcollector: fix duplicated code between repositories and functions and
btw fix build under CentOS 7.