コード例 #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'])
コード例 #2
0
ファイル: test_system.py プロジェクト: dpoirier/argyle
 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'])
コード例 #3
0
ファイル: nginx.py プロジェクト: dmyung/argyle
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')
コード例 #4
0
ファイル: rabbitmq.py プロジェクト: waytai/argyle
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')
コード例 #5
0
ファイル: rabbitmq.py プロジェクト: dmyung/argyle
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')
コード例 #6
0
ファイル: nginx.py プロジェクト: dmyung/argyle
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)
コード例 #7
0
ファイル: postgres.py プロジェクト: dpoirier/argyle
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')
コード例 #8
0
ファイル: postgres.py プロジェクト: dmyung/argyle
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")
コード例 #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')
コード例 #10
0
ファイル: fabfile.py プロジェクト: OpenData-NC/openrural-nc
def restart_nginx():
    """Restart Nginx."""

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