Пример #1
0
Файл: lin.py Проект: wil/woven
def test_lin_port_is_open():
    with settings(host_string='[email protected]:22', user='******',password=env.ROOT_PASSWORD):
        result = port_is_open()
        assert result
        
        sudo("echo 'Debian vers \n \l'> /etc/issue.new")
        sudo('cp -f /etc/issue /tmp/issue.bak')
        sudo('mv -f /etc/issue.new /etc/issue')
        
        result = port_is_open()
        
        sudo ('cp -f /tmp/issue.bak /etc/issue')
Пример #2
0
def test_lin_port_is_open():
    with settings(host_string='[email protected]:22',
                  user='******',
                  password=env.ROOT_PASSWORD):
        result = port_is_open()
        assert result

        sudo("echo 'Debian vers \n \l'> /etc/issue.new")
        sudo('cp -f /etc/issue /tmp/issue.bak')
        sudo('mv -f /etc/issue.new /etc/issue')

        result = port_is_open()

        sudo('cp -f /tmp/issue.bak /etc/issue')
Пример #3
0
def setupnode(overwrite=False):
    """
    Install a baseline host. Can be run multiple times

    """
    if not port_is_open():
        if not skip_disable_root():
            disable_root()
        port_changed = change_ssh_port()
    #avoid trying to take shortcuts if setupnode did not finish
    #on previous execution
    if server_state('setupnode-incomplete'):
        env.overwrite = True
    else:
        set_server_state('setupnode-incomplete')
    upload_ssh_key()
    restrict_ssh()
    add_repositories()
    upgrade_packages()
    setup_ufw()
    uninstall_packages()
    install_packages()

    upload_etc()
    post_install_package()
    setup_ufw_rules()
    set_timezone()
    set_server_state('setupnode-incomplete', delete=True)
    #stop and start webservers - and reload nginx
    for s in webserver_list():
        stop_webserver(s)
        start_webserver(s)
Пример #4
0
def setupnode(overwrite=False):
    """
    Install a baseline host. Can be run multiple times

    """
    if not port_is_open():
        if not skip_disable_root():
            disable_root()
        port_changed = change_ssh_port()
    #avoid trying to take shortcuts if setupnode did not finish
    #on previous execution
    if server_state('setupnode-incomplete'):
        env.overwrite = True
    else:
        set_server_state('setupnode-incomplete')
    upload_ssh_key()
    restrict_ssh()
    add_repositories()
    upgrade_packages()
    setup_ufw()
    uninstall_packages()
    install_packages()

    upload_etc()
    post_install_package()
    setup_ufw_rules()
    set_timezone()
    set_server_state('setupnode-incomplete', delete=True)
    #stop and start webservers - and reload nginx
    for s in webserver_list():
        stop_webserver(s)
        start_webserver(s)