Index: components/policy/core/common/remote_commands/remote_commands_service.cc |
diff --git a/components/policy/core/common/remote_commands/remote_commands_service.cc b/components/policy/core/common/remote_commands/remote_commands_service.cc |
index c547f8e1155450b845e104b79660228f555538ca..dc513b553bd409dec584133828b78c715bedcc3d 100644 |
--- a/components/policy/core/common/remote_commands/remote_commands_service.cc |
+++ b/components/policy/core/common/remote_commands/remote_commands_service.cc |
@@ -78,7 +78,7 @@ void RemoteCommandsService::SetClockForTesting( |
void RemoteCommandsService::EnqueueCommand( |
const enterprise_management::RemoteCommand& command) { |
if (!command.has_type() || !command.has_unique_id()) { |
- LOG(WARNING) << "Invalid remote command from server."; |
+ LOG(ERROR) << "Invalid remote command from server."; |
return; |
} |
@@ -94,6 +94,7 @@ void RemoteCommandsService::EnqueueCommand( |
factory_->BuildJobForType(command.type()); |
if (!job || !job->Init(queue_.GetNowTicks(), command)) { |
+ LOG(ERROR) << "Initialization of remote command failed."; |
em::RemoteCommandResult ignored_result; |
ignored_result.set_result( |
em::RemoteCommandResult_ResultType_RESULT_IGNORED); |
@@ -121,12 +122,17 @@ void RemoteCommandsService::OnJobFinished(RemoteCommandJob* command) { |
result.set_timestamp((command->execution_started_time() - |
base::TimeTicks::UnixEpoch()).InMilliseconds()); |
+ std::string result_string; |
+ |
if (command->status() == RemoteCommandJob::SUCCEEDED || |
command->status() == RemoteCommandJob::FAILED) { |
- if (command->status() == RemoteCommandJob::SUCCEEDED) |
+ if (command->status() == RemoteCommandJob::SUCCEEDED) { |
result.set_result(em::RemoteCommandResult_ResultType_RESULT_SUCCESS); |
- else |
+ result_string = "SUCCESS"; |
+ } else { |
result.set_result(em::RemoteCommandResult_ResultType_RESULT_FAILURE); |
+ result_string = "FAILURE"; |
+ } |
const std::unique_ptr<std::string> result_payload = |
command->GetResultPayload(); |
if (result_payload) |
@@ -134,10 +140,14 @@ void RemoteCommandsService::OnJobFinished(RemoteCommandJob* command) { |
} else if (command->status() == RemoteCommandJob::EXPIRED || |
command->status() == RemoteCommandJob::INVALID) { |
result.set_result(em::RemoteCommandResult_ResultType_RESULT_IGNORED); |
+ result_string = "IGNORED"; |
} else { |
NOTREACHED(); |
} |
+ LOG(WARNING) << "Remote command " << command->unique_id() |
+ << " finished with result " << result_string; |
Andrew T Wilson (Slow)
2016/05/04 14:43:23
This is OK, but you could also just print out the
Marton Hunyady
2016/05/09 13:48:15
Done.
|
+ |
unsent_results_.push_back(result); |
FetchRemoteCommands(); |