The equilibrium behavior of vortices in the classical two-dimensional (2D) XY model with uncorrelated random phase shifts is investigated. The model describes Josephson-Junction arrays with positional disorder, and has ramifications in a number of other bond-disordered 2D systems. The vortex Hamiltonian is that of a Coulomb gas in a background of quenched random dipoles, which is capable of forming either a dielectric insulator or a plasma. We confirm a recent suggestion by Nattermann, Scheidl, Korshunov, and Li [J. Phys. I (France) 5, 565 (1995)], and by Cha and Fertig [Phys. Rev. Lett. 74, 4867 (1995)] that, when the variance σ of random phase shifts is smaller than a critical value σc, the system is in a phase with quasi-long-range order at low temperatures, without a reentrance transition. This conclusion is reached through a nearly exact calculation of the single-vortex free energy, and a Kosterlitz-type renormalization group analysis of screening and random polarization effects from vortex-antivortex pairs. The critical strength of disorder σc is found not to be universal, but generally lies in the range 0 < σc < π/8. Argument is presented to suggest that the system at σ > σc does not possess long-range glassy order at any finite temperature. In the ordered phase, vortex pairs undergo a series of spatial and angular localization processes as the temperature is lowered. This behavior, which is common to many glass-forming systems, can be quantified through approximate mappings to the random energy model and to the directed polymer on the Cayley tree. Various critical properties at the order-disorder transition are calculated.75.10. Nr, 64.60.Ak, 74.50.+r, 74.60.Ge