Ejemplo n.º 1
0
def test_temporary_directory_as_function():

    from fabtools.files import is_dir
    from fabtools.require.files import temporary_directory

    path1 = temporary_directory()
    path2 = temporary_directory()

    assert is_dir(path1)
    assert is_dir(path2)
    assert path1 != path2

    run('rmdir %s' % quote(path1))
    run('rmdir %s' % quote(path2))
Ejemplo n.º 2
0
def test_temporary_directory_as_function():

    from fabtools.files import is_dir
    from fabtools.require.files import temporary_directory

    path1 = temporary_directory()
    path2 = temporary_directory()

    assert is_dir(path1)
    assert is_dir(path2)
    assert path1 != path2

    run('rmdir %s' % quote(path1))
    run('rmdir %s' % quote(path2))
Ejemplo n.º 3
0
def temporary_directories():
    """
    Check temporary directories
    """
    from fabtools.files import is_dir
    from fabtools.require.files import temporary_directory

    path1 = temporary_directory()
    path2 = temporary_directory()

    assert is_dir(path1)
    assert is_dir(path2)
    assert path1 != path2

    run('rmdir %s' % quote(path1))
    run('rmdir %s' % quote(path2))
Ejemplo n.º 4
0
def temporary_directories():
    """
    Check temporary directories
    """
    from fabtools.files import is_dir
    from fabtools.require.files import temporary_directory

    path1 = temporary_directory()
    path2 = temporary_directory()

    assert is_dir(path1)
    assert is_dir(path2)
    assert path1 != path2

    run('rmdir %s' % quote(path1))
    run('rmdir %s' % quote(path2))
Ejemplo n.º 5
0
def test_temporary_directory_as_context_manager():

    from fabtools.files import is_dir
    from fabtools.require.files import temporary_directory

    with temporary_directory() as path:
        assert is_dir(path)

        with cd(path):
            run('touch foo')

    assert not is_dir(path)
Ejemplo n.º 6
0
def test_temporary_directory_as_context_manager():

    from fabtools.files import is_dir
    from fabtools.require.files import temporary_directory

    with temporary_directory() as path:
        assert is_dir(path)

        with cd(path):
            run('touch foo')

    assert not is_dir(path)
Ejemplo n.º 7
0
def temporary_directory_as_context_manager():
    """
    Check temporary directory used as a context manager
    """
    from fabtools.files import is_dir
    from fabtools.require.files import temporary_directory

    with temporary_directory() as path:
        assert is_dir(path)

        with cd(path):
            run('touch foo')

    assert not is_dir(path)
Ejemplo n.º 8
0
def temporary_directory_as_context_manager():
    """
    Check temporary directory used as a context manager
    """
    from fabtools.files import is_dir
    from fabtools.require.files import temporary_directory

    with temporary_directory() as path:
        assert is_dir(path)

        with cd(path):
            run('touch foo')

    assert not is_dir(path)
Ejemplo n.º 9
0
def _install_packages(package_filter):

    # if we don't want to use a repository but just dpkg --install packages
    if env.manual_package_deploy:
        #it is not optimal, each package will be potentially copied several times, we'll have to improve that
        with temporary_directory() as tmp_dir:
            for package in package_filter:
                put(package, tmp_dir)
            with cd(tmp_dir):
                with warn_only():#@TODO: catch only on error
                    sudo('dpkg --install {}'.format(' '.join(package_filter)))
                #Install dependencies
                sudo('apt-get -f --yes install')
    # else suppose that the machine is configured to use a remote repository
    else:
        # don't want filename package, just the name
        # --quiet to pretty print progress in fabric
        sudo('apt-get -f --quiet update && apt-get --yes install {}'
        .format(' '.join(package_filter).replace('*deb', '')))
Ejemplo n.º 10
0
def _install_packages(package_filter):

    # if we don't want to use a repository but just dpkg --install packages
    if env.manual_package_deploy:
        #it is not optimal, each package will be potentially copied several times, we'll have to improve that
        with temporary_directory() as tmp_dir:
            for package in package_filter:
                put(package, tmp_dir)
            with cd(tmp_dir):
                with warn_only():  #@TODO: catch only on error
                    sudo('dpkg --install {}'.format(' '.join(package_filter)))
                #Install dependencies
                sudo('apt-get -f --yes install')
    # else suppose that the machine is configured to use a remote repository
    else:
        # don't want filename package, just the name
        # --quiet to pretty print progress in fabric
        sudo('apt-get -f --quiet update && apt-get --yes install {}'.format(
            ' '.join(package_filter).replace('*deb', '')))