def configure_webserver(self, name, config, delete_other_sites=False): if delete_other_sites: with cuisine_sudo(): clear_dir('/etc/apache2/sites-enabled') with cuisine_sudo(): cuisine.file_write('/etc/apache2/sites-enabled/%s' % name, config) print("Apache configured\n%s" % config)
def configure_webserver(self, name, config, delete_other_sites=False): if delete_other_sites: with cuisine_sudo(): clear_dir('/etc/apache2/sites-enabled') with cuisine_sudo(): cuisine.file_write('/etc/apache2/sites-enabled/%s' % name, config) run("ln -fs /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load") run("ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled/ssl.load") print("Apache configured\n%s" % config)
def reset_project_dir(self): home_dir = remote_home() site_path_basename = path(self.remote_site_path).name with cuisine_sudo(): cuisine.dir_ensure(self.remote_site_path, recursive=True, mode="777") cuisine.dir_ensure("%s/tmp" % home_dir, mode="777") dir_delete("%(home_dir)s/tmp/%(site_path_basename)s" % locals()) cuisine.run("mv %(site_dir)s %(home_dir)s/tmp" % {"site_dir": self.remote_site_path, "home_dir": home_dir}) clear_dir(self.remote_project_path) # restore site dir cuisine.run( "mv %(home_dir)s/tmp/%(site_dir_basename)s %(proj_path)s" % {"site_dir_basename": site_path_basename, "proj_path": self.remote_project_path, "home_dir": home_dir} )
def clear_remote_project_path_save_site(self): home_dir = remote_home() site_path_basename = path(self.remote_site_path).name with cuisine_sudo(): cuisine.dir_ensure(self.remote_site_path, recursive=True, mode='777') cuisine.dir_ensure("%s/tmp" % home_dir, mode='777') dir_delete("%(home_dir)s/tmp/%(site_path_basename)s" % locals()) cuisine.run('mv %(site_dir)s %(home_dir)s/tmp' % {'site_dir': self.remote_site_path, 'home_dir': home_dir}) clear_dir(self.remote_project_path) #restore site dir cuisine.run('mv %(home_dir)s/tmp/%(site_dir_basename)s %(proj_path)s' % { 'site_dir_basename': site_path_basename, 'proj_path': self.remote_project_path, 'home_dir': home_dir })