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)
def test_lin_disable_root(): #automate env.DISABLE_ROOT = True env.INTERACTIVE = False env.HOST_PASSWORD = '******' env.ROOT_PASSWORD = '******' #test with settings(host_string='[email protected]:22',user='******',password='******'): disable_root() assert exists('/home/woven')
def test_lin_disable_root(): #automate env.DISABLE_ROOT = True env.INTERACTIVE = False env.HOST_PASSWORD = '******' env.ROOT_PASSWORD = '******' #test with settings(host_string='[email protected]:22', user='******', password='******'): disable_root() assert exists('/home/woven')
def test_lin_disable_root(): local('rm -rf .woven') #automate env.DISABLE_ROOT = True env.INTERACTIVE = False env.HOST_PASSWORD = '******' env.ROOT_PASSWORD = '******' #test disable_root() with settings(host_string='[email protected]:22',user='******',password='******'): assert exists('/home/woven') #should skip the 2nd time disable_root() #cleanup - re-enable root teardown_disable_root()