示例#1
0
 def create(self):
     with settings(**self.server.settings()):
         require = None
         if self.username is None or self.password is None:
             Utils.notice(
                 "Username or password missing, discarding password protection."
             )
         else:
             # Site will be password protected
             # Create password file
             self.htpasswd()
             require = "valid-user"
         context = {
             "name": self.name,
             "full_name": self.full_name,
             "aliases": self.aliases,
             "document_root": self.deployment.drupal_site.path,
             "auth_type": "Basic",
             "auth_name": "Authentication Required",
             "auth_user_file": self.htpasswd_path,
             "require": require
         }
         upload_template('vhost.conf',
                         self.domain_path,
                         context,
                         use_jinja=True,
                         template_dir=env.template_dir,
                         backup=False,
                         mode=0644)
         self.server.symlink(self.domain_path,
                             join('/etc/apache2/sites-available',
                                  self.full_name),
                             force=True,
                             sudo=True)
示例#2
0
 def create(self):
     with settings(**self.server.settings()):
         require = None
         if self.username is None or self.password is None:
             Utils.notice("Username or password missing, discarding password protection.")
         else:
             # Site will be password protected
             # Create password file
             self.htpasswd()
             require = "valid-user"
         context = {
             "name": self.name,
             "full_name": self.full_name,
             "aliases": self.aliases,
             "document_root": self.deployment.drupal_site.path,
             "auth_type": "Basic",
             "auth_name": "Authentication Required",
             "auth_user_file": self.htpasswd_path,
             "require": require
         }
         upload_template('vhost.conf', self.domain_path, context,
                         use_jinja=True,
                         template_dir=env.template_dir,
                         backup=False,
                         mode=0644)
         self.server.symlink(self.domain_path, join('/etc/apache2/sites-available', self.full_name), force=True, sudo=True)
示例#3
0
def project_list(archive=False):
    """
    List all projects on a server
    """
    try:
        with hide(*env.clean):
            Utils.notice("The server has the following projects")
            map(lambda notices: Utils.notice(notices, 4), Project.list(env.server, archive))
    except AgileProjectError, e:
        Utils.error("Could not list projects, ending")
示例#4
0
def project_list(archive=False):
    """
    List all projects on a server
    """
    try:
        with hide(*env.clean):
            Utils.notice("The server has the following projects")
            map(lambda notices: Utils.notice(notices, 4),
                Project.list(env.server, archive))
    except AgileProjectError, e:
        Utils.error("Could not list projects, ending")
示例#5
0
def deployment_list(project=None):
    """
    List all deployments for a project (optional) on a server
    """
    try:
        with hide(*env.clean):
            if project is None:
                env.project = Project(name, env.server)
            Utils.notice("The project {0} has the following deployments".format(env.project.name))
            map(lambda notices: Utils.notice(notices, 4), Deployment.list(env.project))
    except AgileProjectError, e:
        Utils.error("Could not list deployments, ending")
        raise
示例#6
0
def deployment_list(project=None):
    """
    List all deployments for a project (optional) on a server
    """
    try:
        with hide(*env.clean):
            if project is None:
                env.project = Project(name, env.server)
            Utils.notice(
                "The project {0} has the following deployments".format(
                    env.project.name))
            map(lambda notices: Utils.notice(notices, 4),
                Deployment.list(env.project))
    except AgileProjectError, e:
        Utils.error("Could not list deployments, ending")
        raise
示例#7
0
def drush_alias_create():
    """
    Create drush aliases for each deployment in each project
    """
    try:
        with hide(*env.clean):
            drupal_roots = DrupalRoot.list(env.project)

            Utils.notice("The project has the following Drupal roots")
            [Utils.notice(drupal_root, 4) for drupal_root in drupal_roots]

            Utils.notice("Creating Drush aliases")
            for drupal_root in drupal_roots:
                drush_alias = DrushAlias(drupal_root)
                DrushAlias.create(drush_alias)

    except AgileProjectError:
        Utils.error("Could not sync aliases")
        raise
示例#8
0
def drush_alias_create():
    """
    Create drush aliases for each deployment in each project
    """
    try:
        with hide(*env.clean):
            drupal_roots = DrupalRoot.list(env.project)

            Utils.notice("The project has the following Drupal roots")
            [Utils.notice(drupal_root, 4) for drupal_root in drupal_roots]

            Utils.notice("Creating Drush aliases")
            for drupal_root in drupal_roots:
                drush_alias = DrushAlias(drupal_root)
                DrushAlias.create(drush_alias)

    except AgileProjectError:
        Utils.error("Could not sync aliases")
        raise
示例#9
0
 def htpasswd(self):
     Utils.notice("Generating htpasswd file...")
     self.server.sudo_or_run("htpasswd -bc " + self.htpasswd_path
                     + " " + self.username
                     + " " + self.password)
示例#10
0
 def htpasswd(self):
     Utils.notice("Generating htpasswd file...")
     self.server.sudo_or_run("htpasswd -bc " + self.htpasswd_path + " " +
                             self.username + " " + self.password)
示例#11
0
from druploy.core import *
from druploy.utils import Utils
from druploy.config import Config
from druploy.exceptions import *
from druploy.server import *
from druploy.project import *
from druploy.deployment import *
from druploy.drupal import *
from druploy.code import *
from druploy.database import *
from druploy.files import *
from druploy.domain import *

# Initialization
try:
    Utils.notice("Run initialisation code.")
    env.use_ssh_config = True
    env.forward_agent = True
    env.local_path = os.path.dirname(os.path.realpath(__file__))
    env.template_dir = os.path.join(env.local_path, "templates")
    env.server = None
    env.project = None
    env.source_project = None
    env.source_deployment = None
    env.source_code = None
    env.source_files = None
    env.source_database = None
    env.deployment = None
    env.domain = None
    env.clean = ()
except AgileProjectError:
示例#12
0
from druploy.core import *
from druploy.utils import Utils
from druploy.config import Config
from druploy.exceptions import *
from druploy.server import *
from druploy.project import *
from druploy.deployment import *
from druploy.drupal import *
from druploy.code import *
from druploy.database import *
from druploy.files import *
from druploy.domain import *

# Initialization
try:
    Utils.notice("Run initialisation code.")
    env.use_ssh_config = True
    env.forward_agent = True
    env.local_path = os.path.dirname(os.path.realpath(__file__))
    env.template_dir = os.path.join(env.local_path, "templates")
    env.server = None
    env.project = None
    env.source_project = None
    env.source_deployment = None
    env.source_code = None
    env.source_files = None
    env.source_database = None
    env.deployment = None
    env.domain = None
    env.clean = ()
except AgileProjectError: