# Path: revolver/core.py
# def sudo(*args, **kwargs):
#     if env.sudo_user:
#         kwargs['user'] = env.sudo_user
# 
#     return _sudo(*args, **kwargs)
# 
# Path: revolver/command.py

# 
# Path: revolver/package.py
# def is_installed(name):
# def install_ppa(name):
# 
# Path: revolver/file.py
# def temp(mode=None, owner=None, group=None):
# def remove(location, recursive=False, force=True):
# def touch(location, mode=None, owner=None, group=None):
# def copy(source, destination, force=True, mode=None, owner=None, group=None):
# 
# Path: revolver/service.py
# def add_upstart(name, content):
# def command(name, command):
# def start(name):
# def stop(name):
# def restart(name):
# def reload(name):
# def is_running(name):
# 
# Path: revolver/contextmanager.py
# def sudo(username=None, login=False):
# def unpatched_state():
# 
# Path: revolver/directory.py
# def temp_local():
# def temp(mode=None, owner=None, group=None):
# def remove(location, recursive=False, force=True):
# def create(path, recursive=False, mode=None, owner=None, group=None):


import random
import string
from revolver.core import sudo
from revolver import command, package, file, service
from revolver import contextmanager as ctx
from revolver import directory as dir
# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, with_statement




def _preseed_server(root_password):
    seed_config = """# Mysql preseed generated by revolver
mysql-server mysql-server/root_password password %(root_password)s
mysql-server mysql-server/root_password_again password %(root_password)s
mysql-server mysql-server/start_on_boot boolean true
""" % {"root_password": root_password}
    seed_dir = "/var/cache/local/preseeding/"
    seed_file = seed_dir + "mysql-server.seed"

    if file.exists(seed_file):
        return

    with ctx.sudo():

# Path: revolver/core.py
# def sudo(*args, **kwargs):
#     if env.sudo_user:
#         kwargs['user'] = env.sudo_user
# 
#     return _sudo(*args, **kwargs)
# 
# Path: revolver/command.py

# 
# Path: revolver/package.py
# def is_installed(name):
# def install_ppa(name):
# 
# Path: revolver/file.py
# def temp(mode=None, owner=None, group=None):
# def remove(location, recursive=False, force=True):
# def touch(location, mode=None, owner=None, group=None):
# def copy(source, destination, force=True, mode=None, owner=None, group=None):
# 
# Path: revolver/service.py
# def add_upstart(name, content):
# def command(name, command):
# def start(name):
# def stop(name):
# def restart(name):
# def reload(name):
# def is_running(name):
# 
# Path: revolver/contextmanager.py
# def sudo(username=None, login=False):
# def unpatched_state():
# 
# Path: revolver/directory.py
# def temp_local():
# def temp(mode=None, owner=None, group=None):
# def remove(location, recursive=False, force=True):
# def create(path, recursive=False, mode=None, owner=None, group=None):


# Path: revolver/tool/mysql.py
import random
import string
from revolver.core import sudo
from revolver import command, package, file, service
from revolver import contextmanager as ctx
from revolver import directory as dir

# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, with_statement




def _preseed_server(root_password):
    seed_config = """# Mysql preseed generated by revolver
mysql-server mysql-server/root_password password %(root_password)s
mysql-server mysql-server/root_password_again password %(root_password)s
mysql-server mysql-server/start_on_boot boolean true
""" % {"root_password": root_password}
    seed_dir = "/var/cache/local/preseeding/"
    seed_file = seed_dir + "mysql-server.seed"

    if file.exists(seed_file):
        return

    with ctx.sudo():

        dir.create(seed_dir, recursive=True)