yum install local rpm throws error if up to date
Solution 1:
on my system (centos6, centos7) "yum localinstall" will return code 0 even with "Error: Nothing to do" message, while "yum install" returns 1.
sudo yum localinstall packages/* -y --disablerepo=*
Anyway you can also check the message result to ignore this as a "normal error" in your automation scripts, like for example using bash:
sudo yum install packages/* -y --disablerepo=* 2>&1 | tee /tmp/yum.output
grep -q "Error: Nothing to do" /tmp/yum.output
if [ $? -eq 0 ]; then
... code for no error
else
... code for error
fi