Пример #1
0
    def __init__(self, db_file='/mnt/data/mvm.db'):
        self.conn   = sqlite3.connect(db_file)
        self.conn.row_factory = sqlite3.Row
        self.cur    = self.conn.cursor()

        self.structures     = {}
        self.structures['deployment']   = {
            'id':                   'integer primary key',
            'key':                  'text',
            'name':                 'text',
            'domain':               'text',
            'user_email':           'text',
            'timestamp_created':    'real',
            'timestamp_updated':    'real',
            'requested_time_hours': 'integer',
            'auto_tear_down':       'integer'
        }
        self.structures['server']       = {
            'id':                   'integer primary key',
            'deployment_id':        'integer',
            'server_nickname':      'text',
            'server_type':          'text',
            'state':                'text',
            'timestamp_created':    'real',
            'timestamp_updated':    'real'
        }

        logger                  = LogWrapper('/var/log/rightscale_api', self.__class__.__name__)
        self.logger             = logger.get_logger()
Пример #2
0
    def __init__(self):
        base_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/..')
        
        self.template_dir           = '/'.join([base_path, 'data', 'bind_templates'])
        self.config_out_dir         = '/'.join([base_path, 'data', 'bind_configs_out'])

        self.zone_destination_dir   = '/var/named/dynamic'
        self.conf_destination_dir   = '/etc/named'

        self.zone_template_filename = 'zone.template'
        self.conf_template_filename = 'conf.template'

        self.tokens         = {
            'domain_name':          '{{DOMAIN_NAME}}',
            'serial':               '{{SERIAL}}',
            'lb_ip':                '{{LB_IP}}',
            'bind_ip':              '{{BIND_IP}}',
            'zone_destination_dir': '{{ZONE_DESTINATION_DIR}}'
        }

        logger                  = LogWrapper('/var/log/rightscale_api', self.__class__.__name__)
        self.logger             = logger.get_logger()