Commit 59022aee authored by Igor's avatar Igor Committed by Commit Bot

Add logs in enrollment flow

Device is going through enrollment flow rarely, and the logs that are
written by that flow should appear only once. Which means the additions
in this CL will not pollute the logs too much.

BUG=chromium:1021892
TEST=Manual check that logs appear as expected at enrollment.

Change-Id: Ia24c11f658ad9eb869390212bb7db8590b621135
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1991433Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Reviewed-by: default avatarIgor <igorcov@chromium.org>
Commit-Queue: Igor <igorcov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735487}
parent 631967a6
......@@ -198,6 +198,7 @@ void EnrollmentScreen::OnAuthCleared(const base::Closure& callback) {
}
void EnrollmentScreen::Show() {
VLOG(1) << "Show enrollment screen";
UMA(policy::kMetricEnrollmentTriggered);
if (enrollment_config_.mode ==
policy::EnrollmentConfig::MODE_ENROLLED_ROLLBACK) {
......@@ -316,6 +317,7 @@ void EnrollmentScreen::OnCancel() {
}
void EnrollmentScreen::OnConfirmationClosed() {
VLOG(1) << "Confirmation closed.";
// The callback passed to ClearAuth is called either immediately or gets
// wrapped in a callback bound to a weak pointer from |weak_factory_| - in
// either case, passing exit_callback_ directly should be safe.
......@@ -326,11 +328,13 @@ void EnrollmentScreen::OnConfirmationClosed() {
}
void EnrollmentScreen::OnAuthError(const GoogleServiceAuthError& error) {
LOG(ERROR) << "Auth error: " << error.state();
RecordEnrollmentErrorMetrics();
view_->ShowAuthError(error);
}
void EnrollmentScreen::OnEnrollmentError(policy::EnrollmentStatus status) {
LOG(ERROR) << "Enrollment error: " << status.status();
RecordEnrollmentErrorMetrics();
// If the DM server does not have a device pre-provisioned for attestation-
// based enrollment and we have a fallback authentication, show it.
......@@ -351,6 +355,7 @@ void EnrollmentScreen::OnEnrollmentError(policy::EnrollmentStatus status) {
void EnrollmentScreen::OnOtherError(
EnterpriseEnrollmentHelper::OtherError error) {
LOG(ERROR) << "Other enrollment error: " << error;
RecordEnrollmentErrorMetrics();
view_->ShowOtherError(error);
if (WizardController::UsingHandsOffEnrollment())
......@@ -358,6 +363,7 @@ void EnrollmentScreen::OnOtherError(
}
void EnrollmentScreen::OnDeviceEnrolled() {
VLOG(1) << "Device enrolled.";
enrollment_succeeded_ = true;
enrollment_helper_->GetDeviceAttributeUpdatePermission();
......@@ -518,10 +524,12 @@ void EnrollmentScreen::OnActiveDirectoryJoined(
authpolicy::ErrorType error,
const std::string& machine_domain) {
if (error == authpolicy::ERROR_NONE) {
VLOG(1) << "Joined active directory";
view_->ShowEnrollmentSpinnerScreen();
std::move(on_joined_callback_).Run(machine_domain);
return;
}
LOG(ERROR) << "Active directory join error: " << error;
view_->ShowActiveDirectoryScreen(std::string() /* domain_join_config */,
machine_name, username, error);
}
......
......@@ -235,6 +235,8 @@ void EnterpriseEnrollmentHelperImpl::DoEnroll(
policy::EnrollmentConfig::MODE_OFFLINE_DEMO ||
oauth_status_ == OAUTH_STARTED_WITH_AUTH_CODE ||
oauth_status_ == OAUTH_STARTED_WITH_TOKEN);
VLOG(1) << "Enroll with token type: "
<< static_cast<int>(auth_data->token_type());
auth_data_ = std::move(auth_data);
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
......@@ -259,7 +261,7 @@ void EnterpriseEnrollmentHelperImpl::DoEnroll(
enrollment_config_, auth_data_->Clone(),
base::Bind(&EnterpriseEnrollmentHelperImpl::OnEnrollmentFinished,
weak_ptr_factory_.GetWeakPtr()));
dcp_initializer->StartEnrollment();
dcp_initializer->StartEnrollment();
}
void EnterpriseEnrollmentHelperImpl::GetDeviceAttributeUpdatePermission() {
......@@ -314,6 +316,7 @@ void EnterpriseEnrollmentHelperImpl::OnTokenFetched(
void EnterpriseEnrollmentHelperImpl::OnEnrollmentFinished(
policy::EnrollmentStatus status) {
VLOG(1) << "Enrollment finished, status: " << status.status();
ReportEnrollmentStatus(status);
if (oauth_status_ != OAUTH_NOT_STARTED)
oauth_status_ = OAUTH_FINISHED;
......
......@@ -248,6 +248,7 @@ void EnrollmentHandlerChromeOS::StartEnrollment() {
return;
}
VLOG(1) << "Requesting state keys.";
state_keys_broker_->RequestStateKeys(
base::Bind(&EnrollmentHandlerChromeOS::HandleStateKeysResult,
weak_ptr_factory_.GetWeakPtr()));
......@@ -381,12 +382,14 @@ void EnrollmentHandlerChromeOS::HandleStateKeysResult(
register_params_->current_state_key =
state_keys_broker_->current_state_key();
if (state_keys.empty() || register_params_->current_state_key.empty()) {
LOG(ERROR) << "State keys empty.";
ReportResult(
EnrollmentStatus::ForStatus(EnrollmentStatus::NO_STATE_KEYS));
return;
}
}
VLOG(1) << "State keys generated.";
SetStep(STEP_LOADING_STORE);
StartRegistration();
}
......@@ -398,6 +401,7 @@ void EnrollmentHandlerChromeOS::StartRegistration() {
// after the CloudPolicyStore has initialized.
return;
}
VLOG(1) << "Start registration, config mode = " << enrollment_config_.mode;
SetStep(STEP_REGISTRATION);
if (enrollment_config_.is_mode_attestation()) {
StartAttestationBasedEnrollmentFlow();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment