# Path: luna/config.py



from luna.config import db_name
import logging
import pymongo
import ConfigParser
import urllib
import sys
import os
import errno
import subprocess
import ssl

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/>.

'''



def set_mac_node(mac, node, mongo_db=None):
    logging.basicConfig(level=logging.INFO)
#    logging.basicConfig(level=logging.DEBUG)
    logger = logging.getLogger(__name__)
    if not mongo_db:
        try:
            mongo_client = pymongo.MongoClient(**get_con_options())
        except:
            err_msg = "Unable to connect to MongoDB."
            logger.error(err_msg)
            raise RuntimeError, err_msg
        logger.debug("Connection to MongoDB was successful.")

# Path: luna/config.py



# Path: luna/utils/helpers.py
from luna.config import db_name
import logging
import pymongo
import ConfigParser
import urllib
import sys
import os
import errno
import subprocess
import ssl


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/>.

'''



def set_mac_node(mac, node, mongo_db=None):
    logging.basicConfig(level=logging.INFO)
#    logging.basicConfig(level=logging.DEBUG)
    logger = logging.getLogger(__name__)
    if not mongo_db:
        try:
            mongo_client = pymongo.MongoClient(**get_con_options())
        except:
            err_msg = "Unable to connect to MongoDB."
            logger.error(err_msg)
            raise RuntimeError, err_msg
        logger.debug("Connection to MongoDB was successful.")

        mongo_db = mongo_client[db_name]