コード例 #1
0
 def test_mongodb_archive(self, plt, lsb):
     lsb.side_effect = [{'DISTRIB_CODENAME': 'xenial'}]
     self.assertEqual(type(mongodb.mongodb('archive')).__name__, 'MongoDB26')
     lsb.side_effect = [{'DISTRIB_CODENAME': 'trusty'}]
     self.assertEqual(type(mongodb.mongodb('archive')).__name__, 'MongoDB24')
     lsb.side_effect = [{'DISTRIB_CODENAME': 'nogo'}]
     self.assertRaises(Exception, mongodb.mongodb, 'archive')
コード例 #2
0
def install():
    cfg = config()
    if mongodb.installed():
        status_set('maintenance',
                   'uninstalling mongodb {}'.format(mongodb.version()))
        m = mongodb.mongodb(cfg.previous('version')).uninstall()
        remove_state('mongodb.installed')
        remove_state('mongodb.ready')

    m = mongodb.mongodb(cfg.get('version'))
    status_set('maintenance', 'installing mongodb')
    m.install()
    set_state('mongodb.installed')
コード例 #3
0
ファイル: mongodb.py プロジェクト: mskalka/layer-mongodb
def configure():
    c = config()
    m = mongodb.mongodb(c.get('version'))
    m.configure(c)
    service_restart('mongodb')

    if c.changed('port') and c.previous('port'):
        close_port(c.previous('port'))

    open_port(c.get('port'))
    set_state('mongodb.ready')
コード例 #4
0
    def test_version_search(self, mv, mi):
        mi.return_value = True

        mv.return_value = '2.4.9'
        self.assertEqual(type(mongodb.mongodb()).__name__, 'MongoDB24')

        mv.return_value = '2.6.10'
        self.assertEqual(type(mongodb.mongodb()).__name__, 'MongoDB26')

        mv.return_value = '2.6.10-ubuntu1'
        self.assertEqual(type(mongodb.mongodb()).__name__, 'MongoDB26')

        mv.return_value = '3.2.1'
        self.assertEqual(type(mongodb.mongodb()).__name__, 'MongoDB32')

        mv.return_value = '3.4.1'
        self.assertEqual(type(mongodb.mongodb()).__name__, 'MongoDB32')

        with patch('charms.layer.mongodb.warnings') as mw:
            mv.return_value = '1.0'
            self.assertIsNone(mongodb.mongodb())
コード例 #5
0
 def test_mongodb_zseries(self, plat, lsb):
     lsb.side_effect = [{'DISTRIB_RELEASE': '16.04'}]
     plat.machine.return_value = 's390x'
     self.assertEqual(
         type(mongodb.mongodb('archive')).__name__, 'MongoDBzSeries')
コード例 #6
0
def configure():
    m = mongodb.mongodb(config().get('version'))
    m.configure(config())
    service_restart('mongodb')
    set_state('mongodb.ready')
コード例 #7
0
 def test_mongodb_zseries(self, plat, lsb):
     lsb.side_effect = [{'DISTRIB_RELEASE': '16.04'}]
     plat.machine.return_value = 's390x'
     self.assertEqual(type(mongodb.mongodb('archive')).__name__,
                      'MongoDBzSeries')