def platform_type(self): # Handle upgrade path of pickled ds if not hasattr(self, '_platform_type'): self._platform_type = None if not self._platform_type: self._platform_type = 'lxd' if util.is_lxd() else 'nocloud' return self._platform_type
def platform_type(self): # Handle upgrade path of pickled ds if not hasattr(self, "_platform_type"): self._platform_type = None if not self._platform_type: self._platform_type = "lxd" if util.is_lxd() else "nocloud" return self._platform_type
def platform_type(self): # Handle upgrade path of pickled ds if not hasattr(self, '_platform_type'): self._platform_type = None if not self._platform_type: self._platform_type = 'lxd' if util.is_lxd() else 'nocloud' return self._platform_type
def test_is_lxd_false_when_sock_device_absent(self, m_exists): """When lxd's /dev/lxd/sock is absent, is_lxd returns false.""" m_exists.return_value = False self.assertFalse(util.is_lxd()) m_exists.assert_called_once_with('/dev/lxd/sock')
def test_is_lxd_true_on_sock_device(self, m_exists): """When lxd's /dev/lxd/sock exists, is_lxd returns true.""" m_exists.return_value = True self.assertTrue(util.is_lxd()) m_exists.assert_called_once_with('/dev/lxd/sock')
def test_is_lxd_false_when_sock_device_absent(self, m_exists): """When lxd's /dev/lxd/sock is absent, is_lxd returns false.""" m_exists.return_value = False self.assertFalse(util.is_lxd()) m_exists.assert_called_once_with('/dev/lxd/sock')
def test_is_lxd_true_on_sock_device(self, m_exists): """When lxd's /dev/lxd/sock exists, is_lxd returns true.""" m_exists.return_value = True self.assertTrue(util.is_lxd()) m_exists.assert_called_once_with('/dev/lxd/sock')