def install():
    execd_preinstall()
    src = config('openstack-origin')
    if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and
            src == 'distro'):
        src = 'cloud:precise-folsom'
    configure_installation_source(src)
    apt_update(fatal=True)
    if valid_plugin():
        apt_install(filter_installed_packages(get_early_packages()),
                    fatal=True)
        apt_install(filter_installed_packages(get_packages()),
                    fatal=True)
    else:
        log('Please provide a valid plugin config', level=ERROR)
        sys.exit(1)
 def test_get_early_packages_empty(self):
     self.config.return_value = 'noop'
     self.assertEquals(quantum_utils.get_early_packages(),
                       [])
 def test_get_early_packages_ovs(self):
     self.config.return_value = 'ovs'
     self.assertEquals(
         quantum_utils.get_early_packages(),
         ['openvswitch-datapath-dkms', 'linux-headers-2.6.18'])