Skip to content

Instantly share code, notes, and snippets.

@hub-cap
Last active December 20, 2015 11:29
Show Gist options
  • Select an option

  • Save hub-cap/6123644 to your computer and use it in GitHub Desktop.

Select an option

Save hub-cap/6123644 to your computer and use it in GitHub Desktop.
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import jinja2
ENV = jinja2.Environment(loader=jinja2.ChoiceLoader([
jinja2.FileSystemLoader("/etc/trove/templates"),
jinja2.PackageLoader("trove", "templates")
]))
class SingleInstanceConfigTemplate(object):
_location_types = {'mysql': '/etc/mysql/my.cnf',
'percona': '/etc/mysql/my.cnf'}
def __init__(self, location_type, flavor_dict):
self.config_location = self._location_types[location_type]
self.flavor_dict = flavor_dict
self.template = ENV.get_template("mysql.config.template")
def render(self):
self.config_contents = self.template.render(
flavor=self.flavor_dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment