# License for the specific language governing permissions and limitations
# under the License.
+from distutils import version
+import re
+
from oslo_config import cfg
from oslo_log import log as logging
+import testtools
from neutron.agent.linux import external_process
from neutron.agent.linux import keepalived
LOG = logging.getLogger(__name__)
+def keepalived_version_not_supported():
+ try:
+ cmd = ['keepalived', '--version']
+ out = utils.execute(cmd, return_stderr=True)
+ ver = re.search(r"Keepalived v(\d+\.\d+\.\d+)", out[1]).group(1)
+ return version.LooseVersion(ver) >= version.LooseVersion("1.2.11")
+ except (OSError, RuntimeError, IndexError, ValueError) as e:
+ LOG.debug("Exception while checking keepalived version. "
+ "Exception: %s", e)
+ return False
+
+
class KeepalivedManagerTestCase(base.BaseTestCase,
test_keepalived.KeepalivedConfBaseMixin):
self.assertEqual(self.expected_config.get_config_str(),
self.manager.get_conf_on_disk())
+ @testtools.skipIf(keepalived_version_not_supported(), 'bug/1511311')
def test_keepalived_respawns(self):
self.manager.spawn()
process = self.manager.get_process()