def install(fpm=False): server_version = server.version() apache_was_installed = package.is_installed('apache2.2-bin') packages = [ 'php5-suhosin', 'php5-mysql', 'php5-memcache', 'php5-memcached', 'php5-mcrypt', 'php5-json', 'php5-cli', 'php-apc', 'php5-dev', 'php5-curl', 'php-pear', 'php5-gd' ] if fpm: packages.append('php5-fpm') # Add the ppa for old ubuntu versions if fpm and server_version == '10.04': package.install_ppa('brianmercer/php') package.install(packages) # Some old php packages requires apache2 which we cannot remove # but we can stop it and remove it from to boot process if server_version != '11.10' and not apache_was_installed: sudo('update-rc.d -f apache2 remove') service.stop('apache2') if fpm: sudo('sudo update-rc.d -f php5-fpm defaults') service.restart('php5-fpm')
def install(): already_installed = package.is_installed('nginx') if server.version == '10.04': package.install_ppa('nginx/stable') package.install('nginx') if not already_installed: site_disable('default') www_dir = '/var/www' www_owner = 'www-data' if not dir.exists(www_dir): with ctx.sudo(): dir.create(www_dir) dir.attributes(www_dir, owner=www_owner, group=www_owner) restart()
def test_is_not_installed_without_status(run): (run.expects_call().with_args("dpkg -s foo").returns("foo installed")) assert not package.is_installed("foo")
def test_is_installed(run): (run.expects_call().with_args("dpkg -s foo").returns( "Status: foo installed")) assert package.is_installed("foo")
def test_is_not_installed_without_status(run): (run.expects_call() .with_args("dpkg -s foo") .returns("foo installed")) assert not package.is_installed("foo")
def test_is_installed(run): (run.expects_call() .with_args("dpkg -s foo") .returns("Status: foo installed")) assert package.is_installed("foo")