# Path: luna/utils/helpers.py
# def get_con_options():
#     con_options = {'host': 'mongodb://'}
#     conf_defaults = {'server': 'localhost', 'replicaset': None,
#                     'authdb': None, 'user': None, 'password': None,
#                     'SSL': None, 'CAcert': None}
#     conf = ConfigParser.ConfigParser(conf_defaults)
# 
#     if not conf.read("/etc/luna.conf"):
#         return {'host': conf_defaults['server']}
# 
#     replicaset = conf.get("MongoDB", "replicaset")
#     server = conf.get("MongoDB", "server")
#     authdb = conf.get("MongoDB", "authdb")
#     user = conf.get("MongoDB", "user")
#     password = urllib.quote_plus(conf.get("MongoDB", "password"))
#     need_ssl = conf.get("MongoDB", "SSL")
#     ca_cert = conf.get("MongoDB", "CAcert")
# 
#     if user and password:
#         con_options['host'] += user + ':' + password + '@'
# 
#     con_options['host'] += server
# 
#     if authdb:
#         con_options['host'] += '/' + authdb
# 
#     if replicaset:
#         con_options['replicaSet'] = replicaset
# 
#     if need_ssl in ['Enabled', 'enabled']:
#         con_options['ssl'] = True
#         if ca_cert:
#             con_options['ssl_ca_certs'] = ca_cert
#             con_options['ssl_cert_reqs'] = ssl.CERT_REQUIRED
#         else:
#             con_options['ssl_cert_reqs'] = ssl.CERT_NONE
# 
#     return con_options
# 
# Path: luna/config.py



import logging
import pymongo
import uuid
from luna.utils.helpers import get_con_options
from luna.config import db_name
    from luna import Group
    from luna import Cluster
#!/usr/bin/env python
'''
Written by Dmitry Chirikov <dmitry@chirikov.ru>
This file is part of Luna, cluster provisioning tool
https://github.com/dchirikov/luna

This file is part of Luna.

Luna is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Luna is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Luna.  If not, see <http://www.gnu.org/licenses/>.

'''


log = logging.getLogger(__file__)
log.info('Luna migration script to db v1.2')

try:

# Path: luna/utils/helpers.py
# def get_con_options():
#     con_options = {'host': 'mongodb://'}
#     conf_defaults = {'server': 'localhost', 'replicaset': None,
#                     'authdb': None, 'user': None, 'password': None,
#                     'SSL': None, 'CAcert': None}
#     conf = ConfigParser.ConfigParser(conf_defaults)
# 
#     if not conf.read("/etc/luna.conf"):
#         return {'host': conf_defaults['server']}
# 
#     replicaset = conf.get("MongoDB", "replicaset")
#     server = conf.get("MongoDB", "server")
#     authdb = conf.get("MongoDB", "authdb")
#     user = conf.get("MongoDB", "user")
#     password = urllib.quote_plus(conf.get("MongoDB", "password"))
#     need_ssl = conf.get("MongoDB", "SSL")
#     ca_cert = conf.get("MongoDB", "CAcert")
# 
#     if user and password:
#         con_options['host'] += user + ':' + password + '@'
# 
#     con_options['host'] += server
# 
#     if authdb:
#         con_options['host'] += '/' + authdb
# 
#     if replicaset:
#         con_options['replicaSet'] = replicaset
# 
#     if need_ssl in ['Enabled', 'enabled']:
#         con_options['ssl'] = True
#         if ca_cert:
#             con_options['ssl_ca_certs'] = ca_cert
#             con_options['ssl_cert_reqs'] = ssl.CERT_REQUIRED
#         else:
#             con_options['ssl_cert_reqs'] = ssl.CERT_NONE
# 
#     return con_options
# 
# Path: luna/config.py



# Path: contrib/dbmigrate-000-v1.2.py
import logging
import pymongo
import uuid
from luna.utils.helpers import get_con_options
from luna.config import db_name
    from luna import Group
    from luna import Cluster

#!/usr/bin/env python
'''
Written by Dmitry Chirikov <dmitry@chirikov.ru>
This file is part of Luna, cluster provisioning tool
https://github.com/dchirikov/luna

This file is part of Luna.

Luna is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Luna is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Luna.  If not, see <http://www.gnu.org/licenses/>.

'''


log = logging.getLogger(__file__)
log.info('Luna migration script to db v1.2')

try:

    mclient = pymongo.MongoClient(**get_con_options())