Exemplo n.º 1
0
 def test_restart_service(self):
     "Restart is thin wrappers around service_command."
     with patch('argyle.system.service_command') as service_command:
         system.restart_service('nginx')
         self.assertTrue(service_command.called)
         args, kwargs = service_command.call_args
         self.assertEqual(list(args), ['nginx', 'restart'])
Exemplo n.º 2
0
 def test_restart_service(self):
     "Restart is thin wrappers around service_command."
     with patch('argyle.system.service_command') as service_command:
         system.restart_service('nginx')
         self.assertTrue(service_command.called)
         args, kwargs = service_command.call_args
         self.assertEqual(list(args), ['nginx', 'restart'])
Exemplo n.º 3
0
def disable_site(site_name):
    """Disables Nginx site configuration."""

    site = u'/etc/nginx/sites-enabled/%s' % site_name
    if files.exists(site):
        sudo(u'rm %s' % site)
        restart_service(u'nginx')
Exemplo n.º 4
0
def upload_rabbitmq_conf(template_name=None, context=None, restart=True):
    """Upload RabbitMQ configuration from a template."""

    template_name = template_name or u'rabbitmq/rabbitmq.config'
    destination = u'/etc/rabbitmq/rabbitmq.config'
    upload_template(template_name, destination, context=context, use_sudo=True)
    if restart:
        restart_service(u'rabbitmq')
Exemplo n.º 5
0
def upload_rabbitmq_conf(template_name=None, context=None, restart=True):
    """Upload RabbitMQ configuration from a template."""
    
    template_name = template_name or u'rabbitmq/rabbitmq.config'
    destination = u'/etc/rabbitmq/rabbitmq.config'
    upload_template(template_name, destination, context=context, use_sudo=True)
    if restart:
        restart_service(u'rabbitmq')
Exemplo n.º 6
0
def enable_site(site_name):
    """Enable an available Nginx site."""

    site_available = u'/etc/nginx/sites-available/%s' % site_name
    site_enabled = u'/etc/nginx/sites-enabled/%s' % site_name
    if files.exists(site_available):
        sudo(u'ln -s -f %s %s' % (site_available, site_enabled))
        restart_service(u'nginx')
    else:
        abort(u'%s site configuration is not available' % site_name)
Exemplo n.º 7
0
def upload_pg_hba_conf(template_name=None, pg_version=None, pg_cluster='main', restart=True):
    """
    Upload configuration for pg_hba.conf
    If the version is not given it will be guessed.
    """

    template_name = template_name or u'postgres/pg_hba.conf'
    version = pg_version or detect_version()
    config = {'version': version, 'cluster': pg_cluster}
    destination = u'/etc/postgresql/%(version)s/%(cluster)s/pg_hba.conf' % config
    upload_template(template_name, destination, use_sudo=True)
    if restart:
        restart_service(u'postgresql')
Exemplo n.º 8
0
def upload_pg_hba_conf(template_name=None, pg_version=None, pg_cluster="main", restart=True):
    """
    Upload configuration for pg_hba.conf
    If the version is not given it will be guessed.
    """

    template_name = template_name or u"postgres/pg_hba.conf"
    version = pg_version or detect_version()
    config = {"version": version, "cluster": pg_cluster}
    destination = u"/etc/postgresql/%(version)s/%(cluster)s/pg_hba.conf" % config
    upload_template(template_name, destination, use_sudo=True)
    if restart:
        restart_service(u"postgresql")
Exemplo n.º 9
0
def upload_pg_hba_conf(template_name=None,
                       pg_version=None,
                       pg_cluster='main',
                       restart=True):
    """
    Upload configuration for pg_hba.conf
    If the version is not given it will be guessed.
    """

    template_name = template_name or u'postgres/pg_hba.conf'
    version = pg_version or detect_version()
    config = {'version': version, 'cluster': pg_cluster}
    destination = u'/etc/postgresql/%(version)s/%(cluster)s/pg_hba.conf' % config
    upload_template(template_name, destination, use_sudo=True)
    if restart:
        restart_service(u'postgresql')
Exemplo n.º 10
0
def restart_nginx():
    """Restart Nginx."""

    require("environment", provided_by=env.environments)
    system.restart_service("nginx")