Пример #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())
Пример #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())
Пример #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
Пример #4
0
 def test_get_service_name_rpm(self):
     remote = Mock()
     remote.os.package_type = "rpm"
     assert packaging.get_service_name('httpd', remote) == 'httpd'
Пример #5
0
 def test_get_service_name_deb(self):
     remote = Mock()
     remote.os.package_type = "deb"
     assert packaging.get_service_name('httpd', remote) == 'apache2'
Пример #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
Пример #7
0
 def test_get_service_name_rpm(self):
     remote = Mock()
     remote.os.package_type = "rpm"
     assert packaging.get_service_name('httpd', remote) == 'httpd'
Пример #8
0
 def test_get_service_name_deb(self):
     remote = Mock()
     remote.os.package_type = "deb"
     assert packaging.get_service_name('httpd', remote) == 'apache2'
Пример #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
Пример #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'
Пример #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'
Пример #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
Пример #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'
Пример #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'