def target_repository
      fail _("This is not a linked repository") if master?
      return nil if self.archived_instance.nil?

      #this is an environment repo, and the archived_instance is a master (not always true with composite)
      if self.environment_id? && self.archived_instance.master?
        self.archived_instance
      elsif self.environment_id #this is an environment repo, but a composite who's archived_instance isn't a master
        self.archived_instance.target_repository || self.archived_instance #to archived_instance if nil
      else #must be a composite archive repo, with only one component repo
        self.component_source_repositories.first
      end
    end
def target_repository
      fail _("This is not a linked repository") if master?
      return nil if self.archived_instance.nil?

      #this is an environment repo, and the archived_instance is a master (not always true with composite)
      if self.environment_id? && self.archived_instance.master?
        self.archived_instance
      elsif self.environment_id #this is an environment repo, but a composite who's archived_instance isn't a master
        self.archived_instance.target_repository || self.archived_instance #to archived_instance if nil
      else #must be a composite archive repo, with only one component repo
        self.component_source_repositories.first
      end
    end
A link (empty repo) points to a target (a repository that actually has units in pulp).  Target repos are always archive repos of a content view version (a repo with no environment)
 But for composite view versions, an archive repo, usually won't be a master (but might be if multple components contain the same repo)