def test_disable_no_tool(self, m_subp, m_which):
     """Log error when neither route nor ip commands are available"""
     m_which.return_value = None  # Find neither ifconfig nor ip
     ec2_meta.handle('foo', DISABLE_CFG, None, LOG, None)
     self.assertEqual(
         [mock.call('ip'), mock.call('ifconfig')], m_which.call_args_list)
     m_subp.assert_not_called()
 def test_disable_no_tool(self, m_subp, m_which):
     """Log error when neither route nor ip commands are available"""
     m_which.return_value = None  # Find neither ifconfig nor ip
     ec2_meta.handle('foo', DISABLE_CFG, None, LOG, None)
     self.assertEqual(
         [mock.call('ip'), mock.call('ifconfig')], m_which.call_args_list)
     m_subp.assert_not_called()
 def test_disable_ip(self, m_subp, m_which):
     """Set the route if ip command is available"""
     m_which.side_effect = lambda x: x if x == 'ip' else None
     ec2_meta.handle('foo', DISABLE_CFG, None, LOG, None)
     m_subp.assert_called_with(
         ['ip', 'route', 'add', 'prohibit', '169.254.169.254'],
         capture=False)
 def test_disable_ip(self, m_subp, m_which):
     """Set the route if ip command is available"""
     m_which.side_effect = lambda x: x if x == 'ip' else None
     ec2_meta.handle('foo', DISABLE_CFG, None, LOG, None)
     m_subp.assert_called_with(
         ['ip', 'route', 'add', 'prohibit', '169.254.169.254'],
         capture=False)
Exemple #5
0
 def test_disable_ip(self, m_subp, m_which):
     """Set the route if ip command is available"""
     m_which.side_effect = lambda x: x if x == "ip" else None
     ec2_meta.handle("foo", DISABLE_CFG, None, LOG, None)
     m_subp.assert_called_with(
         ["ip", "route", "add", "prohibit", "169.254.169.254"],
         capture=False,
     )