def test_iscsi_client_caps(self): mgr = FakeMgr() iscsi_service = self._get_services(mgr)['iscsi'] iscsi_spec = IscsiServiceSpec(service_type='iscsi', service_id="a") iscsi_spec.daemon_type = "iscsi" iscsi_spec.daemon_id = "a" iscsi_spec.spec = MagicMock() iscsi_spec.spec.daemon_type = "iscsi" iscsi_spec.spec.ssl_cert = '' iscsi_service.prepare_create(iscsi_spec) expected_caps = [ 'mon', 'profile rbd, allow command "osd blocklist", allow command "config-key get" with "key" prefix "iscsi/"', 'mgr', 'allow command "service status"', 'osd', 'allow rwx' ] expected_call = call({ 'prefix': 'auth get-or-create', 'entity': 'client.iscsi.a', 'caps': expected_caps }) assert expected_call in mgr.check_mon_command.mock_calls
def test_iscsi_client_caps(self): mgr = FakeMgr() iscsi_service = self._get_services(mgr)['iscsi'] iscsi_spec = IscsiServiceSpec(service_type='iscsi', service_id="a") iscsi_spec.daemon_type = "iscsi" iscsi_spec.daemon_id = "a" iscsi_spec.spec = MagicMock() iscsi_spec.spec.daemon_type = "iscsi" iscsi_spec.spec.ssl_cert = '' mgr.spec_store = MagicMock() mgr.spec_store.__getitem__.return_value = iscsi_spec iscsi_daemon_spec = CephadmDaemonDeploySpec( host='host', daemon_id='a', service_name=iscsi_spec.service_name()) iscsi_service.prepare_create(iscsi_daemon_spec) expected_caps = [ 'mon', 'profile rbd, allow command "osd blocklist", allow command "config-key get" with "key" prefix "iscsi/"', 'mgr', 'allow command "service status"', 'osd', 'allow rwx' ] expected_call = call({ 'prefix': 'auth get-or-create', 'entity': 'client.iscsi.a', 'caps': expected_caps }) expected_call2 = call({ 'prefix': 'auth caps', 'entity': 'client.iscsi.a', 'caps': expected_caps }) assert expected_call in mgr.check_mon_command.mock_calls assert expected_call2 in mgr.mon_command.mock_calls