The logic in https://github.com/parthaa/katello/commit/626aff8e2b5e45214d16899e05d6fad761c610a9#L1R64 will handle that.