def _layout(self): current_user = core.run("echo $USER").stdout for type, path in self.folders.iteritems(): if not dir.exists(path): if type != "current": dir.create(path, recursive=True) else: with ctx.sudo(): dir.attributes(path, owner=current_user, recursive=True)
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()