예제 #1
0
def create_bar():
    with sudo(user='******'), cd('/srv/'):
        if exists('/tmp/foo'):
            mkdir('/tmp/foo/bar')
        else:
            print('/tmp/foo does not exist')
            ls('tamer')
예제 #2
0
def configure_mod_tile():
    with sudo(user='******'):
        mkdir('/srv/tilery/tmp/tiles')
        mkdir('/srv/tilery/renderd')
    with sudo(), cd('/etc/apache2/'):
        put('remote/tile.load', 'mods-available/tile.load')
        put('remote/tile.conf', 'mods-available/tile.conf')
        put('remote/apache.conf', 'sites-enabled/000-default.conf')
        put('remote/ports.conf', 'ports.conf')
        run('a2enmod tile')
예제 #3
0
def configure_munin():
    psql_plugins = [
        'postgres_autovacuum', 'postgres_bgwriter', 'postgres_checkpoints',
        'postgres_connections_db', 'postgres_users', 'postgres_xlog',
        'nginx_status', 'nginx_request']
    with sudo(), cd('/etc/munin'):
        put('remote/munin.conf', 'munin.conf')
        for plugin in Path('remote/munin').glob('*'):
            put(plugin, f'plugins/{plugin.name}')
            run(f'chmod +x plugins/{plugin.name}')
        for name in psql_plugins:
            run(f'ln --symbolic --force /usr/share/munin/plugins/{name} '
                f'plugins/{name}')
        run('ln --symbolic --force /usr/share/munin/plugins/postgres_size_ '
            'plugins/postgres_size_tilery')
    restart(services='munin-node')
예제 #4
0
def test_cd():
    with cd('/tmp'):
        res = run('pwd')
    assert res.stdout == '/tmp\r\n'
예제 #5
0
def test_get_with_cd(remotefile):
    with cd('/tmp'):
        data = BytesIO()
        get('usinetestget', data)
        assert data.read().decode() == 'foobarééœ'
예제 #6
0
def test_put_with_cd(connection):
    remote = 'usinetestput'
    with cd('/tmp'):
        put(str(Path(__file__).parent / 'test.txt'), remote)
        assert run(f'cat {remote}').stdout == 'foobarώ\r\n'
        run(f'rm {remote}')