def test_plugin_circular_deps(self):
    'Test that plugins with circular dependencies fail'
    os.makedirs(os.path.join(self.tmpdir, 'foo-plugin', 'devstack'))
    os.makedirs(os.path.join(self.tmpdir, 'foo-plugin', '.git'))
    os.makedirs(os.path.join(self.tmpdir, 'bar-plugin', 'devstack'))
    os.makedirs(os.path.join(self.tmpdir, 'bar-plugin', '.git'))
    with open(os.path.join(self.tmpdir, 'foo-plugin', 'devstack', 'settings'), 'w') as f:
        f.write('define_plugin foo\n')
        f.write('plugin_requires foo bar\n')
    with open(os.path.join(self.tmpdir, 'bar-plugin', 'devstack', 'settings'), 'w') as f:
        f.write('define_plugin bar\n')
        f.write('plugin_requires bar foo\n')
    localrc = {'test_localrc': '1'}
    local_conf = {'install': {'nova.conf': {'main': {'test_conf': '2'}}}}
    services = {'cinder': True}
    plugins = OrderedDict([('bar', 'git://git.openstack.org/openstack/bar-plugin'), ('foo', 'git://git.openstack.org/openstack/foo-plugin')])
    p = dict(localrc=localrc, local_conf=local_conf, base_services=[], services=services, plugins=plugins, base_dir=self.tmpdir, path=os.path.join(self.tmpdir, 'test.local.conf'))
    with self.assertRaises(Exception):
        lc = LocalConf(p.get('localrc'), p.get('local_conf'), p.get('base_services'), p.get('services'), p.get('plugins'), p.get('base_dir'))
        lc.write(p['path'])
Test that plugins with circular dependencies fail
def test_plugin_circular_deps(self):
    
    os.makedirs(os.path.join(self.tmpdir, 'foo-plugin', 'devstack'))
    os.makedirs(os.path.join(self.tmpdir, 'foo-plugin', '.git'))
    os.makedirs(os.path.join(self.tmpdir, 'bar-plugin', 'devstack'))
    os.makedirs(os.path.join(self.tmpdir, 'bar-plugin', '.git'))
    with open(os.path.join(self.tmpdir, 'foo-plugin', 'devstack', 'settings'), 'w') as f:
        f.write('define_plugin foo\n')
        f.write('plugin_requires foo bar\n')
    with open(os.path.join(self.tmpdir, 'bar-plugin', 'devstack', 'settings'), 'w') as f:
        f.write('define_plugin bar\n')
        f.write('plugin_requires bar foo\n')
    localrc = {'test_localrc': '1'}
    local_conf = {'install': {'nova.conf': {'main': {'test_conf': '2'}}}}
    services = {'cinder': True}
    plugins = OrderedDict([('bar', 'git://git.openstack.org/openstack/bar-plugin'), ('foo', 'git://git.openstack.org/openstack/foo-plugin')])
    p = dict(localrc=localrc, local_conf=local_conf, base_services=[], services=services, plugins=plugins, base_dir=self.tmpdir, path=os.path.join(self.tmpdir, 'test.local.conf'))
    with self.assertRaises(Exception):
        lc = LocalConf(p.get('localrc'), p.get('local_conf'), p.get('base_services'), p.get('services'), p.get('plugins'), p.get('base_dir'))
        lc.write(p['path'])