Ejemplo n.º 1
0
def _disable_default_nginx(remote):
    """
    Fix up nginx values
    """
    script = textwrap.dedent('''
        if [ -f /etc/nginx/conf.d/default.conf ]; then
            mv /etc/nginx/conf.d/default.conf \
                /etc/nginx/conf.d/default.disabled
        fi
        if [ -f /etc/nginx/sites-enabled/default ] ; then
            rm /etc/nginx/sites-enabled/default
        fi
        service nginx restart
        service {service} restart
    ''')
    service = pkg.get_service_name('httpd', remote)
    script = script.format(service=service)
    teuthology.sudo_write_file(remote, '/tmp/disable.nginx', script)
    return remote.run(args=['sudo', 'bash', '/tmp/disable.nginx'],
                      stdout=StringIO())
Ejemplo n.º 2
0
def _disable_default_nginx(remote):
    """
    Fix up nginx values
    """
    script = textwrap.dedent('''
        if [ -f /etc/nginx/conf.d/default.conf ]; then
            mv /etc/nginx/conf.d/default.conf \
                /etc/nginx/conf.d/default.disabled
        fi
        if [ -f /etc/nginx/sites-enabled/default ] ; then
            rm /etc/nginx/sites-enabled/default
        fi
        service nginx restart
        service {service} restart
    ''')
    service = pkg.get_service_name('httpd', remote)
    script = script.format(service=service)
    teuthology.sudo_write_file(remote, '/tmp/disable.nginx', script)
    return remote.run(args=['sudo', 'bash', '/tmp/disable.nginx'],
                      stdout=StringIO())
Ejemplo n.º 3
0
 def test_get_service_name_not_found(self):
     remote = Mock()
     remote.os.package_type = "rpm"
     assert packaging.get_service_name('notthere', remote) is None
Ejemplo n.º 4
0
 def test_get_service_name_rpm(self):
     remote = Mock()
     remote.os.package_type = "rpm"
     assert packaging.get_service_name('httpd', remote) == 'httpd'
Ejemplo n.º 5
0
 def test_get_service_name_deb(self):
     remote = Mock()
     remote.os.package_type = "deb"
     assert packaging.get_service_name('httpd', remote) == 'apache2'
Ejemplo n.º 6
0
 def test_get_service_name_not_found(self):
     remote = Mock()
     remote.os.package_type = "rpm"
     assert packaging.get_service_name('notthere', remote) is None
Ejemplo n.º 7
0
 def test_get_service_name_rpm(self):
     remote = Mock()
     remote.os.package_type = "rpm"
     assert packaging.get_service_name('httpd', remote) == 'httpd'
Ejemplo n.º 8
0
 def test_get_service_name_deb(self):
     remote = Mock()
     remote.os.package_type = "deb"
     assert packaging.get_service_name('httpd', remote) == 'apache2'
Ejemplo n.º 9
0
 def test_get_service_name_not_found(self, m_misc):
     m_misc.get_system_type.return_value = "rpm"
     assert packaging.get_service_name('notthere', Mock()) is None
Ejemplo n.º 10
0
 def test_get_service_name_rpm(self, m_misc):
     m_misc.get_system_type.return_value = "rpm"
     assert packaging.get_service_name('httpd', Mock()) == 'httpd'
Ejemplo n.º 11
0
 def test_get_service_name_deb(self, m_misc):
     m_misc.get_system_type.return_value = "deb"
     assert packaging.get_service_name('httpd', Mock()) == 'apache2'
Ejemplo n.º 12
0
 def test_get_service_name_not_found(self, m_misc):
     m_misc.get_system_type.return_value = "rpm"
     assert packaging.get_service_name('notthere', Mock()) is None
Ejemplo n.º 13
0
 def test_get_service_name_rpm(self, m_misc):
     m_misc.get_system_type.return_value = "rpm"
     assert packaging.get_service_name('httpd', Mock()) == 'httpd'
Ejemplo n.º 14
0
 def test_get_service_name_deb(self, m_misc):
     m_misc.get_system_type.return_value = "deb"
     assert packaging.get_service_name('httpd', Mock()) == 'apache2'