diff --git a/cpp/command/command_executor.cpp b/cpp/command/command_executor.cpp index b228a0e5..9586ab8b 100644 --- a/cpp/command/command_executor.cpp +++ b/cpp/command/command_executor.cpp @@ -381,15 +381,15 @@ bool CommandExecutor::Detach(const CommandContext &context, PrimaryDevice &devic return context.ReturnLocalizedError(LocalizationKey::ERROR_DETACH); } + // Remove both potential identifiers + PropertyHandler::GetInstance().RemoveProperties(fmt::format("{0}{1}:{2}.", PropertyHandler::DEVICE, id, lun)); + PropertyHandler::GetInstance().RemoveProperties(fmt::format("{0}{1}.", PropertyHandler::DEVICE, id)); + // If no LUN is left also delete the controller if (!controller->GetLunCount() && !controller_factory.DeleteController(*controller)) { return context.ReturnLocalizedError(LocalizationKey::ERROR_DETACH); } - // Remove both potential identifiers - PropertyHandler::GetInstance().RemoveProperties(fmt::format("{0}{1}:{2}.", PropertyHandler::DEVICE, id, lun)); - PropertyHandler::GetInstance().RemoveProperties(fmt::format("{0}{1}.", PropertyHandler::DEVICE, id)); - s2p_logger.info("Detached " + identifier); }