Validate/update a SHA given for the rpc-openstack repo.

def validate_rpc_sha(repo_dir, commit):
    """Validate/update a SHA given for the rpc-openstack repo."""

    # Is the commit valid? Just in case the commit is a
    # PR ref, we try both the ref given and the ref prepended
    # with the remote 'origin'.
    try:
        osa_differ.validate_commits(repo_dir, [commit])
    except exceptions.InvalidCommitException:
        log.debug("The reference {c} cannot be found. Prepending "
                  "origin remote and retrying.".format(c=commit))
        commit = 'origin/' + commit
        osa_differ.validate_commits(repo_dir, [commit])

    return commit